:root {
    --bg: #ffffff;
    --text: #000000;
    --blue: #003366;
    --btn-silver: #c0c0c0;
    --btn-green: #28a745;
    --btn-red: #dc3545;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text);
}

.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #f5f5f5;
}

.login-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    width: 300px;
}

.login-container input {
    width: 100%;
    padding: 0.75rem;
    margin: 0.5rem 0;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.login-container button {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--blue);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.sidebar {
    width: 250px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    background-color: var(--blue);
    color: white;
    padding-top: 20px;
}

.sidebar a {
    display: block;
    color: white;
    padding: 15px;
    text-decoration: none;
}

.sidebar a:hover {
    background-color: #002244;
}

.main-content {
    margin-left: 250px;
    padding: 20px;
}

.btn {
    background-color: var(--btn-silver);
    color: black;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin: 5px;
}

.btn-export-excel {
    background-color: var(--btn-green);
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-export-pdf {
    background-color: var(--btn-red);
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.table th, .table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 20px;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
}

.close {
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

form label {
    display: block;
    margin-top: 10px;
}

form input, form select, form textarea {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* ===== LOGIN STYLES ===== */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4edf9 100%);
    font-family: 'Roboto', sans-serif;
    padding: 20px;
    margin: 0;
}

.login-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 51, 102, 0.15);
    width: 100%;
    max-width: 420px;
    padding: 40px 30px;
    text-align: center;
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.logo-circle {
    width: 60px;
    height: 60px;
    background-color: #003366;
    border-radius: 50%;
    margin: 0 auto 16px;
    box-shadow: 0 4px 8px rgba(0, 51, 102, 0.2);
}

.login-container h1 {
    font-size: 1.4rem;
    color: #003366;
    margin-bottom: 24px;
    font-weight: 600;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-group i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #777;
    font-size: 16px;
}

.input-group input {
    width: 100%;
    padding: 14px 14px 14px 44px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s;
    outline: none;
    box-sizing: border-box;
}

.input-group input:focus {
    border-color: #003366;
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background-color: #c0c0c0; /* Plateado */
    color: #000;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    margin-top: 10px;
}

.btn-login:hover {
    background-color: #b0b0b0;
    transform: translateY(-2px);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.error-message {
    color: #d32f2f;
    margin-top: 12px;
    min-height: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.footer-text {
    margin-top: 24px;
    color: #666;
    font-size: 0.85rem;
}

.logo-img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 16px;
    box-shadow: 0 4px 8px rgba(0, 51, 102, 0.2);
}

/* ===== DASHBOARD STYLES ===== */
.main-content {
    margin-left: 250px;
    padding: 30px;
    background-color: #ffffff;
    min-height: 100vh;
}

.header {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #003366;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.user-info h1 {
    font-size: 1.8rem;
    color: #003366;
    margin: 0;
}

.user-info p {
    margin: 4px 0 0;
    color: #555;
    font-size: 1rem;
}

/* ===== Tarjetas de estadísticas ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 18px 12px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-top: 4px solid;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.1);
}

.stat-card.blue { border-color: #003366; }
.stat-card.orange { border-color: #FFA726; }
.stat-card.purple { border-color: #7E57C2; }
.stat-card.green { border-color: #26A69A; }

.stat-card h3 {
    font-size: 0.95rem;
    color: #555;
    margin-bottom: 8px;
    font-weight: 600;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: #000;
    margin: 0;
    line-height: 1.2;
}

/* Contenedor del gráfico */
.chart-container {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 24px;
    width: 100%;
    max-width: 600px; /* 👈 Limita el ancho máximo */
    margin-left: auto;
    margin-right: auto;
}

.chart-container h2 {
    color: #003366;
    margin-bottom: 16px;
    font-size: 1.3rem;
    font-weight: 600;
    text-align: center;
}

/* Canvas del gráfico */
#ordenesChart {
    display: block;
    width: 100% !important;
    height: 300px !important; /* 👈 Altura fija controlada */
    margin: 0 auto;
}

/* Fallback para navegadores antiguos */
@supports not (aspect-ratio: 1) {
    #ordenesChart {
        height: 280px !important;
    }
}

