@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    /* Brand DNA - Vinicius International Palette */
    --brand-blue: #2563EB;
    --brand-gold: #FFCC00;
    --brand-blue-vivid: #1D4ED8;
    --brand-orange: #FF9800;
    --accent-blue: #3B82F6;
    
    /* Legacy brand var redirection for compatibility */
    --brand-red: var(--brand-blue);
    
    /* Default: Dark/Void Theme (Legacy Kusmus) */
    --bg-deep: #020617;
    --bg-navy: #0F172A;
    --bg-panel: #0F172A;
    --bg-card: rgba(15, 23, 42, 0.85);
    --glass-bg: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.15);
    --text-primary: #FFFFFF;
    --text-secondary: #F0F9FF;
    --text-muted: #CBD5E1;
    --shadow-main: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    --input-bg: rgba(15, 23, 42, 0.5);
    --input-text: #FFFFFF;
    --scanline-opacity: 0.15;

    /* Shared Geometry */
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius-xs: 3px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 20px;
    --glass-blur: blur(12px);
    --font-main: 'Inter', system-ui, sans-serif;
}

[data-theme="light"] {
    /* viniciusint.com Official Branding */
    --bg-deep: #FFFFFF;
    --bg-navy: #FFFFFF;
    --bg-panel: #F8F9FA;
    --bg-card: #FFFFFF;
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.08);
    --text-primary: #000000;
    --text-secondary: #334155;
    --text-muted: #64748B;
    --brand-blue: #2563EB;
    --brand-gold: #FFCC00;
    --brand-red: var(--brand-blue);
    --shadow-main: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --input-bg: #F8F9FA;
    --input-text: #000000;
    --scanline-opacity: 0.002; /* Minimal industrial texture */
}

/* Fluent theme text overrides: force inline white styles to adapt in light mode */
[data-theme="light"] [style*="color: white"],
[data-theme="light"] [style*="color:white"],
[data-theme="light"] [style*="color: #fff"],
[data-theme="light"] [style*="color:#fff"],
[data-theme="light"] [style*="color: #ffffff"],
[data-theme="light"] [style*="color:#ffffff"] {
    color: var(--text-primary) !important;
}

/* --- Global Typography --- */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=Inter:wght@400;500;600;800&display=swap');

h1, h2, h3, .serif-brand {
    font-family: 'Playfair Display', serif;
    letter-spacing: -0.02em;
}

body {
    font-family: 'Inter', sans-serif;
}

/* --- Scanline Terminal Effect --- */
body::before {
    content: " ";
    display: block;
    position: fixed;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.02), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.02));
    z-index: 9999;
    background-size: 100% 4px, 3px 100%;
    pointer-events: none;
    opacity: var(--scanline-opacity);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

body {
    background-color: var(--bg-deep);
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(227, 30, 36, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(59, 130, 246, 0.03) 0%, transparent 40%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.5;
    font-size: 14px; /* Base font size for better scaling */
}

/* --- Layout Architecture --- */
.app-shell {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-panel);
    backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--glass-border);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.main-container {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    width: calc(100% - var(--sidebar-width));
    transition: margin-left 0.4s ease;
    min-height: 100vh;
}

.top-bar {
    height: 56px;
    background: var(--bg-panel);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--glass-border);
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 900;
}

.content-body {
    padding: clamp(1rem, 5vw, 3rem) clamp(1rem, 4vw, 2.5rem);
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    min-height: calc(100vh - var(--header-height));
}

/* --- Typography System --- */
h1 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 800;
    letter-spacing: var(--tracking-tight);
    color: var(--text-primary);
}
h2 {
    font-size: clamp(1.5rem, 3.5vw, 2rem);
    font-weight: 800;
    letter-spacing: var(--tracking-tight);
    color: var(--text-primary);
}
h3 {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 700;
    letter-spacing: var(--tracking-tight);
    color: var(--text-primary);
}
h4 {
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    font-weight: 700;
    letter-spacing: var(--tracking-tight);
    color: var(--text-primary);
}
.heading-modern {
    font-weight: 800;
    letter-spacing: var(--tracking-tight);
    color: white;
}

