/* LRM Cloud - App Styles */

/* =============================================================================
   Base Styles
   ============================================================================= */

/* Keep focus outline for accessibility but remove default browser styling */
h1:focus {
    outline: none;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* =============================================================================
   Error UI
   ============================================================================= */

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* Blazor error boundary */
.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* =============================================================================
   Loading Progress Indicator
   ============================================================================= */

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #594ae2; /* MudBlazor primary color */
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: 3.25rem 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

/* =============================================================================
   Offline Banner
   ============================================================================= */

.offline-banner {
    position: sticky;
    top: 0;
    z-index: 100;
    border-radius: 0 !important;
}

/* =============================================================================
   Responsive Utilities
   ============================================================================= */

/* Touch-friendly tap targets on mobile */
@media (max-width: 599px) {
    .mud-button {
        min-height: 44px;
        min-width: 44px;
    }

    .mud-icon-button {
        min-height: 44px;
        min-width: 44px;
    }

    /* Larger form inputs on mobile */
    .mud-input {
        font-size: 16px !important; /* Prevent iOS zoom on focus */
    }

    /* Full-width dialogs on mobile */
    .mud-dialog {
        margin: 8px !important;
        max-height: calc(100vh - 16px) !important;
    }

    /* Adjust card padding on mobile */
    .mud-card-content {
        padding: 12px !important;
    }
}

/* Tablet adjustments */
@media (min-width: 600px) and (max-width: 959px) {
    .mud-dialog {
        margin: 24px !important;
    }
}

/* =============================================================================
   Custom Scrollbar
   ============================================================================= */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Dark mode scrollbar */
.mud-theme-dark ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

.mud-theme-dark ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* =============================================================================
   Translation Grid Styles
   ============================================================================= */

.translation-grid .mud-table-cell {
    vertical-align: top;
}

.translation-grid .mud-input-root-outlined {
    background: transparent;
}

/* Missing translation indicator */
.translation-cell-missing {
    background-color: rgba(244, 67, 54, 0.08);
}

.mud-theme-dark .translation-cell-missing {
    background-color: rgba(244, 67, 54, 0.15);
}

/* =============================================================================
   Cursor Utilities
   ============================================================================= */

.cursor-pointer {
    cursor: pointer;
}

.cursor-not-allowed {
    cursor: not-allowed;
}

/* =============================================================================
   Animation Utilities
   ============================================================================= */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* =============================================================================
   Print Styles
   ============================================================================= */

@media print {
    .mud-appbar,
    .mud-drawer,
    .offline-banner,
    .mud-snackbar-provider {
        display: none !important;
    }

    .mud-main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* Update available banner */
.update-banner {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    padding: 12px 20px;
    border-radius: 8px;
    border-left: 4px solid var(--mud-palette-info);
}

/* =============================================================================
   Masked Input (for API keys - prevents browser autofill)
   Uses text input with CSS masking instead of password type.
   Font-based solution for cross-browser support.
   ============================================================================= */

@font-face {
    font-family: 'text-security-disc';
    src: url('https://cdn.jsdelivr.net/npm/text-security@1.1.2/dist/text-security-disc.woff2') format('woff2'),
         url('https://cdn.jsdelivr.net/npm/text-security@1.1.2/dist/text-security-disc.woff') format('woff');
}

.masked-input input {
    font-family: 'text-security-disc', sans-serif !important;
    /* Fallback for WebKit browsers */
    -webkit-text-security: disc;
}
