/* SwiftMaintenance — page layout shells */

/* ========== App shell ========== */
.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}
.app-body {
    display: flex;
    flex: 1;
    min-height: calc(100vh - var(--header-h) - var(--footer-h));
}
.app-main {
    flex: 1;
    min-width: 0;
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
}
.page-title { margin: 0 0 4px; font-size: var(--text-2xl); font-weight: 700; }
.page-subtitle { margin: 0; color: var(--text-subtle); font-size: var(--text-sm); }

/* ========== Top header / navbar ========== */
.navbar {
    height: var(--header-h);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    padding: 0 var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: saturate(180%) blur(8px);
}
.navbar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--text);
    min-width: 0;
    flex-shrink: 1;
    overflow: hidden;
}
.navbar-brand:hover { text-decoration: none; }
.navbar-brand img { height: 42px; width: auto; max-width: 100%; display: block; }
.navbar-brand .logo-dark,
.auth-logo .logo-dark { display: none; }
[data-theme="dark"] .navbar-brand .logo-light,
[data-theme="dark"] .auth-logo .logo-light { display: none; }
[data-theme="dark"] .navbar-brand .logo-dark,
[data-theme="dark"] .auth-logo .logo-dark { display: block; }
.navbar-actions { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }

.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 120ms ease, color 120ms ease;
}
.theme-toggle:hover { background: var(--bg-muted); color: var(--text); }
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: inline-flex; }
[data-theme="dark"] .theme-toggle .sun { display: inline-flex; }
[data-theme="dark"] .theme-toggle .moon { display: none; }

.notification-bell {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background-color 120ms ease, color 120ms ease;
}
.notification-bell:hover { background: var(--bg-muted); color: var(--text); }
.notification-bell-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--danger, #dc2626);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ========== Sidebar ========== */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    padding: var(--space-5) var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}
.sidebar-section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-subtle);
    font-weight: 600;
    padding: var(--space-3) var(--space-3) var(--space-1);
}
.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: var(--text-sm);
    font-weight: 500;
    text-decoration: none;
    transition: background-color 120ms ease, color 120ms ease;
}
.nav-link .icon { width: 16px; height: 16px; flex-shrink: 0; }
.nav-link:hover {
    background: var(--bg-muted);
    color: var(--text);
    text-decoration: none;
}
.nav-link.is-active {
    background: var(--brand-primary-50);
    color: var(--brand-primary);
}
[data-theme="dark"] .nav-link.is-active {
    background: var(--brand-primary-50);
    color: var(--brand-primary-400);
}

/* ========== Footer ========== */
.footer {
    min-height: var(--footer-h);
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    padding: 0 var(--space-6);
    display: flex;
    flex-direction: column;
    color: var(--text-subtle);
    font-size: var(--text-xs);
}
.footer-main {
    flex: 1;
    min-height: var(--footer-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.footer-brand { display: flex; align-items: center; gap: var(--space-2); }
.footer-brand img { height: 22px; width: auto; opacity: 0.85; }
.footer-links { display: flex; gap: var(--space-4); }
.footer-links a { color: var(--text-subtle); }
.footer-links a:hover { color: var(--brand-primary); }

/* ---- Maintenance-expiry blinking notice (CLIENT users only) ---- */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}
.footer-expiry-blink {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    padding: var(--space-2) 0;
    color: var(--danger, #dc2626);
    font-weight: 600;
    font-size: var(--text-xs);
    border-bottom: 1px solid var(--border);
}
.footer-expiry-blink span {
    animation: blink 1.2s ease-in-out infinite;
}

/* ========== Inline edit (click-to-edit, JIRA/Azure style) ========== */
/* [data-inline-edit] is the positioning context for the floating Save/Discard
   pill that anchors to the bottom-right of the field being edited. */
[data-inline-edit] { position: relative; }
[data-inline-form] { margin-top: var(--space-2); }
.inline-edit-actions {
    position: absolute;
    right: 0;
    bottom: calc(-1 * var(--space-2));
    transform: translateY(100%);
    display: flex;
    gap: var(--space-2);
    padding: var(--space-2);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 5;
}
.inline-editable-trigger {
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    padding: 0;
    text-align: left;
}
.inline-editable-trigger:hover { text-decoration: underline dotted; text-underline-offset: 3px; }
.inline-edit-hint {
    opacity: 0;
    transition: opacity 0.15s ease;
    color: var(--text-subtle);
    font-size: var(--text-xs);
    margin-left: var(--space-2);
}
[data-inline-edit]:hover .inline-edit-hint { opacity: 1; }

/* Hover affordance on the read view so it's clear it's click-to-edit, even
   before hovering the (optional) explicit [data-inline-toggle] button. */
[data-inline-display] {
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background-color 120ms ease;
    padding: var(--space-1) var(--space-2);
    margin: calc(-1 * var(--space-1)) calc(-1 * var(--space-2));
}
[data-inline-display]:hover {
    background: var(--bg-muted);
}

/* ========== Sidebar "Log time" card ========== */
.sidebar-log-form .form-group { margin-bottom: var(--space-3); }
.sidebar-log-form .form-group:last-of-type { margin-bottom: var(--space-2); }
.sidebar-worklog { list-style: none; margin: var(--space-3) 0 0; padding: 0; }
.sidebar-worklog li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-2);
    padding: var(--space-2) 0;
    border-top: 1px solid var(--border);
    font-size: var(--text-xs);
}
.sidebar-worklog .worklog-meta { color: var(--text-subtle); }

