/* ==========================================================================
   TrustVault Pro - Custom Styles
   All sizing in REM. No px values.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Root / CSS Variables
   -------------------------------------------------------------------------- */
:root {
    --sidebar-width: 16rem;
    --sidebar-collapsed-width: 4rem;
    --navbar-height: 4rem;
    --modal-max-height: 85vh;
    --transition-speed: 0.2s;
    --border-radius: 0.5rem;
}

/* --------------------------------------------------------------------------
   2. Base / Reset Overrides
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
}

/* --------------------------------------------------------------------------
   3. Scrollbar Theme
   -------------------------------------------------------------------------- */

/* Dark mode scrollbar */
.dark ::-webkit-scrollbar {
    width: 0.5rem;
    height: 0.5rem;
}

.dark ::-webkit-scrollbar-track {
    background: rgb(17, 24, 39);
    border-radius: 0.25rem;
}

.dark ::-webkit-scrollbar-thumb {
    background: rgb(75, 85, 99);
    border-radius: 0.25rem;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: rgb(107, 114, 128);
}

/* Light mode scrollbar */
.light ::-webkit-scrollbar {
    width: 0.5rem;
    height: 0.5rem;
}

.light ::-webkit-scrollbar-track {
    background: rgb(243, 244, 246);
    border-radius: 0.25rem;
}

.light ::-webkit-scrollbar-thumb {
    background: rgb(209, 213, 219);
    border-radius: 0.25rem;
}

.light ::-webkit-scrollbar-thumb:hover {
    background: rgb(156, 163, 175);
}

/* Firefox scrollbar */
.dark * {
    scrollbar-width: thin;
    scrollbar-color: rgb(75, 85, 99) rgb(17, 24, 39);
}

.light * {
    scrollbar-width: thin;
    scrollbar-color: rgb(209, 213, 219) rgb(243, 244, 246);
}

/* --------------------------------------------------------------------------
   4. Sidebar Styles
   -------------------------------------------------------------------------- */
#sidebar {
    transition: width var(--transition-speed) ease-in-out;
    overflow-x: hidden;
    overflow-y: auto;
}

#sidebar.sidebar-collapsed {
    width: var(--sidebar-collapsed-width);
}

/* Mobile sidebar */
@media (max-width: 48rem) {
    #sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 40;
        transform: translateX(-100%);
        transition: transform var(--transition-speed) ease-in-out;
    }

    #sidebar.sidebar-mobile-open {
        transform: translateX(0);
    }

    #sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 30;
        background: rgba(0, 0, 0, 0.5);
    }
}

/* --------------------------------------------------------------------------
   5. Light Mode Overrides
   -------------------------------------------------------------------------- */
.light body,
.light .bg-gray-900 {
    background-color: white;
    color: rgb(17, 24, 39);
}

.light .bg-gray-800 {
    background-color: rgb(249, 250, 251);
}

.light .bg-gray-700 {
    background-color: rgb(243, 244, 246);
}

.light .bg-gray-750 {
    background-color: rgb(243, 244, 246);
}

.light .text-gray-100 {
    color: rgb(17, 24, 39);
}

.light .text-gray-200 {
    color: rgb(31, 41, 55);
}

.light .text-gray-300 {
    color: rgb(55, 65, 81);
}

.light .text-gray-400 {
    color: rgb(107, 114, 128);
}

.light .border-gray-700 {
    border-color: rgb(229, 231, 235);
}

.light .border-gray-600 {
    border-color: rgb(209, 213, 219);
}

.light input.bg-gray-700,
.light select.bg-gray-700,
.light textarea.bg-gray-700 {
    background-color: white;
    border-color: rgb(209, 213, 219);
    color: rgb(17, 24, 39);
}

.light input.bg-gray-700::placeholder,
.light select.bg-gray-700::placeholder,
.light textarea.bg-gray-700::placeholder {
    color: rgb(156, 163, 175);
}

/* --------------------------------------------------------------------------
   6. Modal Overrides
   -------------------------------------------------------------------------- */
.modal-body {
    max-height: calc(var(--modal-max-height) - 8rem);
    overflow-y: auto;
}

/* --------------------------------------------------------------------------
   7. Table Styles
   -------------------------------------------------------------------------- */