/* --- Responsive & Navigation Hooks --- */
.nav-link {
    display: flex;
    align-items: center;
    padding: clamp(0.5rem, 1.5vw, 0.75rem) clamp(0.75rem, 2vw, 1rem);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: clamp(0.75rem, 1.8vw, 0.85rem);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--radius-sm);
    margin-bottom: clamp(0.2rem, 0.5vw, 0.25rem);
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.text-gradient {
    background: linear-gradient(135deg, #FFFFFF 0%, #CBD5E1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- Responsive & Navigation Hooks --- */
.nav-link {
    display: flex;
    align-items: center;
    padding: 0.65rem 1rem; /* Compact Navigation */
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.8rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--radius-sm);
    margin-bottom: 0.25rem;
    letter-spacing: 0.01em;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    transform: translateX(4px);
}

.nav-link.active {
    background: rgba(227, 30, 36, 0.1);
    color: var(--brand-red);
    border: 1px solid rgba(227, 30, 36, 0.2);
}

/* --- Components --- */
.card, .glass-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.25rem; /* Reduced Default Padding */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-main);
}

.card:hover, .glass-card:hover {
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-4px);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.4);
}

.btn-modern {
    padding: 0.6rem 1.4rem; /* Reduced Button Size */
    border-radius: var(--radius-xs);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--brand-blue);
    color: white;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    background: var(--brand-gold);
    color: black;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 204, 0, 0.4);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--brand-red);
    transform: translateY(-2px);
}

.modern-input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xs);
    padding: 0.6rem 0.9rem;
    color: var(--input-text);
    font-size: 0.85rem;
    outline: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-input:focus {
    border-color: var(--brand-red);
    background: var(--input-bg);
    box-shadow: 0 0 0 3px rgba(227, 30, 36, 0.15);
}

.modern-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

