/* 
 * Sistema de Inventario - Estilos Modernos
 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #f5f5f5;
    --bg-card: #ffffff;
    --bg-sidebar: #2c3e50;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --text-light: #bdc3c7;
    --border-color: #ecf0f1;
    --shadow: rgba(0,0,0,0.1);
}

/* Tema Oscuro */
body.dark-mode {
    --bg-primary: #1a1a2e;
    --bg-card: #16213e;
    --bg-sidebar: #0f0f1a;
    --text-primary: #e4e4e4;
    --text-secondary: #a0a0a0;
    --text-light: #6c6c80;
    --border-color: #2a2a4a;
    --shadow: rgba(0,0,0,0.3);
}

body.dark-mode .sidebar {
    background: var(--bg-sidebar);
}

body.dark-mode .sidebar-brand {
    border-color: #2a2a4a;
}

body.dark-mode .sidebar nav a:hover,
body.dark-mode .sidebar nav a.active {
    background: #2a2a4a;
}

body.dark-mode .main-content {
    background: var(--bg-primary);
}

body.dark-mode .card,
body.dark-mode .filters-bar,
body.dark-mode .user-info {
    background: var(--bg-card);
    box-shadow: 0 2px 10px var(--shadow);
}

body.dark-mode .page-header {
    border-bottom-color: var(--border-color);
}

body.dark-mode .page-header h1,
body.dark-mode .card-header h3,
body.dark-mode .stat-card .stat-value,
body.dark-mode .user-info .user-details strong {
    color: var(--text-primary);
}

body.dark-mode .page-header h1 i,
body.dark-mode .card-header h3 i {
    color: #3498db;
}

body.dark-mode .table thead th {
    background: #1a1a2e;
    color: var(--text-secondary);
    border-bottom-color: var(--border-color);
}

body.dark-mode .table tbody td {
    border-bottom-color: var(--border-color);
    color: var(--text-primary);
}

body.dark-mode .table tbody tr:hover {
    background: #1a1a2e;
}

body.dark-mode .form-control,
body.dark-mode .form-select {
    background: #1a1a2e;
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus {
    border-color: #3498db;
}

body.dark-mode .form-label {
    color: var(--text-primary);
}

body.dark-mode .stat-card .stat-label,
body.dark-mode .user-info .user-details small,
body.dark-mode .text-muted {
    color: var(--text-secondary) !important;
}

body.dark-mode .sidebar-brand small {
    color: var(--text-light);
}

/* Toggle Theme Button */
.theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #3498db;
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s;
}

.theme-toggle:hover {
    transform: scale(1.1);
    background: #2980b9;
}

body.dark-mode .theme-toggle {
    background: #f39c12;
}

body.dark-mode .theme-toggle:hover {
    background: #d68910;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    transition: background 0.3s;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    background: var(--bg-sidebar);
    color: white;
    z-index: 1000;
    overflow-y: auto;
    transition: background 0.3s;
}

.sidebar-brand {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #34495e;
}

.sidebar-brand .brand-icon {
    width: 50px;
    height: 50px;
    background: #3498db;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-size: 24px;
}

.sidebar-brand h5 {
    margin: 0;
    font-size: 16px;
}

.sidebar-brand small {
    color: #95a5a6;
    font-size: 11px;
}

.sidebar nav {
    padding: 10px 0;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #bdc3c7;
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: #34495e;
    color: white;
    border-left-color: #3498db;
}

.sidebar nav a i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    margin-left: 240px;
    padding: 20px;
    min-height: 100vh;
    transition: margin-left 0.3s;
}

/* Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.page-header h1 {
    font-size: 24px;
    color: var(--text-primary);
    margin: 0;
}

.page-header h1 i {
    margin-right: 10px;
    color: #3498db;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    padding: 8px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px var(--shadow);
}

.user-info .avatar {
    width: 36px;
    height: 36px;
    background: #3498db;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.user-info .user-details strong {
    display: block;
    font-size: 13px;
    color: var(--text-primary);
}

.user-info .user-details small {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px var(--shadow);
    transition: all 0.3s;
}

.stat-card .stat-icon {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 10px;
}

.stat-card.primary .stat-icon { background: #ebf5fb; color: #3498db; }
.stat-card.success .stat-icon { background: #e8f8f5; color: #27ae60; }
.stat-card.warning .stat-icon { background: #fef9e7; color: #f39c12; }
.stat-card.danger .stat-icon { background: #fdedec; color: #e74c3c; }
.stat-card.info .stat-icon { background: #ebf5fb; color: #17a2b8; }

.stat-card .stat-value {
    font-size: 28px;
    font-weight: bold;
    color: var(--text-primary);
}

.stat-card .stat-label {
    color: var(--text-secondary);
    font-size: 13px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 10px;
    box-shadow: 0 2px 10px var(--shadow);
    margin-bottom: 20px;
    border: none;
    transition: background 0.3s;
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--text-primary);
}

.card-header h3 i {
    margin-right: 8px;
    color: #3498db;
}

.card-body {
    padding: 20px;
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table thead th {
    background: var(--bg-primary);
    color: #5a6c7d;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    padding: 12px;
    border: none;
    border-bottom: 2px solid var(--border-color);
}

.table tbody td {
    padding: 12px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-primary);
}

.table tbody tr:hover {
    background: var(--bg-primary);
}

/* Badges */
.badge {
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 5px;
}

