/* VPS Admin Panel - Modern Styles */

/* KBH Fonts */
@font-face { font-family: 'KBH'; src: url('../fonts/OTF/KBH-Regular.otf') format('opentype'); font-weight: 400; font-style: normal; }
@font-face { font-family: 'KBH'; src: url('../fonts/OTF/KBH-Italic.otf') format('opentype'); font-weight: 400; font-style: italic; }
@font-face { font-family: 'KBH'; src: url('../fonts/OTF/KBH-Medium.otf') format('opentype'); font-weight: 500; font-style: normal; }
@font-face { font-family: 'KBH'; src: url('../fonts/OTF/KBH-Bold.otf') format('opentype'); font-weight: 700; font-style: normal; }
@font-face { font-family: 'KBH'; src: url('../fonts/OTF/KBH-Light.otf') format('opentype'); font-weight: 300; font-style: normal; }

:root {
    /* Color Palette — darkened to clear WCAG 1.4.6 Contrast (Enhanced, AAA 7:1)
       per QualWeb QW-ACT-R76. Each value is ≥7:1 on white (#fff) so both text
       uses (color on white) and button uses (white text on the color) pass AAA.
       --warning-color stays amber (decorative borders/icons); any warning TEXT
       is darkened per-instance instead. */
    --primary-color: #1e3a8a;      /* was #2563eb → #1e40af → #1e3a8a; 8.4:1 on body bg #f3f4f6 (AAA) */
    --primary-hover: #172554;      /* darker than --primary-color for hover bg (white text 13.5:1) */
    --secondary-color: #334155;    /* was #64748b (4.71:1) → 10.0:1 */
    --success-color: #064e3b;      /* was #047857 (5.41:1) → 9.64:1 */
    --danger-color: #991b1b;       /* was #b91c1c (6.54:1) → 8.29:1 */
    --warning-color: #f59e0b;      /* amber — decorative; text uses per-instance darkening */
    --info-color: #1e3a8a;         /* was #3b82f6 → #1e3a8a; 8.4:1 on #f3f4f6 (AAA) */
    
    /* Backgrounds */
    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    --bg-header: #1f2937;
    
    /* Text */
    --text-main: #111827;
    --text-muted: #3b4254;   /* was #6b7280 → #4b5563 (7.31:1 on white) → #3b4254
                                (8.22:1 on body bg #f3f4f6, 10:1 on white) — AAA on both */
    --text-light: #f9fafb;
    
    /* Borders & Shadows */
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Spacing */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --admin-header-sticky-offset: 4.25rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'KBH', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

body.page-with-footer {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

button, input, select, textarea {
    font-family: inherit;
}

/* Visible keyboard focus (WCAG 2.4.7) — :focus-visible so mouse clicks don't ring */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Native dropdowns, checkboxes and radios always get a real outline on keyboard
   focus. Several feature rules replace the outline with a box-shadow ring
   (outline: none) - WebKit/Safari does not draw box-shadow on native-appearance
   controls, so there these had no visible focus at all (WCAG 2.4.7, found in the
   WebKit run of the 29 Sep report). !important so no feature rule can remove it. */
select:focus-visible,
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
    outline: 2px solid var(--primary-color) !important;
    outline-offset: 2px;
}

/* Skip link (WCAG 2.4.1) — visually hidden until focused */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 1000;
    padding: 0.5rem 1rem;
    background: #fff;
    color: #111827;
    border-radius: 0 0 4px 4px;
    font-weight: 600;
}
.skip-link:focus,
.skip-link:focus-visible {
    left: 0;
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Visually hidden but available to assistive tech (WCAG 1.3.1 — table captions,
   labels, etc.) — clipped, not display:none, so AT can read it. */
.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Header */
.header {
    background-color: var(--bg-header);
    color: var(--text-light);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.guide-title-link {
    font-size: 0.8rem;
    font-weight: 500;
    color: #93c5fd;
    text-decoration: none;
    padding: 0.25rem 0.6rem;
    border: 1px solid rgba(96, 165, 250, 0.4);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    letter-spacing: 0;
    white-space: nowrap;
}

.guide-title-link:hover {
    background-color: rgba(96, 165, 250, 0.15);
    border-color: rgba(96, 165, 250, 0.6);
    color: #93c5fd;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
}

.nav-links a {
    color: #d1d5db;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-links a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

/* Above the phone menu (768 px) an admin's nine links need about 1140 px beside the title.
   From 769 to 1199 px the header tightens a little, so the row fits from 1024 px up; below
   that the links wrap onto a second row, flush right, instead of pushing the page sideways.
   Only the admin menu (nav_admin.html); the /user pages have their own header rules.
   Sticky things under the header (layout panel, Vagtplan week header) move down by that row. */
@media (min-width: 769px) {
    .header:has(#adminNavLinks) h1 { flex-shrink: 0; }
    #adminNavLinks { flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
}
@media (min-width: 769px) and (max-width: 1199px) {
    .header:has(#adminNavLinks) { padding: 1rem 1.5rem; }
    #adminNavLinks { gap: 0.25rem; }
    #adminNavLinks a { padding: 0.5rem; }
}
@media (min-width: 769px) and (max-width: 1023px) {
    :root { --admin-header-sticky-offset: 7.125rem; }
}

/* Main Container */
.container {
    width: 100%;
    max-width: 95%; /* Restored for wide layouts (Calendar, Layout Editor) */
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Buttons */
.btn {
    display: inline-block;
    text-align: center;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background-color: white;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.5;
    vertical-align: middle;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    background-color: var(--bg-body);
    border-color: #d1d5db;
}

.btn.primary {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn.primary:hover {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-hover);
}

/* Button color variants — used across the application with hyphenated class names */
.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
.btn-primary:hover:not(:disabled) { background-color: var(--primary-hover); box-shadow: var(--shadow-md); border-color: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}
.btn-secondary:hover { background-color: #4f5a67; }

.btn-success {
    background-color: var(--success-color);
    color: white;
    border-color: var(--success-color);
}
.btn-success:hover { background-color: #065f46; }  /* white 7.7:1; #0ea472 was 3.2:1 */

.btn-warning {
    background-color: var(--warning-color);
    color: #212529;
    border-color: var(--warning-color);
}
.btn-warning:hover { background-color: #e08e00; }

.btn-danger {
    background-color: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}
.btn-danger:hover { background-color: #dc2626; }

.btn-small, .btn-sm {
    padding: 6px 12px;
    font-size: 0.85em;
    min-width: 70px;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 0.75em;
    min-width: auto;
}

/* Loading State for Buttons */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 1em;
    height: 1em;
    top: 50%;
    left: 50%;
    margin-top: -0.5em;
    margin-left: -0.5em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.75s linear infinite;
    color: white; /* Default spinner color */
}

@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
    overflow-x: auto;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}


/* Utility */
.hidden { display: none !important; }

/* Responsive */
@media (max-width: 768px) {
    :root {
        --admin-header-sticky-offset: 7.25rem;
    }

    .header {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .container {
        padding: 1rem;
    }
    
}

/* Footer */
.footer {
    background-color: var(--bg-header);
    color: var(--text-light);
    padding: 2rem 0;
    margin-top: auto; /* Pushes footer to bottom */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-content {
    width: 100%;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.footer-logo {
    height: 45px;
    width: auto;
}

.footer-text {
    display: flex;
    flex-direction: column;
}

.footer-left p {
    margin: 0;
    font-weight: 500;
    color: #f3f4f6;
}

.footer-sub {
    font-size: 0.8rem;
    color: #d1d5db !important;
    margin-top: 0.25rem !important;
}

.footer-right {
    display: flex;
    gap: 2rem;
}

.support-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.support-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #d1d5db;
    font-weight: 600;
}

.footer a {
    color: white;
    text-decoration: none;
    transition: color 0.2s;
    font-weight: 500;
    font-size: 0.95rem;
}

.footer a:hover {
    color: #60a5fa; /* Light blue on hover */
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1.5rem;
    }
    
    .footer-right {
        flex-direction: column;
        gap: 1.5rem;
        align-items: center;
    }
}
