/* =====================================================
   Sistema CAE - Fichas TER030/IND050
   Estilos principales
   ===================================================== */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --light-bg: #f8fafc;
    --border-color: #e2e8f0;
    --text-dark: #1e293b;
    --text-muted: #64748b;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-dark);
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 260px;
    background: linear-gradient(180deg, #1e3a5f 0%, #0f172a 100%);
    padding: 1rem;
    z-index: 1000;
    transition: all 0.3s ease;
}

.sidebar .logo {
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 1rem;
}

.sidebar .logo h4 {
    color: #fff;
    font-weight: 700;
    margin: 0;
    font-size: 1.1rem;
}

.sidebar .logo small {
    color: rgba(255,255,255,0.6);
    font-size: 0.75rem;
}

.sidebar .nav-link {
    color: rgba(255,255,255,0.8);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar .nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.sidebar .nav-link.active {
    background: var(--primary-color);
    color: #fff;
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
}

.sidebar .user-info {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    padding: 1rem;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
}

.sidebar .user-info .user-name {
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
}

.sidebar .user-info .user-role {
    color: rgba(255,255,255,0.6);
    font-size: 0.75rem;
}

/* Main content */
.main-content {
    margin-left: 260px;
    padding: 2rem;
    min-height: 100vh;
}

/* Header */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.page-header .breadcrumb {
    background: none;
    padding: 0;
    margin: 0;
}

/* Cards */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

/* Stat cards */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-card .icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #fff;
}

.stat-card .icon.bg-primary { background: var(--primary-color); }
.stat-card .icon.bg-success { background: var(--success-color); }
.stat-card .icon.bg-warning { background: var(--warning-color); }
.stat-card .icon.bg-danger { background: var(--danger-color); }

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-top: none;
}

.table td {
    vertical-align: middle;
}

/* Forms */
.form-label {
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.form-control, .form-select {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.625rem 0.875rem;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

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

.form-control.is-invalid {
    border-color: var(--danger-color);
}

.input-group-text {
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

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

.btn-success {
    background: var(--success-color);
    border-color: var(--success-color);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.85rem;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.4em 0.8em;
    border-radius: 6px;
}

/* Section title */
.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
}

/* File upload */
.file-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--light-bg);
}

.file-upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.file-upload-area i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.file-upload-area p {
    margin: 0;
    color: var(--text-muted);
}

/* File list */
.file-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.file-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--light-bg);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.file-list li .file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-list li .file-icon {
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}

/* Luminarias table */
.luminarias-table {
    font-size: 0.9rem;
}

.luminarias-table input {
    min-width: 80px;
}

.luminarias-table .btn-remove {
    padding: 0.25rem 0.5rem;
}

/* Calculation result */
.calculation-result {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}

.calculation-result .result-label {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.calculation-result .result-value {
    font-size: 2rem;
    font-weight: 700;
}

.calculation-result .result-unit {
    font-size: 1rem;
    opacity: 0.9;
}

/* Steps indicator */
.steps-indicator {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    position: relative;
}

.steps-indicator::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border-color);
    z-index: 0;
}

.steps-indicator .step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.steps-indicator .step .step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.steps-indicator .step.active .step-number {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.steps-indicator .step.completed .step-number {
    background: var(--success-color);
    border-color: var(--success-color);
    color: #fff;
}

.steps-indicator .step .step-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.steps-indicator .step.active .step-label {
    color: var(--primary-color);
    font-weight: 500;
}

/* Login page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.login-card .logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-card .logo h2 {
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.login-card .logo p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        left: -280px;
        width: 280px;
        transition: left 0.3s ease;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
    
    /* Mobile header */
    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.75rem 1rem;
        background: #fff;
        border-bottom: 1px solid var(--border-color);
        margin: -1rem -1rem 1rem -1rem;
        position: sticky;
        top: 0;
        z-index: 999;
    }
    
    .mobile-header .logo {
        font-weight: 700;
        color: var(--text-dark);
        font-size: 1.1rem;
    }
    
    .mobile-header .btn-menu {
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--text-dark);
        padding: 0.25rem;
    }
    
    /* Overlay cuando sidebar está abierta */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    .page-header h1 {
        font-size: 1.25rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-card .stat-value {
        font-size: 1.5rem;
    }
}

@media (min-width: 993px) {
    .mobile-header {
        display: none;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
}

/* Print styles */
@media print {
    .sidebar, .btn, .no-print {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

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

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Tooltips custom */
.tooltip-custom {
    position: relative;
}

.tooltip-custom:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: var(--text-dark);
    color: #fff;
    font-size: 0.75rem;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 100;
}
