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

:root {
    /* Color Palette - LIGHT THEME */
    --bg-primary: #f8fafc; /* Fondo gris muy claro para contraste */
    --bg-secondary: #ffffff; /* Blanco para tarjetas y sidebar */
    --bg-tertiary: #f1f5f9; /* Slate claro para secciones secundarias */
    
    --accent-primary: #991b1b; /* Dark Red (Varela Brand) */
    --accent-secondary: #7f1d1d;
    --accent-hover: #450a0a;
    
    --text-primary: #0f172a; /* Slate oscuro para texto principal */
    --text-secondary: #64748b; /* Gris slate para texto secundario */
    --text-muted: #94a3b8;
    
    --border-color: #e2e8f0;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.05);
    
    /* Status Colors */
    --status-pending: #d97706; /* Amber más oscuro para legibilidad en blanco */
    --status-active: #991b1b;
    --status-closed: #64748b;
    --status-urgent: #450a0a;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem 3rem;
    max-width: calc(100vw - 280px);
}

/* Typography Helpers */
.title-gradient {
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Sidebar Elements */
.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 3rem;
}

.main-logo {
    width: 100%;
    height: auto;
    max-height: 80px;
    object-fit: contain;
}

.login-img-logo {
    width: 100%;
    height: auto;
    max-height: 160px;
    object-fit: contain;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition-fast);
    cursor: pointer;
}

.nav-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-link.active {
    background: rgba(153, 27, 27, 0.08);
    color: var(--accent-primary);
}

.nav-link i {
    font-size: 1.25rem;
}

/* Cards */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--accent-primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Inputs */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.form-input {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    transition: var(--transition-fast);
    outline: none;
}

.form-input:focus {
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 3px rgba(153, 27, 27, 0.1);
}

/* Table */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

tr:hover td {
    background: var(--bg-tertiary);
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-pending { background: rgba(245, 158, 11, 0.1); color: var(--status-pending); }
.badge-active { background: rgba(220, 38, 38, 0.1); color: var(--status-active); }
.badge-closed { background: rgba(115, 115, 115, 0.1); color: var(--status-closed); }
.badge-urgent { background: rgba(153, 27, 27, 0.1); color: var(--status-urgent); }

/* Utility Classes */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.mt-4 { margin-top: 1rem; }
.mt-8 { margin-top: 2rem; }
.mb-10 { margin-bottom: 2.5rem !important; }

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade {
    animation: fadeIn 0.4s ease-out forwards;
}

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

.animate-spin {
    animation: spin 0.8s linear infinite;
}

.form-input-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 1px #ef4444;
}

/* Login Page Specific */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #ffffff 0%, #e2e8f0 100%);
    z-index: 1000;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    background: #ffffff !important;
    color: #0f172a !important;
    border: none;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.login-card h2, .login-card p, .login-card label, .login-card span {
    color: #0f172a !important;
}

.login-card .form-input {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border-color: #e2e8f0 !important;
}

.login-card .form-input:focus {
    border-color: var(--accent-primary) !important;
    background: #ffffff !important;
}

.login-logo {
    justify-content: center;
    margin-bottom: 1.5rem;
}

