/**
 * IAMS — modern full-width app shell & shared components
 * Loaded globally from includes/header.php for all authenticated pages.
 */

:root {
    --sidebar-width: 260px;
    --iams-radius: 14px;
    --iams-radius-sm: 10px;
    --iams-shadow: 0 2px 16px rgba(15, 23, 42, 0.06);
    --iams-shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.1);
    --iams-surface: #ffffff;
    --iams-bg: #f1f5f9;
    --iams-border: #e2e8f0;
    --iams-text: #0f172a;
    --iams-muted: #64748b;
}

/* ─── Full-width shell ─── */
body {
    background: var(--iams-bg);
}

.dashboard-container {
    width: 100%;
    min-height: 100vh;
}

.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100vw - var(--sidebar-width));
    max-width: calc(100vw - var(--sidebar-width));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--iams-bg);
}

.content,
.content.iams-page,
.content.iams-dash {
    width: 100%;
    max-width: none;
    padding: 20px 24px 36px;
    flex: 1;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .main-content {
        margin-left: 70px;
        width: calc(100vw - 70px);
        max-width: calc(100vw - 70px);
    }
}

/* ─── Top bar ─── */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 200;
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--iams-border);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.welcome-message h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--iams-text);
    letter-spacing: -0.02em;
}

.welcome-message p {
    font-size: 13px;
    color: var(--iams-muted);
}

.user-info {
    background: #f8fafc;
    padding: 10px 14px;
    border-radius: var(--iams-radius-sm);
    border: 1px solid var(--iams-border);
}

/* Flash strip (below topbar) */
.iams-flash-wrap {
    padding: 0 24px 0;
    margin-top: -8px;
}

.iams-flash-wrap .alert {
    margin-bottom: 12px;
    border-radius: var(--iams-radius-sm);
    box-shadow: var(--iams-shadow);
}

/* ─── Page header & toolbar ─── */
.page-header {
    background: var(--iams-surface);
    border: 1px solid var(--iams-border);
    border-radius: var(--iams-radius);
    padding: 18px 22px;
    margin-bottom: 20px;
    box-shadow: var(--iams-shadow);
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--iams-text);
    margin: 0;
}

/* ─── Stat cards (assets, employees, etc.) ─── */
.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--iams-surface);
    border: 1px solid var(--iams-border);
    border-radius: var(--iams-radius);
    padding: 20px;
    box-shadow: var(--iams-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #6366f1);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--iams-shadow-lg);
}

.stat-icon {
    background: linear-gradient(135deg, #eff6ff, #f8fafc);
    border-radius: 12px;
    font-size: 28px;
    width: 52px;
    height: 52px;
}

.stat-info h3 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--iams-text);
    letter-spacing: -0.03em;
}

/* ─── Filters ─── */
.filters-section {
    background: var(--iams-surface);
    border: 1px solid var(--iams-border);
    border-radius: var(--iams-radius);
    padding: 18px 20px;
    margin-bottom: 20px;
    box-shadow: var(--iams-shadow);
}

.filters-form {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: flex-end;
}

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--iams-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.filter-group input,
.filter-group select {
    border-radius: 8px;
    border: 1px solid var(--iams-border);
    padding: 9px 12px;
    min-height: 40px;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ─── Tables ─── */
.table-container {
    border: 1px solid var(--iams-border);
    border-radius: var(--iams-radius);
    box-shadow: var(--iams-shadow);
}

.data-table thead {
    background: linear-gradient(180deg, #f8fafc, #f1f5f9);
}

.data-table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--iams-muted);
    padding: 14px 16px;
}