/* --- Reveal Animations --- */
.reveal-text {
    opacity: 0;
    transform: translateY(20px);
    animation: revealFade 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.reveal-delay-1 { animation-delay: 0.1s; }
.reveal-delay-2 { animation-delay: 0.2s; }
.reveal-delay-3 { animation-delay: 0.3s; }
.reveal-delay-4 { animation-delay: 0.4s; }

@keyframes revealFade {
    to { opacity: 1; transform: translateY(0); }
}

.pulse-red {
    animation: pulseRed 2s infinite;
}

@keyframes pulseRed {
    0% { box-shadow: 0 0 0 0 rgba(227, 30, 36, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(227, 30, 36, 0); }
    100% { box-shadow: 0 0 0 0 rgba(227, 30, 36, 0); }
}

.status-pill {
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.65rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* --- Kanban Architecture --- */
.kanban-board {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding-bottom: 2rem;
    min-height: calc(100vh - 280px);
    align-items: flex-start;
}

.kanban-col {
    flex: 0 0 320px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    max-height: 100vh;
}

.kanban-col-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.kanban-cards {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    min-height: 200px;
}

.kanban-card {
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    cursor: grab;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.kanban-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--brand-red);
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

/* --- Mobile Logic --- */
.mobile-toggle {
    display: none;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}


/* --- Mobile Logic & Responsive Layout --- */
@media (max-width: 1024px) {
    .mobile-toggle {
        display: flex !important;
    }
    
    .sidebar {
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    
    .sidebar.active {
        transform: translateX(0) !important;
    }
    
    .main-container {
        margin-left: 0 !important;
        width: 100% !important;
    }
}
.modern-input[type='file'] {
    padding: 0.4rem;
    font-size: 0.65rem;
    cursor: pointer;
}

/* --- Global Print Orchestration --- */
@media print {
    body {
        background: white !important;
        color: black !important;
    }

    .sidebar, 
    .top-bar, 
    .no-print,
    .mobile-toggle,
    header,
    aside {
        display: none !important;
    }

    .main-container {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .content-body {
        padding: 0 !important;
        margin: 0 !important;
    }

    .glass-card {
        background: white !important;
        border: 1px solid #eee !important;
        box-shadow: none !important;
        color: black !important;
    }

    .reveal-text {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* --- Mobile Responsive Grid Utilities & Optimizations --- */
.grid-responsive-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.grid-responsive-2 {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

@media (max-width: 1024px) {
    .grid-responsive-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    .grid-responsive-2 {
        grid-template-columns: 1fr;
    }
    .grid-responsive-2 > div,
    .grid-responsive-2 > form {
        grid-column: span 1 !important;
    }
}

@media (max-width: 640px) {
    .grid-responsive-4 {
        grid-template-columns: 1fr;
    }
    
    /* Mobile-first margins and alignments */
    .top-bar {
        padding: 0.5rem 0.75rem !important;
    }
    .top-bar button span {
        display: none !important; /* Hide button text, keep only icon for space */
    }
    .top-bar button {
        padding: 0.4rem !important;
        border-radius: 50% !important;
        width: 32px !important;
        height: 32px !important;
        justify-content: center !important;
        gap: 0 !important;
    }
    /* Exclude logout button from icon-only circular style */
    .top-bar button[onclick^="logout"] {
        width: auto !important;
        height: auto !important;
        border-radius: 4px !important;
        padding: 0.4rem 0.75rem !important;
    }
    
    .top-bar-inner {
        gap: 0.5rem !important;
    }
    .top-bar-left {
        gap: 0.5rem !important;
    }
    .top-bar-right {
        gap: 0.5rem !important;
    }
    .user-info-responsive {
        display: none !important;
    }
    .content-body {
        padding: 1.25rem 0.75rem !important;
    }
    
    /* Project switcher styling for mobile */
    .project-switcher {
        gap: 0.5rem !important;
    }
    .project-switcher span {
        display: none !important;
    }
    #globalProjectSwitcher {
        min-width: 120px !important;
        max-width: 150px !important;
        font-size: 0.7rem !important;
        padding: 0.3rem 1.5rem 0.3rem 0.5rem !important;
    }
    
    /* Active projects responsive layout */
    #projectsList {
        gap: 1.25rem !important;
    }
    .projects-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem !important;
    }
    
    /* Promote personnel matrix stacking */
    .user-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1.25rem !important;
        padding: 1.25rem !important;
    }
    .user-row-meta {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1.25rem !important;
        width: 100% !important;
    }
    .authority-select-container {
        text-align: left !important;
        width: 100% !important;
    }
    .authority-select-container select {
        width: 100% !important;
    }
    .user-row-actions {
        width: 100% !important;
        gap: 0.5rem !important;
    }
    .user-row-actions button {
        width: 100% !important;
        padding: 0.6rem 1rem !important;
        font-size: 0.65rem !important;
    }
    .quick-actions-container {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }
    .quick-actions-container button {
        width: 100% !important;
        padding: 0.85rem 1.5rem !important;
    }
    
    /* Responsive typography scaling */
    h1 { font-size: 1.6rem !important; }
    h2 { font-size: 1.4rem !important; }
    h3 { font-size: 1.2rem !important; }
}

/* --- Global Word-Boundary Text Wrapping --- */
p, span, h1, h2, h3, h4, h5, h6, a, .card, .glass-card, td, th, li {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: normal;
}

/* --- Extra Mobile Grid Stack Overrides --- */
@media (max-width: 768px) {
    /* Stack form rows that have side-by-side elements */
    .grid-responsive-md-stack {
        grid-template-columns: 1fr !important;
    }
}

/* --- Site Update Detail Grid Responsiveness --- */
.site-update-detail-grid.has-photo {
    grid-template-columns: 1fr 240px;
}
.site-update-detail-grid:not(.has-photo) {
    grid-template-columns: 1fr;
}
@media (max-width: 768px) {
    .site-update-detail-grid.has-photo,
    .site-update-detail-grid:not(.has-photo) {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
}

/* --- Force child spans to 1 column on mobile --- */
@media (max-width: 640px) {
    .grid-responsive-4 > div,
    .grid-responsive-4 > form,
    .grid-responsive-2 > div,
    .grid-responsive-2 > form {
        grid-column: span 1 !important;
    }
}

/* --- Kanban HUD Responsiveness --- */
@media (max-width: 1024px) {
    #kanbanHUD {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}
@media (max-width: 640px) {
    #kanbanHUD {
        grid-template-columns: 1fr !important;
    }
}