.error-container {
    background: rgba(153, 27, 27, 0.05);
    border: 1px solid rgba(153, 27, 27, 0.2);
    border-left: 4px solid var(--accent-primary);
    color: var(--accent-primary);
    padding: 0.875rem 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.error-container i {
    font-size: 1.1rem;
    flex-shrink: 0;
}


/* Transitions */
.view-transition-container {
    position: relative;
    width: 100%;
}

.hidden {
    display: none !important;
}

/* Autocomplete Component */
.autocomplete-wrapper {
    position: relative;
    width: 100%;
}
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-top: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
    z-index: 50;
    box-shadow: var(--shadow-lg);
}
.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: var(--transition-fast);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}
.autocomplete-item:last-child {
    border-bottom: none;
}
.autocomplete-item:hover, .autocomplete-item.active {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
}
.autocomplete-empty {
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Media Queries for Responsiveness */

/* Tablets and Mobiles */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
        position: fixed;
        left: 0;
        top: 0;
        z-index: 1000;
        box-shadow: var(--shadow-xl);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        max-width: 100vw;
        padding: 1.5rem;
    }
    .mobile-menu-btn {
        display: inline-flex !important;
    }
    
    /* Dashboard main layout grid: stack widgets */
    div[style*="grid-template-columns: 2fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}

/* Mobiles */
@media (max-width: 640px) {
    .main-content {
        padding: 1rem;
    }
    header.header-flex {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }
    header.header-flex > div:last-child {
        width: 100%;
        justify-content: space-between;
    }
    
    /* Login screen card padding */
    .login-card {
        padding: 1.5rem !important;
        margin: 1rem;
    }
    
    /* Form grids: stack columns */
    div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Flex wrappers in notice form */
    .flex.gap-8 {
        flex-direction: column !important;
    }
    
    /* Filters stack vertically */
    .flex.justify-between.items-center.mb-6 {
        flex-direction: column;
        align-items: stretch !important;
        gap: 1rem;
    }
    .flex.justify-between.items-center.mb-6 > .flex {
        flex-direction: column;
        width: 100%;
    }
    .flex.justify-between.items-center.mb-6 > .flex > div[style*="width: 300px"] {
        width: 100% !important;
    }
    .flex.justify-between.items-center.mb-6 > .flex > select {
        width: 100% !important;
    }
    .flex.justify-between.items-center.mb-6 > button {
        width: 100%;
    }
    
    /* Pagination responsiveness */
    .flex.justify-between.items-center.mt-6 {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    /* Modal Detail Card sizing */
    #detail-modal .card {
        padding: 1rem !important;
        max-height: 90vh !important;
    }
}

/* Toast Container */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

/* Toast Card */
.toast {
    pointer-events: auto;
    width: 350px;
    padding: 16px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    opacity: 0;
    backdrop-filter: blur(8px);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.hide {
    transform: translateX(120%);
    opacity: 0;
}

/* Toast Types styling */
.toast-success {
    border-left: 5px solid #10b981;
}
.toast-success i {
    color: #10b981;
}

.toast-error {
    border-left: 5px solid #991b1b;
}
.toast-error i {
    color: #ef4444;
}

.toast-info {
    border-left: 5px solid #3b82f6;
}
.toast-info i {
    color: #3b82f6;
}

.toast-content {
    flex-grow: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 2px;
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
}

.toast-message {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    margin-top: -2px;
}
.toast-close:hover {
    color: var(--text-primary);
}

/* Dialog Backdrop */
.dialog-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    padding: 1rem;
    box-sizing: border-box;
}

/* Dialog Card */
.dialog-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 420px;
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-sizing: border-box;
    animation: dialog-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes dialog-pop {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.dialog-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.dialog-icon-success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.dialog-icon-error {
    background: rgba(153, 27, 27, 0.1);
    color: #991b1b;
}

.dialog-icon-info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.dialog-icon-warning {
    background: rgba(217, 119, 6, 0.1);
    color: #d97706;
}

.dialog-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
}

.dialog-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1.75rem;
}

.dialog-buttons {
    display: flex;
    gap: 0.75rem;
    width: 100%;
    justify-content: center;
}

.dialog-btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-fast);
    border: none;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dialog-btn-primary {
    background: var(--accent-primary);
    color: #ffffff;
}
.dialog-btn-primary:hover {
    background: var(--accent-hover);
}

.dialog-btn-success {
    background: #10b981;
    color: #ffffff;
}
.dialog-btn-success:hover {
    background: #059669;
}

.dialog-btn-danger {
    background: #991b1b;
    color: #ffffff;
}
.dialog-btn-danger:hover {
    background: #7f1d1d;
}

.dialog-btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.dialog-btn-secondary:hover {
    background: var(--border-color);
}


