/* -------------------------------------------------------------------------- */
/*                         PREMIUM ADMIN DASHBOARD STYLES                     */
/* -------------------------------------------------------------------------- */

:root {
    --primary-color: #B61216;
    --sidebar-bg: #0f0f0f;
    --body-bg: #1a1a1a;
    --card-bg: rgba(40, 40, 40, 0.7);
    --text-main: #ffffff;
    --text-dim: #a0a0a0;
    --accent-red: #ff3e3e;
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Montserrat', sans-serif;
}

body {
    background-color: var(--body-bg);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--glass-border);
    transition: all 0.3s ease;
    z-index: 100;
}

.logo-container {
    padding-bottom: 40px;
    text-align: center;
}

.logo-container img {
    height: 50px;
    filter: drop-shadow(0 0 10px rgba(182, 18, 22, 0.4));
}

.nav-menu {
    list-style: none;
    flex-grow: 1;
}

.nav-item {
    margin-bottom: 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: var(--text-dim);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-link i {
    margin-right: 15px;
    font-size: 1.2rem;
}

.nav-link:hover, .nav-link.active {
    background-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 5px 15px rgba(182, 18, 22, 0.3);
}

/* --- MAIN CONTENT --- */
.main-content {
    flex-grow: 1;
    padding: 40px;
    overflow-y: auto;
}

/* --- VIEW TRANSITIONS --- */
#dashboard-view, #products-view {
    animation: fadeIn 0.5s ease;
}

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

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 90;
    background: transparent;
    transition: all 0.3s ease;
}

.header.scrolled {
    background: rgba(26, 26, 26, 0.8);
    backdrop-filter: blur(15px);
    padding: 10px 20px;
    margin-left: -20px;
    margin-right: -20px;
    border-bottom: 1px solid var(--glass-border);
}

.header-left h1 {
    font-size: 1.8rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
    background: linear-gradient(to right, #fff, #888);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.breadcrumb {
    font-size: 0.85rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-search-trigger {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-dim);
}

.header-search-trigger:hover {
    border-color: var(--primary-color);
    color: #fff;
    transform: translateY(-2px);
}

.notifications-pill {
    position: relative;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-dim);
}

.notifications-pill:hover {
    background: rgba(255,255,255,0.05);
    color: var(--primary-color);
}

.notification-dot {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    border: 2px solid #222;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 6px 6px 6px 18px;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-profile:hover {
    border-color: var(--primary-color);
    background: rgba(182, 18, 22, 0.05);
}

.user-text {
    display: flex;
    flex-direction: column;
    text-align: right;
}

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

.user-role {
    font-size: 0.7rem;
    color: var(--text-dim);
}

.user-avatar {
    width: 38px;
    height: 38px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    box-shadow: 0 4px 10px rgba(182, 18, 22, 0.3);
}

.header-actions {
    display: flex;
    gap: 10px;
}

.search-container {
    margin-bottom: 20px;
}

.compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* --- STAT CARDS --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 25px;
    border-radius: 20px;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    color: var(--text-dim);
}

.stat-value {
    font-size: 2rem;
    font-weight: 900;
    color: #fff;
}

/* --- CHART SECTION --- */
.content-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.chart-container {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
}

/* --- PRODUCTS TABLE --- */
.section-card {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 12px 25px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-primary:hover {
    background: var(--accent-red);
    transform: scale(1.05);
}

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

.products-table th {
    text-align: left;
    padding: 15px;
    color: var(--text-dim);
    font-size: 0.8rem;
    text-transform: uppercase;
    border-bottom: 1px solid var(--glass-border);
}

.products-table td {
    padding: 20px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.3s ease;
}

.products-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

.product-img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: contain;
    background: #fff;
}

.action-btns {
    display: flex;
    gap: 10px;
}

.action-btn {
    padding: 8px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    color: #fff;
}

.btn-edit:hover { background: #2196F3; }
.btn-delete:hover { background: var(--primary-color); }

/* --- PAGINATION --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
    padding: 20px 0;
}

.pagination-btn {
    padding: 8px 15px;
    background: #333;
    border: 1px solid var(--glass-border);
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.pagination-btn:hover:not(:disabled) {
    background: #444;
    border-color: var(--primary-color);
}

.pagination-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    font-weight: 700;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-info {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin: 0 15px;
}

/* --- MODAL --- */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #222;
    width: 90%;
    max-width: 800px;
    padding: 40px;
    border-radius: 20px;
    border: 1px solid var(--primary-color);
    max-height: 90vh;
    overflow-y: auto;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dim);
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px;
    background: #333;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: #fff;
    outline: none;
}