/* ===== Acciones rápidas ===== */
.quick-actions {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.quick-actions h2 {
    color: #003366;
    margin-bottom: 16px;
    font-size: 1.3rem;
    font-weight: 600;
}

.btn-large {
    display: inline-block;
    padding: 12px 24px;
    font-size: 1rem;
    margin-right: 12px;
    margin-bottom: 10px;
    text-decoration: none;
    text-align: center;
    border-radius: 8px;
    font-weight: 600;
}

/* ===== Responsive: Móviles ===== */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 16px 8px;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .chart-container {
        padding: 16px;
    }

    .chart-container h2 {
        font-size: 1.2rem;
    }

    /* En móviles, los botones se apilan */
    .btn-large {
        display: block;
        margin-right: 0;
        width: 100%;
        max-width: 300px;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card h3 {
        font-size: 0.9rem;
    }

    .stat-number {
        font-size: 1.4rem;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
    .header {
        flex-direction: column;
        text-align: center;
    }
    .user-info {
        gap: 12px;
    }
    .btn-large {
        display: block;
        margin-right: 0;
        margin-bottom: 12px;
    }
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 250px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    background-color: #003366; /* Azul corporativo */
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.15);
    z-index: 1000;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.logo-text {
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #e0e0e0;
}

.user-profile img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li {
    width: 100%;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: white;
    text-decoration: none;
    font-size: 1rem;
    transition: background 0.2s, padding-left 0.2s;
    gap: 14px;
}

.sidebar-nav a:hover {
    background-color: rgba(255,255,255,0.1);
    padding-left: 26px;
}

.sidebar-nav i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar-divider {
    height: 1px;
    background-color: rgba(255,255,255,0.1);
    margin: 10px 20px;
}

/* Responsive: ocultar sidebar en móviles (opcional) */
@media (max-width: 768px) {
    .sidebar {
        width: 70px;
    }
    .logo-text,
    .user-profile span,
    .sidebar-nav span {
        display: none;
    }
    .sidebar-nav a {
        justify-content: center;
        padding: 16px;
        gap: 0;
    }
    .sidebar-nav i {
        font-size: 1.3rem;
    }
}

/* ===== MODAL DE ÉXITO ===== */
#modalExito {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.modal-success {
    background: white;
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: popIn 0.4s ease-out;
}

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.checkmark {
    width: 70px;
    height: 70px;
    background-color: #28a745;
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 36px;
    margin: 0 auto 20px;
    box-shadow: 0 4px 10px rgba(40, 167, 69, 0.4);
}

.modal-success h2 {
    color: #003366;
    font-size: 1.4rem;
    margin-bottom: 24px;
    font-weight: 600;
}

.btn-success {
    background-color: #28a745;
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.btn-success:hover {
    background-color: #218838;
    transform: translateY(-2px);
}

/* Filtros */
.filters-section {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.filters-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end; 
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    margin-bottom: 5px;
    font-weight: 500;
    color: #003366;
}

.filter-group input,
.filter-group select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.filter-actions {
    display: flex;
    gap: 10px;
    grid-column: 1 / -1;
    flex-wrap: wrap;
}

.btn-filter {
    background-color: #003366;
    color: white;
}

.btn-clear {
    background-color: #6c757d;
    color: white;
    text-decoration: none;
    padding: 10px 16px;
    border-radius: 6px;
    display: inline-block;
    text-align: center;
}

.btn-export-excel {
    background-color: #28a745;
    color: white;
    text-decoration: none;
    padding: 10px 16px;
    border-radius: 6px;
    display: inline-block;
    text-align: center;
}

/* Tabla */
.table-container {
    overflow-x: auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    padding: 20px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #003366;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-details,
.btn-edit,
.btn-export-pdf {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}

.btn-details {
    background-color: #17a2b8;
    color: white;
}

.btn-edit {
    background-color: #ffc107;
    color: black;
}

.btn-export-pdf {
    background-color: #dc3545;
    color: white;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

/* Paginación */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.pagination .btn {
    padding: 8px 12px;
    text-decoration: none;
    border-radius: 6px;
}

.pagination .btn-active {
    background-color: #003366;
    color: white;
}

/* Modales de detalles y edición */
#detallesContenido,
#editarContenido {
    max-height: 60vh;
    overflow-y: auto;
    padding: 15px 0;
}

.detalle-item {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.detalle-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .filters-form {
        grid-template-columns: 1fr;
    }
    
    .filter-actions {
        justify-content: center;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .table {
        min-width: 600px;
    }
}

/* ===== CONTENEDOR DE GRÁFICAS ===== */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
    width: 100%;
}

.chart-box {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    width: 100%;
}

.chart-box h2 {
    color: #003366;
    margin-bottom: 20px;
    font-size: 1.3rem;
    font-weight: 600;
    text-align: center;
}

/* Canvas de gráficos */
.chart-box canvas {
    width: 100% !important;
    height: 300px !important;
    max-width: 500px;
    margin: 0 auto;
    display: block;
}

/* ===== RESPONSIVE PARA MÓVILES ===== */
@media (max-width: 768px) {
    .charts-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .chart-box {
        padding: 20px;
    }
    
    .chart-box h2 {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }
    
    .chart-box canvas {
        height: 250px !important;
    }
}

@media (max-width: 480px) {
    .chart-box canvas {
        height: 220px !important;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Tarjeta para "En Espera de Visto Bueno" */
.stat-card.pink {
    border-color: #276eb0;
}