.data-table tbody tr {
    transition: background 0.15s;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table td {
    padding: 14px 16px;
    vertical-align: middle;
}

/* ─── Buttons ─── */
.btn {
    border-radius: 8px;
    font-weight: 600;
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.btn-sm {
    border-radius: 6px;
}

/* ─── Forms & cards ─── */
.form-container,
.card,
.modal-content {
    border-radius: var(--iams-radius);
    border: 1px solid var(--iams-border);
    box-shadow: var(--iams-shadow);
}

.form-group input,
.form-group select,
.form-group textarea {
    border-radius: 8px;
    border: 1px solid var(--iams-border);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

/* ─── Alerts ─── */
.alert {
    border-radius: var(--iams-radius-sm);
    font-weight: 500;
}

/* ─── Quick actions (legacy) ─── */
.quick-actions {
    border-radius: var(--iams-radius);
    border: 1px solid var(--iams-border);
}

.action-card {
    border-radius: var(--iams-radius-sm);
    border: 1px solid var(--iams-border);
}

.action-card:hover {
    border-color: #3b82f6;
}

/* ─── Sidebar polish ─── */
.sidebar {
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
}

.sidebar .nav-item {
    border-radius: 8px;
    margin: 2px 10px;
}

.sidebar .nav-item.active {
    background: rgba(59, 130, 246, 0.2);
}

/* ─── Login (index.php) ─── */
.login-container.iams-login-modern {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 40%, #3b82f6 100%);
}

.login-container.iams-login-modern .login-box {
    border-radius: 20px;
    padding: 44px 40px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.login-container.iams-login-modern .login-header h1 {
    background: linear-gradient(135deg, #1e40af, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.5rem;
}

.login-container.iams-login-modern .btn-primary {
    width: 100%;
    padding: 14px;
    font-size: 15px;
}

/* ─── Ticket user sidebar ─── */
.sidebar--ticket-user {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
}

/* ─── Dashboard (iams-dash) full width ─── */
.iams-dash {
    --dash-radius: 16px;
    --dash-shadow: var(--iams-shadow);
    width: 100%;
    max-width: none;
}

/* Ticket dashboard shared */
.ticket-dash-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.ticket-dash-stat {
    background: #fff;
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: var(--iams-shadow);
    border: 1px solid var(--iams-border);
    border-left: 4px solid #2563eb;
}
.ticket-dash-stat--closed { border-left-color: #94a3b8; }
.ticket-dash-stat__num {
    display: block;
    font-size: 1.75rem;
    font-weight: 800;
    color: #0f172a;
}
.ticket-dash-stat__label {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: #334155;
    margin-top: 4px;
}
.ticket-dash-stat__hint {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 4px;
}
.ticket-dash-section { margin-bottom: 24px; }
.ticket-dash-section__head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.ticket-dash-section__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
}
.ticket-dash-section__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: #dbeafe;
    color: #1d4ed8;
}
.ticket-dash-section__count--muted {
    background: #f1f5f9;
    color: #64748b;
}
.ticket-dash-card {
    background: #fff;
    border-radius: 12px;
    padding: 14px;
    box-shadow: var(--iams-shadow);
    overflow: auto;
    border: 1px solid var(--iams-border);
}
.ticket-dash-card--closed { background: #f8fafc; }
.ticket-dash-card--empty {
    text-align: center;
    padding: 32px 20px;
    color: #64748b;
}
.ticket-dash-empty {
    text-align: center;
    color: #94a3b8;
    padding: 20px !important;
}
.ticket-dash-muted { color: #64748b; font-size: 0.9rem; }
.ticket-dash-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: #e2e8f0;
    color: #334155;
}
.ticket-dash-pill--open { background: #dbeafe; color: #1d4ed8; }
.ticket-dash-pill--in-progress { background: #fef3c7; color: #b45309; }
.ticket-dash-pill--resolved { background: #dcfce7; color: #15803d; }
.ticket-dash-pill--closed { background: #f1f5f9; color: #64748b; }
.ticket-dash-pill--priority { background: #f3e8ff; color: #7c3aed; }
.ticket-dash-closed-wrap > summary {
    list-style: none;
    cursor: pointer;
}
.ticket-dash-closed-wrap > summary::-webkit-details-marker { display: none; }
.ticket-dash-section__toggle {
    margin-left: auto;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
}
.user-ticket-welcome {
    margin: 0 0 20px;
    padding: 18px 22px;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
    border: 1px solid #dbeafe;
    border-radius: var(--iams-radius);
    width: 100%;
}
.user-ticket-welcome h2 { margin: 0 0 6px; font-size: 1.25rem; }
.user-ticket-welcome p { margin: 0; font-size: 14px; color: #475569; }
