/* =============================================================
   FasonERP – app.css
   Global styles, responsive utilities, login, Blazor error UI.
   Module-specific styles are in their own CSS files (uretim.css, maas.css).
   ============================================================= */

/* ========= GLOBAL RESET & RESPONSIVE ========= */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    -webkit-overflow-scrolling: touch;
}

/* Prevent images/media from overflowing */
img, svg, video, canvas, iframe {
    max-width: 100%;
    height: auto;
}

/* ========= LOGIN ========= */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
    padding: 1rem;
}

.login-box {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .18);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #1565c0;
    font-weight: 700;
}

.login-error {
    background: #ffebee;
    color: #c62828;
    padding: .75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    text-align: center;
    font-size: .9rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: .4rem;
    font-weight: 500;
    font-size: .9rem;
}

.form-group input {
    width: 100%;
    padding: .65rem .85rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color .2s;
}

.form-group input:focus {
    outline: none;
    border-color: #1565c0;
    box-shadow: 0 0 0 3px rgba(21, 101, 192, .15);
}

.login-btn {
    width: 100%;
    padding: .75rem;
    background: #1565c0;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}

.login-btn:hover {
    background: #0d47a1;
}

/* ========= MUDBLAZOR BADGE FIX ========= */
.mud-tabs .mud-tab,
.mud-tabs .mud-tab-slider-container,
.mud-tabs .mud-tabs-header,
.mud-tabs .mud-tabs-tabbar-inner {
    overflow: visible !important;
}

.mud-badge-root {
    overflow: visible !important;
}

/* ========= RESPONSIVE UTILITY CLASSES ========= */
.page-header {
    flex-wrap: wrap;
    gap: 8px;
}

.page-subtitle {
    margin-bottom: 16px;
}

/* Stat cards */
.stat-card {
    border-radius: 12px;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

/* ========= GLOBAL RESPONSIVE - ALL MODULES ========= */

/* Tables: horizontal scroll on mobile */
.mud-table {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

.mud-simple-table {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

/* MudTabs: scrollable on mobile */
.mud-tabs-header {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

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

/* ==== TABLET (max-width: 960px) ==== */
@media (max-width: 960px) {
    .mud-dialog {
        max-width: calc(100vw - 24px) !important;
        margin: 12px !important;
    }

    /* Stack horizontal layouts on tablet */
    .mud-stack[style*="flex-direction: row"],
    .mud-stack.flex-row {
        flex-wrap: wrap !important;
    }

    /* Stat card h4 text smaller */
    .stat-card .mud-typography-h4 {
        font-size: 1.5rem !important;
    }

    .stat-card .mud-typography-h5 {
        font-size: 1.2rem !important;
    }
}

/* ==== MOBILE (max-width: 600px) ==== */
@media (max-width: 600px) {
    /* MudGrid tighter spacing */
    .mud-grid {
        margin: 0 !important;
    }
    .mud-grid > .mud-grid-item {
        padding: 4px !important;
    }

    /* MudPaper reduce padding */
    .mud-paper.pa-4 {
        padding: 12px !important;
    }
    .mud-paper.pa-5 {
        padding: 16px !important;
    }

    /* Page header smaller */
    .page-header .mud-typography-h5 {
        font-size: 1.1rem !important;
    }

    /* MudDialog full width */
    .mud-dialog {
        max-width: 100vw !important;
        width: 100vw !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }
    .mud-dialog-content {
        padding: 12px !important;
    }

    /* MudTabs: smaller text */
    .mud-tab {
        font-size: 0.75rem !important;
        min-width: auto !important;
        padding: 6px 10px !important;
    }

    /* Table cells smaller */
    .mud-table-cell {
        padding: 6px 8px !important;
        font-size: 0.8rem !important;
    }
    .mud-table-head th {
        padding: 8px !important;
        font-size: 0.75rem !important;
    }

    /* Stat card adjustments */
    .stat-card .mud-typography-h4 {
        font-size: 1.3rem !important;
    }
    .stat-card .mud-typography-h5 {
        font-size: 1.1rem !important;
    }
    .stat-card .mud-icon-root {
        font-size: 1.8rem !important;
    }

    /* Buttons wrap */
    .mud-button-root {
        font-size: 0.78rem !important;
    }

    /* Nav menu drawer responsive */
    .mud-drawer {
        width: 220px !important;
    }

    /* MudAlert compact */
    .mud-alert {
        padding: 8px 12px !important;
    }

    /* Chips smaller */
    .mud-chip {
        font-size: 0.7rem !important;
    }

    /* Login responsive */
    .login-box {
        margin: 1rem;
        padding: 1.5rem;
    }

    /* Home grid */
    .home-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
}

/* ==== SMALL MOBILE (max-width: 400px) ==== */
@media (max-width: 400px) {
    .mud-paper.pa-4 {
        padding: 8px !important;
    }

    .stat-card .mud-typography-h4 {
        font-size: 1.1rem !important;
    }
    .stat-card .mud-typography-h5 {
        font-size: 0.95rem !important;
    }

    .mud-tab {
        font-size: 0.7rem !important;
        padding: 4px 6px !important;
    }

    .mud-table-cell {
        padding: 4px 6px !important;
        font-size: 0.75rem !important;
    }
}

/* ========= BLAZOR ERROR UI ========= */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    width: 100%;
    background: #ffdc00;
    padding: .6rem;
    text-align: center;
    z-index: 9999;
    font-size: .9rem;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    margin-left: 1rem;
    font-weight: 600;
}
