/* ===================================
   ADMIN PANEL STYLES - RESPONSIVE & SECURE
   =================================== */

:root {
    --primary-color: #AF1212;
    --primary-dark: #690F0F;
    --accent-color: #D4AF37;
    --bg-cream: #FFF8F0;
    --text-dark: #2c3e50;
    --shadow: rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

.admin-body {
    margin: 0;
    padding: 0;
    background: #f5f6fa;
    font-family: 'Poppins', sans-serif;
    overflow-x: hidden;
}

/* ===================================
   LOGIN SCREEN
   =================================== */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 1rem;
}

.login-container {
    background: white;
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 450px;
    width: 100%;
    animation: fadeInUp 0.5s ease;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 100px;
    height: 100px;
    margin: 0 auto 1rem;
    display: block;
    object-fit: contain;
}

.login-header h2 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-family: 'Playfair Display', serif;
}

.login-header p {
    color: #666;
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.login-form label {
    display: block;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.login-form input {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: var(--transition);
    font-family: 'Poppins', sans-serif;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 21, 56, 0.1);
}

.btn-login {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    margin-top: 1rem;
    text-align: center;
    justify-content: center;
}

.login-info {
    margin-top: 2rem;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

.sidebar-back-home {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-back-home .btn-login {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.sidebar-back-home .btn-login:hover {
    background: var(--accent-color);
    color: var(--primary-dark);
    transform: translateY(-2px);
}

/* ===================================
   ADMIN DASHBOARD
   =================================== */
.admin-dashboard {
    display: flex;
    min-height: 100vh;
}

/* ===================================
   SIDEBAR
   =================================== */
.admin-sidebar {
    width: 280px;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 2rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header img {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    filter: brightness(0) invert(1);
}

.sidebar-header h3 {
    font-size: 1.3rem;
    font-family: 'Playfair Display', serif;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

/* Custom scrollbar for sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 2rem;
    color: rgba(255, 255, 255, 0.8);
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding-left: 2.5rem;
}

.nav-item.active {
    background: var(--accent-color);
    color: var(--primary-dark);
    font-weight: 600;
    border-left: 4px solid var(--primary-dark);
}

.nav-item i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-logout {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 0.8rem;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    transition: var(--transition);
    font-family: 'Poppins', sans-serif;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* ===================================
   MAIN CONTENT
   =================================== */
.admin-main {
    margin-left: 280px;
    flex: 1;
    display: flex;
    flex-direction: column;
    width: calc(100% - 280px);
}

/* ===================================
   ADMIN HEADER
   =================================== */
.admin-header {
    background: white;
    padding: 1.5rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 999;
}

.admin-header h1 {
    color: var(--primary-color);
    font-size: 1.8rem;
    font-family: 'Playfair Display', serif;
    margin: 0;
}

.btn-mobile-menu {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0.5rem;
}

.admin-user-info {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.admin-user-info > span {
    color: #666;
    font-size: 0.9rem;
}

.user-avatar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-cream);
    padding: 0.5rem 1rem;
    border-radius: 25px;
}

.user-avatar i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.admin-content {
    flex: 1;
    padding: 2rem;
    max-width: 100%;
    overflow-x: hidden;
}

.admin-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.admin-section.active {
    display: block;
}

/* ===================================
   STATS GRID
   =================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 70px;
    height: 70px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    flex-shrink: 0;
}

.stat-details h3 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.3rem;
    font-weight: 700;
}

.stat-details p {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
}

/* ===================================
   DASHBOARD CHARTS
   =================================== */
.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.chart-card {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.chart-card h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

/* ===================================
   TOOLBAR
   =================================== */
.section-toolbar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.search-input,
.filter-select,
.filter-input {
    padding: 0.8rem 1.2rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 0.95rem;
    transition: var(--transition);
    font-family: 'Poppins', sans-serif;
}

.search-input {
    flex: 1;
    min-width: 250px;
}

.search-input:focus,
.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 21, 56, 0.1);
}

/* ===================================
   TABLES
   =================================== */
.table-container {
    background: white;
    border-radius: 15px;
    overflow-x: auto;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.admin-table thead {
    background: var(--primary-color);
    color: white;
}

.admin-table th {
    padding: 1.2rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.admin-table td {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid #f0f0f0;
}

.admin-table tbody tr {
    transition: var(--transition);
}

.admin-table tbody tr:hover {
    background: var(--bg-cream);
}

.status-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
    white-space: nowrap;
}

.status-select {
    border: none;
    background: transparent;
    font-weight: 600;
    cursor: pointer;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-family: 'Poppins', sans-serif;
}

.status-select:focus {
    outline: 2px solid var(--primary-color);
}

.status-pendiente,
.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-confirmado,
.status-confirmed {
    background: #d1ecf1;
    color: #0c5460;
}

.status-entregado,
.status-delivered {
    background: #d4edda;
    color: #155724;
}

.status-cancelado,
.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

.status-activo {
    background: #d4edda;
    color: #155724;
}

.status-inactivo {
    background: #f8d7da;
    color: #721c24;
}

.status-en_proceso,
.status-in_progress {
    background: #cce5ff;
    color: #004085;
}

.status-resuelto,
.status-resolved {
    background: #d4edda;
    color: #155724;
}

/* ===================================
   ACTION BUTTONS
   =================================== */
.action-btn {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    font-size: 1.1rem;
    color: #666;
    transition: var(--transition);
    border-radius: 5px;
}

.action-btn:hover {
    background: var(--bg-cream);
    color: var(--primary-color);
}

.action-btn.edit {
    color: #17a2b8;
}

.action-btn.delete {
    color: #dc3545;
}

/* ===================================
   MODALS
   =================================== */
.modal-admin {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.modal-admin.active {
    display: flex;
}

.modal-admin-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-admin-content {
    position: relative;
    background: white;
    border-radius: 20px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: zoomIn 0.3s ease;
    z-index: 1;
}

.modal-admin-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 20px 20px 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.modal-admin-header h3 {
    font-size: 1.5rem;
    font-family: 'Playfair Display', serif;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
}

.modal-close:hover {
    transform: rotate(90deg);
}

.modal-admin-body {
    padding: 2rem;
}

.modal-admin-body .form-group {
    margin-bottom: 1.5rem;
}

.modal-admin-body label {
    display: block;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.modal-admin-body input,
.modal-admin-body select,
.modal-admin-body textarea {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    transition: var(--transition);
}

.modal-admin-body input:focus,
.modal-admin-body select:focus,
.modal-admin-body textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 21, 56, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.modal-admin-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #f0f0f0;
}

/* ===================================
   REPORTS
   =================================== */
.reports-container,
.settings-container {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.reports-container h3,
.settings-container h3 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 2rem;
    font-family: 'Playfair Display', serif;
}

.report-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.report-card {
    background: var(--bg-cream);
    padding: 2rem;
    border-radius: 15px;
    border-left: 4px solid var(--primary-color);
}

.report-card i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.report-card h4 {
    color: var(--primary-color);
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
}

.report-card .filter-select,
.report-card .filter-input {
    width: 100%;
    margin-bottom: 1rem;
}

.report-card .btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.99rem;
    height: 50px;
}


/* ===================================
   SIDEBAR OVERLAY (MOBILE)
   =================================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ===================================
   ANIMATIONS
   =================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

/* Tablets y dispositivos medianos (768px - 1024px) */
@media (max-width: 1024px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }
    
    .admin-sidebar.active {
        transform: translateX(0);
    }
    
    .admin-main {
        margin-left: 0;
        width: 100%;
    }
    
    .btn-mobile-menu {
        display: block;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .dashboard-charts {
        grid-template-columns: 1fr;
    }
    
    .admin-header h1 {
        font-size: 1.5rem;
    }
    
    .admin-content {
        padding: 1.5rem;
    }
}

/* Móviles (hasta 768px) */
@media (max-width: 768px) {
    .login-container {
        padding: 2rem 1.5rem;
    }
    
    .admin-header {
        padding: 1rem;
    }
    
    .admin-header h1 {
        font-size: 1.2rem;
    }
    
    .admin-user-info {
        gap: 0.5rem;
    }
    
    .admin-user-info > span:first-of-type {
        display: none;
    }
    
    .user-avatar span {
        display: none;
    }
    
    .admin-content {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .stat-details h3 {
        font-size: 1.5rem;
    }
    
    .section-toolbar {
        flex-direction: column;
    }
    
    .search-input {
        width: 100%;
        min-width: auto;
    }
    
    .filter-select,
    .filter-input {
        width: 100%;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .admin-table {
        font-size: 0.85rem;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 0.8rem;
    }
    
    .modal-admin-content {
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
        width: 100%;
    }
    
    .modal-admin-header {
        border-radius: 0;
        padding: 1rem;
    }
    
    .modal-admin-header h3 {
        font-size: 1.2rem;
    }
    
    .modal-admin-body {
        padding: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal-admin-footer {
        flex-direction: column-reverse;
    }
    
    .modal-admin-footer .btn {
        width: 100%;
    }
    
    .report-options {
        grid-template-columns: 1fr;
    }
    
    .report-card {
        padding: 1.5rem;
    }
    
    .chart-card {
        padding: 1rem;
    }
}
.report-card .btn i {
    font-size: 1.3rem;
    line-height: 1;
}