.image-preview-group {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.preview-box {
    aspect-ratio: 1;
    background: #333;
    border-radius: 8px;
    border: 1px dashed var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.preview-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* --- FORM BADGES --- */
.tag-cat { background: #2196F3; color: white; padding: 3px 8px; border-radius: 4px; font-size: 0.7rem; font-weight: 700; }
.tag-acc { background: #FF9800; color: white; padding: 3px 8px; border-radius: 4px; font-size: 0.7rem; font-weight: 700; }

.close-modal-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

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

/* --- RESPONSIVITY --- */
@media (max-width: 1024px) {
    .sidebar { width: 80px; padding: 30px 10px; }
    .nav-link span { display: none; }
    .nav-link i { margin-right: 0; }
    .content-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    body { 
        flex-direction: column; 
        overflow-x: hidden;
    }
    
    .sidebar { 
        width: 100%; 
        height: 70px; 
        flex-direction: row; 
        justify-content: space-around; 
        padding: 0; 
        position: fixed;
        bottom: 0;
        left: 0;
        border-right: none;
        border-top: 1px solid var(--glass-border);
        border-radius: 20px 20px 0 0;
        background: rgba(15, 15, 15, 0.9);
        backdrop-filter: blur(20px);
        box-shadow: 0 -5px 25px rgba(0,0,0,0.5);
    }
    
    .logo-container { display: none; }
    
    .nav-menu { 
        display: flex; 
        flex-direction: row; 
        gap: 0; 
        width: 100%;
        justify-content: space-around;
        align-items: center;
    }
    
    .nav-item {
        margin-bottom: 0;
        flex: 1;
    }
    
    .nav-link {
        padding: 10px 5px;
        background: transparent !important;
        box-shadow: none !important;
        flex-direction: column;
        gap: 4px;
        font-size: 0.65rem;
        border-radius: 0;
        text-align: center;
    }

    .nav-link span { display: block; }
    .nav-link i { font-size: 1.2rem; margin-right: 0; margin-bottom: 2px; }
    .nav-link.active { color: var(--primary-color); }
    .nav-link.active::after {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 30px;
        height: 3px;
        background: var(--primary-color);
        border-radius: 0 0 5px 5px;
    }

    .main-content { 
        padding: 20px 15px 90px 15px; 
        width: 100%;
    }

    .header {
        margin-bottom: 25px;
        padding: 10px 0;
        position: relative; /* Not sticky on mobile to save space */
    }

    .header-left h1 { font-size: 1.2rem; }
    .breadcrumb { font-size: 0.7rem; }
    
    .header-right { gap: 10px; }
    
    .user-text { display: none; } /* Hide text name on small mobile */
    .user-profile { padding: 5px; }
    .header-search-trigger, .notifications-pill { width: 38px; height: 38px; }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr; /* 2 columns for better space usage */
        gap: 15px;
        margin-bottom: 25px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-header span { font-size: 0.7rem; }
    .stat-value { font-size: 1.4rem; }

    .chart-container {
        padding: 15px;
    }

    .section-card {
        padding: 20px 15px;
    }

    .table-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .header-actions {
        flex-direction: column;
        gap: 10px;
    }

    .compare-grid {
        grid-template-columns: 1fr;
    }

    .btn-primary {
        width: 100%;
        justify-content: center;
        padding: 14px;
    }

    /* Table Mobile Optimizations - Converting to cards for very small screens */
    .products-table thead {
        display: none; /* Hide header on mobile */
    }

    .products-table, .products-table tbody, .products-table tr, .products-table td {
        display: block;
        width: 100%;
    }

    .products-table tr {
        margin-bottom: 15px;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid var(--glass-border);
        border-radius: 12px;
        padding: 15px;
    }

    .products-table td {
        padding: 5px 0;
        border-bottom: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 0.9rem;
    }

    .products-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--text-dim);
        font-size: 0.75rem;
        text-transform: uppercase;
    }

    .products-table td:first-child {
        justify-content: center;
        padding-bottom: 15px;
        border-bottom: 1px solid var(--glass-border);
        margin-bottom: 10px;
    }

    .products-table td:first-child::before { display: none; }

    .product-img {
        width: 80px;
        height: 80px;
    }

    /* Form & Modals */
    .form-grid { grid-template-columns: 1fr; }

    .modal-content {
        padding: 20px;
        width: 95%;
        margin: 10px;
        border-radius: 15px;
    }

    .image-preview-group {
        grid-template-columns: repeat(3, 1fr);
    }

    .pagination {
        flex-wrap: wrap;
        gap: 5px;
    }

    .pagination-info {
        width: 100%;
        text-align: center;
        order: -1;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .image-preview-group {
        grid-template-columns: repeat(2, 1fr);
    }

    .header h1 { font-size: 1.1rem; }

    .btn-text { display: none; }
    .btn-primary i { margin: 0; font-size: 1.2rem; }
}