/* ========== Auth layout (login) ========== */
.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--brand-primary) 12%, transparent), transparent 55%),
        radial-gradient(circle at 80% 70%, color-mix(in srgb, var(--brand-accent) 14%, transparent), transparent 55%),
        var(--bg);
}
.auth-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
}
.auth-card {
    width: 100%;
    max-width: 420px;
}
.auth-logo {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-6);
}
.auth-logo img { height: 56px; width: auto; display: block; }

/* ========== Dashboard ========== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-4);
}

/* ========== Showcase page ========== */
.showcase-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--space-5);
}
.showcase-section {
    border-top: 1px solid var(--border);
    padding-top: var(--space-6);
    margin-top: var(--space-6);
}
.showcase-section:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.showcase-section h2 { font-size: var(--text-xl); margin-bottom: var(--space-4); }
.showcase-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
    padding: var(--space-4);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

/* ========== Navbar left cluster + mobile hamburger ========== */
.navbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
}
/* Hamburger is desktop-hidden; the responsive block below reveals it. */
.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text);
    cursor: pointer;
}
.sidebar-toggle:hover { background: var(--bg); }

/* Backdrop behind the off-canvas sidebar (created by ui.js). */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    top: var(--header-h);
    background: rgba(0, 0, 0, 0.4);
    z-index: 29;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
}
.sidebar-backdrop.is-visible { opacity: 1; visibility: visible; }

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

/* Tablet & below: the sidebar becomes a left off-canvas drawer, toggled by the hamburger. */
@media (max-width: 900px) {
    .sidebar-toggle { display: inline-flex; }
    .sidebar {
        position: fixed;
        top: var(--header-h);
        left: 0;
        bottom: 0;
        width: min(280px, 84vw);
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        z-index: 30;
        overflow-y: auto;
        box-shadow: var(--shadow-lg, 0 10px 30px rgba(0, 0, 0, 0.2));
    }
    .sidebar.is-open { transform: translateX(0); }
    .app-main { padding: var(--space-4); }
    .navbar { padding: 0 var(--space-4); gap: var(--space-2); }
    /* Drop the user's name from the account button so the actions cluster can't
       overrun the logo on narrow widths — the avatar still identifies the user. */
    .navbar-actions .user-name { display: none; }
    .footer { padding: 0 var(--space-4); }
    /* Lock background scroll while the drawer is open. */
    body.sidebar-open { overflow: hidden; }
}

/* Phones: tighten spacing and let the drawer fill more of the screen. */
@media (max-width: 640px) {
    .app-main { padding: var(--space-3); gap: var(--space-4); }
    .page-title { font-size: var(--text-xl); }
    .navbar-brand img { max-height: 28px; }
}