.bg-gray-750 {
    background-color: rgb(37, 42, 52);
}

.light .bg-gray-750 {
    background-color: rgb(249, 250, 251);
}

/* --------------------------------------------------------------------------
   8. Focus Styles
   -------------------------------------------------------------------------- */
:focus-visible {
    outline: 0.125rem solid rgb(59, 130, 246);
    outline-offset: 0.125rem;
    border-radius: 0.125rem;
}

/* --------------------------------------------------------------------------
   9. Skeleton Loading
   -------------------------------------------------------------------------- */
.skeleton {
    background: linear-gradient(
        90deg,
        rgb(55, 65, 81) 0%,
        rgb(75, 85, 99) 50%,
        rgb(55, 65, 81) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--border-radius);
}

.light .skeleton {
    background: linear-gradient(
        90deg,
        rgb(229, 231, 235) 0%,
        rgb(243, 244, 246) 50%,
        rgb(229, 231, 235) 100%
    );
    background-size: 200% 100%;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --------------------------------------------------------------------------
   10. Tab Styles
   -------------------------------------------------------------------------- */
.tab-active {
    border-bottom-width: 0.125rem;
    border-bottom-color: rgb(59, 130, 246);
    color: rgb(59, 130, 246);
    font-weight: 600;
}

.light .tab-active {
    color: rgb(37, 99, 235);
    border-bottom-color: rgb(37, 99, 235);
}

/* --------------------------------------------------------------------------
   11. Card Hover Effects
   -------------------------------------------------------------------------- */
.card-hover {
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.card-hover:hover {
    transform: translateY(-0.125rem);
    box-shadow: 0 0.625rem 0.9375rem -0.1875rem rgba(0, 0, 0, 0.3);
}

.light .card-hover:hover {
    box-shadow: 0 0.625rem 0.9375rem -0.1875rem rgba(0, 0, 0, 0.1);
}

/* --------------------------------------------------------------------------
   12. Wizard / Step Indicator
   -------------------------------------------------------------------------- */
.step-indicator {
    position: relative;
}

.step-indicator::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 100%;
    width: 4rem;
    height: 0.125rem;
    background-color: rgb(75, 85, 99);
    transform: translateY(-50%);
}

.step-indicator:last-child::after {
    display: none;
}

.step-indicator.step-active::after {
    background-color: rgb(59, 130, 246);
}

.step-indicator.step-complete::after {
    background-color: rgb(34, 197, 94);
}

/* --------------------------------------------------------------------------
   13. Print Styles
   -------------------------------------------------------------------------- */
@media print {
    #sidebar,
    header,
    footer,
    #toast-container,
    #gdpr-consent-banner,
    [data-no-print],
    .no-print {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
        font-size: 0.75rem;
    }

    main {
        padding: 0 !important;
    }

    .bg-gray-800,
    .bg-gray-900 {
        background: white !important;
    }

    .text-gray-100,
    .text-gray-200,
    .text-gray-300 {
        color: black !important;
    }

    .text-gray-400,
    .text-gray-500 {
        color: rgb(107, 114, 128) !important;
    }

    .shadow-lg,
    .shadow-xl,
    .shadow-2xl {
        box-shadow: none !important;
    }

    .border-gray-700 {
        border-color: rgb(209, 213, 219) !important;
    }

    a[href]::after {
        content: ' (' attr(href) ')';
        font-size: 0.625rem;
        color: rgb(107, 114, 128);
    }

    table {
        border-collapse: collapse;
    }

    th, td {
        border: 0.0625rem solid rgb(209, 213, 219);
        padding: 0.25rem 0.5rem;
    }

    @page {
        margin: 1.5rem;
    }
}

/* --------------------------------------------------------------------------
   14. Utility Classes
   -------------------------------------------------------------------------- */
.truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Backdrop blur fallback */
@supports not (backdrop-filter: blur(0.25rem)) {
    .backdrop-blur-sm {
        background-color: rgba(0, 0, 0, 0.7);
    }
}

/* Smooth transitions for theme switching */
body,
#sidebar,
header,
footer,
main,
.bg-gray-800,
.bg-gray-900,
.bg-gray-700 {
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}