.badge-primary { background: #3498db; color: white; }
.badge-success { background: #27ae60; color: white; }
.badge-warning { background: #f39c12; color: white; }
.badge-danger { background: #e74c3c; color: white; }
.badge-info { background: #17a2b8; color: white; }
.badge-secondary { background: #95a5a6; color: white; }

/* Buttons */
.btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-primary { background: #3498db; border: none; }
.btn-primary:hover { background: #2980b9; }

.btn-success { background: #27ae60; border: none; }
.btn-success:hover { background: #219a52; }

.btn-warning { background: #f39c12; border: none; color: white; }
.btn-warning:hover { background: #d68910; }

.btn-danger { background: #e74c3c; border: none; }
.btn-danger:hover { background: #c0392b; }

.btn-secondary { background: #95a5a6; border: none; }
.btn-secondary:hover { background: #7f8c8d; }

.btn-info { background: #17a2b8; border: none; }
.btn-info:hover { background: #138496; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { width: 32px; height: 32px; padding: 0; justify-content: center; }

/* Forms */
.form-control, .form-select {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background: white;
    transition: all 0.3s;
}

.form-control:focus, .form-select:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
    font-size: 13px;
}

/* Filters */
.filters-bar {
    background: var(--bg-card);
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px var(--shadow);
    margin-bottom: 20px;
}

.filters-bar .form-group {
    margin-bottom: 0;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Alerts */
.alert {
    border: none;
    border-radius: 8px;
    padding: 12px 15px;
    font-weight: 500;
}

.alert-success { background: #d4edda; color: #155724; }
.alert-danger { background: #f8d7da; color: #721c24; }
.alert-warning { background: #fff3cd; color: #856404; }
.alert-info { background: #d1ecf1; color: #0c5460; }

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    max-width: 400px;
    width: 100%;
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px;
    text-align: center;
    color: white;
}

.login-header .icon {
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 28px;
}

.login-header h2 {
    font-size: 22px;
    margin-bottom: 5px;
}

.login-body {
    padding: 30px;
}

.login-footer {
    background: #f8f9fa;
    padding: 15px 30px;
    text-align: center;
    border-top: 1px solid #ecf0f1;
}

.login-footer p {
    margin: 0;
    font-size: 12px;
    color: #7f8c8d;
}

.login-footer code {
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    color: #495057;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .quick-actions {
        flex-direction: column;
    }
    
    .quick-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Navigation Section Titles */
.nav-section-title {
    padding: 15px 20px 5px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #6c757d;
    font-weight: 700;
    margin-top: 10px;
}

/* Construction Theme Colors */
.sidebar {
    background: #1a1a2e;
}

.sidebar-brand .brand-icon {
    background: #e67e22;
}

.stat-card.construction .stat-icon { background: #fef3e2; color: #e67e22; }
.stat-card.materials .stat-icon { background: #e8f6f3; color: #27ae60; }
.stat-card.obra .stat-icon { background: #e8f4f8; color: #3498db; }
.stat-card.tools .stat-icon { background: #fdf2e9; color: #d35400; }

/* Obra Status Badges */
.badge-planificacion { background: #95a5a6; color: white; }
.badge-en_proceso { background: #3498db; color: white; }
.badge-pausado { background: #f39c12; color: white; }
.badge-terminado { background: #27ae60; color: white; }
.badge-cancelado { background: #e74c3c; color: white; }

/* Equipo Status Badges */
.badge-disponible { background: #27ae60; color: white; }
.badge-en_obra { background: #3498db; color: white; }
.badge-mantenimiento { background: #f39c12; color: white; }
.badge-baja { background: #e74c3c; color: white; }

/* Request Priority */
.priority-baja { color: #27ae60; }
.priority-normal { color: #3498db; }
.priority-urgente { color: #e74c3c; }

/* Activity Widget */
.activity-widget {
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
}

.activity-icon.entrada { background: #d4edda; color: #27ae60; }
.activity-icon.salida { background: #f8d7da; color: #e74c3c; }
.activity-icon.crear { background: #d1ecf1; color: #17a2b8; }
.activity-icon.editar { background: #fff3cd; color: #f39c12; }

.activity-content {
    flex: 1;
}

.activity-title {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.activity-time {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Calendar */
.mantenimiento-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-card);
}

.calendar-day:hover {
    background: #3498db;
    color: white;
}

.calendar-day.today {
    background: #3498db;
    color: white;
    font-weight: bold;
}

.calendar-day.has-event {
    background: #fef9e7;
    position: relative;
}

.calendar-day.has-event::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #f39c12;
}

.calendar-day.other-month {
    opacity: 0.3;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.calendar-header h4 {
    margin: 0;
    color: var(--text-primary);
}

/* Search Global */
.global-search {
    position: relative;
}

.global-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-radius: 8px;
    box-shadow: 0 4px 20px var(--shadow);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.global-search-results.show {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-item:hover {
    background: var(--bg-primary);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    background: #ebf5fb;
    color: #3498db;
}

.search-result-info {
    flex: 1;
}

.search-result-title {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.search-result-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Bloqueo de registros */
.bloqueado-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.bloqueado-card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    max-width: 400px;
}

.bloqueado-card h3 {
    color: #e74c3c;
    margin-bottom: 10px;
}

/* Charts Container */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Modal Improvements */
.modal-content {
    border: none;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 15px 20px;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 15px 20px;
}

/* Tabs */
.nav-tabs {
    border-bottom: 2px solid var(--border-color);
}

.nav-tabs .nav-link {
    border: none;
    color: var(--text-secondary);
    padding: 10px 20px;
    font-weight: 500;
}

.nav-tabs .nav-link:hover {
    color: #3498db;
}

.nav-tabs .nav-link.active {
    color: #3498db;
    background: transparent;
    border-bottom: 2px solid #3498db;
}

/* Pagination */
.pagination {
    margin: 0;
}

.page-link {
    color: var(--text-primary);
    border-color: var(--border-color);
    background: var(--bg-card);
}

.page-link:hover {
    background: var(--bg-primary);
    border-color: #3498db;
    color: #3498db;
}

.page-item.active .page-link {
    background: #3498db;
    border-color: #3498db;
}

