/**
 * ============================================================================
 * PAGE WRAPPER - STANDARDISED LAYOUT SYSTEM
 * ============================================================================
 *
 * File Path:        public/css/page-wrapper.css
 * Version:          1.0.0
 * Created:          Wednesday, February 12, 2026, 10:00 AM AEST
 * Last Modified:    Wednesday, February 12, 2026, 10:00 AM AEST
 *
 * Purpose:
 *   CSS for the PageWrapper layout system. Uses CSS custom properties
 *   (--page-max-width) to guarantee header, body, and footer alignment
 *   across all wrapped screens.
 *
 * Width Tiers:
 *   compact      900px   Menus, simple forms
 *   standard     1200px  Most screens (default)
 *   wide         1400px  Directories, data tables
 *   extra-wide   1600px  Asset register, complex views
 *   full         100%    Work orders, full-bleed screens
 *
 * Dependencies:
 *   - PageWrapper.js (generates the DOM structure)
 *   - standard-header.css (header base styles)
 *
 * ============================================================================
 */

/* ================================================================
   CSS CUSTOM PROPERTIES - Defaults
   ================================================================ */
.page-wrapper {
    --page-max-width: 1200px;
    --page-padding: 20px;
    --body-border-radius: 16px;
    --header-border-radius: 20px;

    min-height: 100vh;
    padding: var(--page-padding);
    box-sizing: border-box;
}

/* ================================================================
   WIDTH TIER SELECTORS
   ================================================================ */
.page-wrapper[data-width-tier="compact"]    { --page-max-width: 900px; }
.page-wrapper[data-width-tier="standard"]   { --page-max-width: 1200px; }
.page-wrapper[data-width-tier="wide"]       { --page-max-width: 1500px; }
.page-wrapper[data-width-tier="extra-wide"] { --page-max-width: 1600px; }
.page-wrapper[data-width-tier="full"]       { --page-max-width: 100%; }

/* ================================================================
   HEADER - Inherits max-width from wrapper
   ================================================================ */
.page-wrapper .standard-header {
    max-width: var(--page-max-width);
    margin: 0 auto 20px auto;
    border-radius: var(--header-border-radius);
}

/* ================================================================
   PAGE BODY - Content area with card styling
   ================================================================ */
.page-body {
    max-width: var(--page-max-width);
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--body-border-radius);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    padding: 24px;
    box-sizing: border-box;
}

/* Reset .screen positioning when inside page-wrapper — the wrapper handles layout */
.page-body > .screen {
    position: static;
    min-height: auto;
    padding: 0;
    opacity: 1;
    transform: none;
    transition: none;
    pointer-events: auto;
}

/* ================================================================
   STICKY TABLE HEADERS (global rules now in components.css)
   This class retained for backward compatibility — no longer required
   ================================================================ */

/* ================================================================
   PAGE FOOTER
   ================================================================ */
.page-footer {
    max-width: var(--page-max-width);
    margin: 24px auto 0 auto;
    text-align: center;
    padding: 16px 20px;
    font-size: 12px;
    color: #666;
}

.page-footer .footer-copyright {
    margin: 0 0 6px 0;
    font-weight: 600;
    letter-spacing: 0.3px;
    line-height: 1.4;
    font-size: 12px;
    color: #333;
}

.page-footer .footer-links {
    margin: 0;
    font-size: 11px;
    line-height: 1.6;
}

.page-footer .footer-link {
    color: #666;
    text-decoration: none;
    transition: color 0.2s ease;
    padding: 0 4px;
}

.page-footer .footer-link:hover {
    color: #007bff;
    text-decoration: underline;
}

.page-footer .footer-support {
    font-weight: 600;
    color: #007bff;
    cursor: pointer;
}

.page-footer .footer-support:hover {
    color: #0056b3;
}

.page-footer .footer-whoami {
    font-weight: 600;
    cursor: pointer;
}

.page-footer .footer-separator {
    margin: 0 6px;
    opacity: 0.4;
    font-weight: 300;
}

.page-footer .footer-icon {
    margin-right: 6px;
    font-size: 14px;
}

/* ================================================================
   FULL-WIDTH TIER OVERRIDES
   No card styling - transparent body, no shadow/border-radius
   ================================================================ */
.page-wrapper[data-width-tier="full"] .page-body {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
}

/* ================================================================
   OVERRIDE CopyrightFooter's !important padding for wrapped screens
   Wrapped screens use inline footer, not fixed footer
   ================================================================ */
.page-wrapper > .page-body {
    padding-bottom: 24px !important;
}

/* ================================================================
   RESPONSIVE BREAKPOINTS
   ================================================================ */
@media (max-width: 768px) {
    .page-wrapper {
        --page-padding: 12px;
        --body-border-radius: 12px;
        --header-border-radius: 12px;
    }

    .page-body {
        padding: 16px;
    }

    .page-footer {
        font-size: 10px;
        padding: 12px 15px;
    }

    .page-footer .footer-copyright {
        font-size: 10px;
    }

    .page-footer .footer-links {
        font-size: 9px;
    }

    .page-footer .footer-separator {
        margin: 0 4px;
    }
}

@media (max-width: 480px) {
    .page-wrapper {
        --page-padding: 8px;
    }

    .page-body {
        padding: 12px;
    }

    .page-footer {
        font-size: 9px;
        padding: 10px;
    }

    .page-footer .footer-copyright {
        font-size: 9px;
    }

    .page-footer .footer-links {
        font-size: 8px;
    }

    .page-footer .footer-link {
        padding: 0 2px;
    }

    .page-footer .footer-separator {
        margin: 0 3px;
    }
}

/* ================================================================
   PRINT STYLES
   ================================================================ */
@media print {
    .page-footer {
        display: none;
    }

    .page-wrapper {
        min-height: auto;
        padding: 0;
    }

    .page-body {
        box-shadow: none;
        padding: 0 !important;
    }
}

/* ================================================================
   DARK MODE
   ================================================================ */
@media (prefers-color-scheme: dark) {
    .page-footer .footer-copyright {
        color: #ccc;
    }

    .page-footer .footer-link {
        color: #999;
    }

    .page-footer .footer-link:hover {
        color: #4da6ff;
    }

    .page-footer .footer-support {
        color: #4da6ff;
    }

    .page-footer .footer-support:hover {
        color: #66b3ff;
    }
}
