/* ============================================
   SGTI - Tema Principal Navy Corporativo
   ============================================ */

:root {
    /* Navy palette */
    --navy-900: #0A1628;
    --navy-800: #0F1F3A;
    --navy-700: #14284D;
    --navy-600: #1B2A4A;
    --navy-500: #1E3A5F;
    --accent-blue: #2E86AB;
    --accent-light: #4DA8C8;
    --highlight-amber: #F4A261;
    --success-teal: #2EC4B6;
    --danger-red: #E63946;
    --warning-orange: #E76F51;
    --bg-gray: #F0F4F8;
    --bg-white: #FFFFFF;
    --text-primary: #1A2332;
    --text-secondary: #5A6B7F;
    --text-muted: #8FA0B5;
    --border-color: #E2E8F0;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(10, 22, 40, 0.08);
    --shadow-md: 0 4px 12px rgba(10, 22, 40, 0.1);
    --shadow-lg: 0 8px 24px rgba(10, 22, 40, 0.12);
    --shadow-xl: 0 12px 36px rgba(10, 22, 40, 0.15);
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Border radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #F0F4F8 0%, #E8EDF3 100%);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ========== TOP BAR ========== */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--navy-900);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.menu-toggle:hover {
    background: var(--bg-gray);
}

.topbar-breadcrumb {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--navy-900);
}

.topbar-breadcrumb span {
    color: var(--text-secondary);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--navy-600);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    position: relative;
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--bg-gray);
    color: var(--navy-900);
}

.dot-alert {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 10px;
    height: 10px;
    background: var(--danger-red);
    border-radius: 50%;
    border: 2px solid var(--bg-white);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

/* ========== MAIN CONTENT AREA ========== */
.main-content {
    flex: 1;
    margin-left: 250px;
    min-height: 100vh;
    transition: var(--transition);
}

.content-area {
    padding: 24px 32px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== CARDS ========== */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    overflow: hidden;
}

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

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--navy-900);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header h3 i {
    color: var(--accent-blue);
    font-size: 1rem;
}

.card-body {
    padding: 24px;
}

/* ========== STAT CARDS ========== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 12px 14px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
}

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

.stat-card.blue::before { background: var(--accent-blue); }
.stat-card.green::before { background: var(--success-teal); }
.stat-card.amber::before { background: var(--highlight-amber); }
.stat-card.red::before { background: var(--danger-red); }
.stat-card.accent::before { background: var(--navy-700); }
.stat-card.teal::before { background: #14B8A6; }

.stat-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.stat-card.blue .stat-icon { background: rgba(46, 134, 171, 0.1); color: var(--accent-blue); }
.stat-card.green .stat-icon { background: rgba(46, 196, 182, 0.1); color: var(--success-teal); }
.stat-card.amber .stat-icon { background: rgba(244, 162, 97, 0.1); color: var(--highlight-amber); }
.stat-card.red .stat-icon { background: rgba(230, 57, 70, 0.1); color: var(--danger-red); }
.stat-card.accent .stat-icon { background: rgba(20, 40, 77, 0.1); color: var(--navy-700); }
.stat-card.teal .stat-icon { background: rgba(20, 184, 166, 0.1); color: #14B8A6; }

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--navy-900);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 2px;
    line-height: 1.1;
}

.stat-sub {
    font-size: 0.65rem;
    color: var(--text-muted, #94a3b8);
    margin-top: 2px;
}

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

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

th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-gray);
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.925rem;
    color: var(--text-primary);
}

tbody tr {
    transition: var(--transition);
}

tbody tr:hover {
    background: rgba(46, 134, 171, 0.03);
}

/* ========== BADGES ========== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-success { background: rgba(46, 196, 182, 0.1); color: #1A8C7E; }
.badge-warning { background: rgba(244, 162, 97, 0.1); color: #C27830; }
.badge-danger { background: rgba(230, 57, 70, 0.1); color: #C92A35; }
.badge-info { background: rgba(46, 134, 171, 0.1); color: #1E6B8E; }
.badge-gray { background: rgba(90, 107, 127, 0.1); color: var(--text-secondary); }

/* ========== BUTTONS ========== */
.btn-primary {
    background: linear-gradient(135deg, var(--navy-700) 0%, var(--navy-600) 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(10, 22, 40, 0.15);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--navy-800) 0%, var(--navy-900) 100%);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-gray);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: #DCE3EB;
}

.btn-accent {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-accent:hover {
    background: var(--accent-light);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-icon-sm {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    color: var(--text-secondary);
}

.btn-icon-sm:hover { background: var(--bg-gray); color: var(--navy-900); }
.btn-icon-sm.edit:hover { color: var(--accent-blue); }
.btn-icon-sm.delete:hover { color: var(--danger-red); }

/* ========== FORMS ========== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--navy-900);
    margin-bottom: 6px;
}

.form-group label i {
    color: var(--accent-blue);
    margin-right: 6px;
}

input, select, textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.925rem;
    font-family: inherit;
    color: var(--text-primary);
    transition: var(--transition);
    background: var(--bg-white);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(46, 134, 171, 0.1);
}

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

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-grid.full {
    grid-template-columns: 1fr;
}

/* ========== MODALS ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 22, 40, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 32px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-header h2 {
    font-size: 1.3rem;
    color: var(--navy-900);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h2 i {
    color: var(--accent-blue);
}

.modal-close {
    background: var(--bg-gray);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--danger-red);
    color: white;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.modal .btn-large {
    padding: 12px 32px;
}

/* Login Modal */
.login-modal {
    max-width: 420px;
    text-align: center;
}

.login-header {
    margin-bottom: 32px;
}

.login-icon {
    font-size: 3rem;
    color: var(--accent-blue);
    margin-bottom: 12px;
}

.login-header h1 {
    font-size: 2rem;
    color: var(--navy-900);
    font-weight: 700;
    letter-spacing: 2px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.login-footer {
    margin-top: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.login-error {
    background: rgba(230, 57, 70, 0.1);
    color: var(--danger-red);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.875rem;
}

/* ========== TOASTS ========== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
}

.toast-success { background: var(--success-teal); }
.toast-error { background: var(--danger-red); }
.toast-warning { background: var(--warning-orange); }

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ========== PAGE HEADER ========== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--navy-900);
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header h2 i {
    color: var(--accent-blue);
}

/* ========== FILTER BAR ========== */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-bar select, .filter-bar input {
    width: auto;
    min-width: 180px;
}

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.1rem;
    font-weight: 500;
}

/* ========== TABS (botones de pestañas en módulos) ========== */
.tab-btn.active {
    background: var(--navy-700);
    color: #FFFFFF;
    border-color: var(--navy-700);
}

.tab-btn.active:hover {
    background: var(--navy-600);
}

.tab-btn .badge {
    margin-left: 4px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .main-content { margin-left: 0; }
    .form-grid { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr; }
    .content-area { padding: 16px; }
    .topbar { padding: 12px 16px; }
}
