/* ============================================================================
   NELLIE'S UNIFIED CSS SYSTEM - master.css
   Single source of truth for all styling across the system
   Replace ALL existing CSS files with this one file
   ============================================================================ */

/* === CSS CUSTOM PROPERTIES (DESIGN TOKENS) === */
:root {
    /* Brand Colors */
    --brand-primary: #2563eb;
    --brand-secondary: #9333ea;
    
    /* Color Palette */
    --blue-50: #eff6ff;
    --blue-100: #dbeafe;
    --blue-500: #3b82f6;
    --blue-600: #2563eb;
    --blue-700: #1d4ed8;
    
    --purple-500: #a855f7;
    --purple-600: #9333ea;
    --purple-700: #7c3aed;
    
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    --green-50: #ecfdf5;
    --green-100: #d1fae5;
    --green-500: #10b981;
    --green-600: #059669;
    --green-700: #047857;
    
    --yellow-50: #fffbeb;
    --yellow-100: #fef3c7;
    --yellow-500: #f59e0b;
    --yellow-600: #d97706;
    
    --red-50: #fef2f2;
    --red-100: #fee2e2;
    --red-500: #ef4444;
    --red-600: #dc2626;
    --red-700: #b91c1c;
    
    /* Typography */
    --font-sans: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.125rem;
    --radius-base: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-base: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --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);
    
    /* Transitions */
    --transition: 200ms ease;
}

/* === GLOBAL RESET === */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: var(--gray-50);
    color: var(--gray-800);
    -webkit-font-smoothing: antialiased;
}

/* === LAYOUT COMPONENTS === */

/* Page Container */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-8);
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-base);
}

/* Page Header */
.page-header {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    color: white;
    padding: var(--space-8);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-8);
    box-shadow: var(--shadow-md);
}

.page-header h1 {
    margin: 0 0 var(--space-2) 0;
    font-size: var(--font-size-3xl);
    font-weight: 700;
}

.page-header p {
    margin: 0;
    opacity: 0.9;
    font-size: var(--font-size-lg);
}

/* Card Component */
.card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--gray-200);
}

.card-title {
    margin: 0;
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--gray-900);
}

/* === NAVIGATION === */
.nav {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: var(--space-4);
    margin-bottom: var(--space-8);
    box-shadow: var(--shadow-sm);
}

.nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: var(--space-6);
    align-items: center;
}

.nav ul li a {
    color: var(--gray-700);
    text-decoration: none;
    font-weight: 500;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    transition: all var(--transition);
}

.nav ul li a:hover {
    background: var(--blue-50);
    color: var(--blue-700);
    transform: translateY(-1px);
}

.nav ul li a.active {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

/* === BUTTON SYSTEM === the ONE button set is in assets/css/house.css (R270, 2026-10-05); its old copy here is gone. */

/* === FORM SYSTEM === */
.form {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 500;
    color: var(--gray-700);
    font-size: var(--font-size-sm);
}

.form-input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
textarea,
select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    transition: all var(--transition);
    background: white;
    font-family: inherit;
}

.form-input:focus,
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input:hover,
input:hover,
textarea:hover,
select:hover {
    border-color: var(--gray-400);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* Fieldsets */
fieldset {
    border: 1px solid var(--gray-200);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    border-radius: var(--radius-lg);
    background: var(--gray-50);
    transition: all var(--transition);
}

fieldset:focus-within {
    border-color: var(--blue-300);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

legend {
    font-weight: 600;
    padding: 0 var(--space-3);
    color: var(--gray-700);
    background: white;
    border-radius: var(--radius-base);
}

/* === ALERT SYSTEM === */
.alert {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
    border-left: 4px solid;
    font-size: var(--font-size-sm);
    animation: slideInDown 0.3s ease;
}

.alert-success {
    background: var(--green-50);
    border-color: var(--green-500);
    color: var(--green-700);
}

.alert-warning {
    background: var(--yellow-50);
    border-color: var(--yellow-500);
    color: var(--yellow-600);
}

.alert-error {
    background: var(--red-50);
    border-color: var(--red-500);
    color: var(--red-700);
}

.alert-info {
    background: var(--blue-50);
    border-color: var(--blue-500);
    color: var(--blue-700);
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === TABLE SYSTEM === the ONE table is in assets/css/house.css (R271, 2026-10-05); its old copy here is gone. */

/* === BADGE SYSTEM === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-base);
    font-size: var(--font-size-xs);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-success {
    background: var(--green-100);
    color: var(--green-700);
}

.badge-warning {
    background: var(--yellow-100);
    color: var(--yellow-600);
}

.badge-error {
    background: var(--red-100);
    color: var(--red-600);
}

.badge-info {
    background: var(--blue-100);
    color: var(--blue-700);
}

/* === MODAL SYSTEM === */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
}

.modal-backdrop.show .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    padding: var(--space-6) var(--space-6) 0 var(--space-6);
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: var(--space-6);
}

.modal-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--gray-900);
    margin: 0 0 var(--space-2) 0;
}

.modal-body {
    padding: 0 var(--space-6) var(--space-6) var(--space-6);
}

.modal-footer {
    padding: var(--space-6);
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* === DASHBOARD TILES === */
.dashboard-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    text-align: center;
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--gray-800);
    aspect-ratio: 1 / 1;
    cursor: pointer;
}

.dashboard-tile:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

.dashboard-tile.priority-red {
    background: linear-gradient(135deg, var(--red-100) 0%, var(--red-50) 100%);
    border-color: var(--red-300);
}

.dashboard-tile.priority-yellow {
    background: linear-gradient(135deg, var(--yellow-100) 0%, var(--yellow-50) 100%);
    border-color: var(--yellow-300);
}

.dashboard-tile.priority-green {
    background: linear-gradient(135deg, var(--green-500) 0%, var(--green-400) 100%);
    border-color: var(--green-600);
    color: white;
}

.dashboard-tile.priority-blue {
    background: linear-gradient(135deg, var(--blue-100) 0%, var(--blue-50) 100%);
    border-color: var(--blue-300);
}

/* === GRID SYSTEM === */
.grid {
    display: grid;
    gap: var(--space-6);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.grid-auto {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* === UTILITY CLASSES === */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-sm { font-size: var(--font-size-sm); }
.text-lg { font-size: var(--font-size-lg); }
.mb-4 { margin-bottom: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.p-4 { padding: var(--space-4); }

/* === RESPONSIVE DESIGN === */
@media (max-width: 768px) {
    .page-container {
        padding: var(--space-4);
    }
    
    .page-header {
        padding: var(--space-6);
    }
    
    .page-header h1 {
        font-size: var(--font-size-2xl);
    }
    
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .nav ul {
        flex-direction: column;
        gap: var(--space-2);
    }
}

/* === SPECIAL COMPONENTS === */

/* Login Container */
.login-container {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 3rem;
    width: 100%;
    max-width: 420px;
    margin: 1rem;
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
}

/* Password Toggle */
.password-container {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--gray-500);
    transition: color var(--transition);
    user-select: none;
}

.password-toggle:hover {
    color: var(--gray-700);
}

/* Footer */
.footer {
    text-align: center;
    margin-top: var(--space-12);
    padding: var(--space-8) 0;
    color: var(--gray-500);
    font-size: var(--font-size-sm);
    border-top: 1px solid var(--gray-200);
}

/* === PRINT STYLES === */
@media print {
    .no-print,
    .nav,
    .btn {
        display: none !important;
    }
    
    .page-container {
        box-shadow: none;
        border: none;
    }
    
    .page-header {
        background: none !important;
        color: black !important;
    }
}