/* Basic styles */
:root {
    --primary-color: #1d4ed8;
    --secondary-color: #475569;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-color: #1e293b;
    --light-color: #f8fafc;
    --border-color: #e2e8f0;
    --border-radius: 8px;
    --font-family: 'Inter', sans-serif;
    --shadow: 0 4px 15px rgba(0,0,0,0.1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--light-color);
    color: var(--dark-color);
    margin: 0;
    line-height: 1.6;
}

.admin-container {
    min-height: 100vh;
}

/* Login Section */
#loginSection {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-box {
    background: white;
    padding: 3rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.8rem;
    color: var(--dark-color);
}

.login-box p {
    text-align: center;
    color: var(--secondary-color);
    margin-bottom: 2rem;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-color);
}

.input-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-login {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--border-radius);
    background-color: var(--primary-color);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-login:hover {
    background-color: #1e40af;
}

.error-message {
    color: var(--danger-color);
    text-align: center;
    margin-top: 1rem;
    min-height: 1.2em;
    font-size: 0.9rem;
}

/* Dashboard Section */
#dashboardSection {
    background: white;
    min-height: 100vh;
}

/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.header-left h1 {
    margin: 0;
    font-size: 1.8rem;
    color: var(--dark-color);
}

.header-left p {
    margin: 0;
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    color: var(--secondary-color);
    font-weight: 500;
    font-size: 0.9rem;
}

.btn-logout {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: transparent;
    color: var(--secondary-color);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.btn-logout:hover {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

/* Navigation Tabs */
.admin-nav {
    display: flex;
    background: var(--light-color);
    border-bottom: 1px solid var(--border-color);
    padding: 0 2rem;
}

.nav-tab {
    padding: 1rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--secondary-color);
    cursor: pointer;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.nav-tab:hover {
    color: var(--primary-color);
    background: rgba(29, 78, 216, 0.05);
}

.nav-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: white;
}

/* Admin Sections */
.admin-section {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--dark-color);
}

.section-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s;
}

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

.stat-icon {
    font-size: 2rem;
    opacity: 0.8;
}

.stat-info h3 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-info p {
    margin: 0;
    color: var(--secondary-color);
    font-size: 0.9rem;
}

/* Recent Products */
.recent-products {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

.recent-products h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--dark-color);
}

/* Form Styles */
.product-form {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    max-width: 800px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: var(--font-family);
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

.form-group small {
    display: block;
    margin-top: 0.5rem;
    color: var(--secondary-color);
    font-size: 0.8rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Buttons */
.btn-primary {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background: #1e40af;
}

.btn-secondary {
    padding: 12px 24px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: white;
    color: var(--secondary-color);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.btn-danger {
    padding: 8px 16px;
    border: 1px solid var(--danger-color);
    border-radius: var(--border-radius);
    background: var(--danger-color);
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Search and Filters */
.search-input {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    width: 250px;
}

.filter-select {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    background: white;
    min-width: 150px;
}

/* Products Table */
.products-table {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-top: 1rem;
}

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

.products-table th,
.products-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.products-table th {
    background: var(--light-color);
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.9rem;
}

.products-table td {
    font-size: 0.9rem;
}

.products-table tr:hover {
    background: var(--light-color);
}

.product-image-small {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-disponible {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.status-sin-stock {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.table-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-edit {
    padding: 6px 12px;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    background: rgba(29, 78, 216, 0.1);
    color: var(--primary-color);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-edit:hover {
    background: var(--primary-color);
    color: white;
}

.btn-delete {
    padding: 6px 12px;
    border: 1px solid var(--danger-color);
    border-radius: 4px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-delete:hover {
    background: var(--danger-color);
    color: white;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    margin: 0;
    color: var(--dark-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--secondary-color);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Loading States */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--secondary-color);
}

.loading::before {
    content: "⏳";
    margin-right: 0.5rem;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    font-weight: 500;
    box-shadow: var(--shadow);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 350px;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background: var(--success-color);
    color: white;
}

.notification.error {
    background: var(--danger-color);
    color: white;
}

.notification.warning {
    background: var(--warning-color);
    color: white;
}

.notification.info {
    background: var(--primary-color);
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .header-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .admin-nav {
        flex-wrap: wrap;
        padding: 0 1rem;
    }
    
    .nav-tab {
        flex: 1;
        text-align: center;
        font-size: 0.8rem;
        padding: 0.8rem 0.5rem;
    }
    
    .admin-section {
        padding: 1rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .section-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .search-input {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .products-table {
        font-size: 0.8rem;
    }
    
    .products-table th,
    .products-table td {
        padding: 8px 12px;
    }
    
    .modal-content {
        width: 95%;
        margin: 2rem auto;
    }
}