/* Admin Panel Shared Styles */

.admin-page {
    padding: 0;
}

.admin-page .page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.admin-page .page-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: #1a1a2e;
}

.admin-page .header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.admin-page .search-input {
    padding: 10px 16px;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    font-size: 0.875rem;
    outline: none;
    width: 240px;
}

.admin-page .search-input:focus {
    border-color: #4f46e5;
}

.admin-page .filter-select {
    padding: 10px 16px;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    font-size: 0.875rem;
    outline: none;
    cursor: pointer;
}

.btn-primary {
    padding: 10px 20px;
    background: #4f46e5;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
}

.btn-primary:hover {
    background: #4338ca;
}

.btn-outline {
    padding: 10px 20px;
    background: transparent;
    color: #4f46e5;
    border: 1px solid #4f46e5;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
}

/* Data Table */
.data-table {
    background: #ffffff;
    border-radius: 12px;
    overflow-x: auto;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.data-table .table-header {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e8eaed;
    gap: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    min-width: 640px;
}

.data-table .table-header span {
    flex: 1;
}

.data-table .table-row {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #f0f1f5;
    gap: 12px;
    font-size: 0.8125rem;
    min-width: 640px;
}

.data-table .table-row span {
    flex: 1;
}

.data-table .table-row:last-child {
    border-bottom: none;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 8px;
    vertical-align: middle;
}

.product-thumb {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: contain;
    margin-right: 8px;
    background: #f8f9fa;
    vertical-align: middle;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.status-badge.active { background: #d4edda; color: #28a745; }
.status-badge.inactive { background: #f8d7da; color: #dc3545; }
.status-badge.suspended { background: #f8d7da; color: #dc3545; }
.status-badge.pending { background: #fff3e0; color: #f57c00; }
.status-badge.shipped { background: #cce5ff; color: #007bff; }
.status-badge.processing { background: #fff3e0; color: #f57c00; }

.btn-action {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.btn-action:hover {
    background: #f0f1f5;
}

.star-filled {
    color: #f59e0b;
}

.star-empty {
    color: #e8eaed;
}

/* Cards Grid */
.marketing-grid,
.reports-grid,
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.card {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 16px;
    color: #1a1a2e;
}

/* Settings Card */
.settings-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.settings-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 20px;
    color: #1a1a2e;
}

.admin-page .form-group {
    margin-bottom: 16px;
}

.admin-page .form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 6px;
}

.admin-page .form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    font-size: 0.875rem;
    outline: none;
}

.admin-page .form-input:focus {
    border-color: #4f46e5;
}

.toggle-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.toggle-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: #1a1a2e;
    cursor: pointer;
}

/* Marketing specific */
.promo-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.promo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid #f0f1f5;
    border-radius: 8px;
}

.promo-info h4 {
    font-size: 0.875rem;
    margin: 0 0 4px;
    font-weight: 600;
}

.promo-info p {
    font-size: 0.75rem;
    color: #6c757d;
    margin: 0;
}

.coupon-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.coupon-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid #f0f1f5;
    border-radius: 8px;
}

.coupon-code {
    font-weight: 700;
    font-size: 0.875rem;
    background: #f0f1f5;
    padding: 4px 8px;
    border-radius: 4px;
}

.coupon-discount {
    flex: 1;
    font-size: 0.8125rem;
}

.coupon-usage {
    font-size: 0.75rem;
    color: #6c757d;
}

/* Reports */
.report-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.report-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 8px;
    color: #1a1a2e;
}

.report-description {
    font-size: 0.8125rem;
    color: #6c757d;
    margin: 0 0 16px;
}

.report-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.report-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.report-label {
    font-size: 0.7rem;
    color: #6c757d;
}

.report-value {
    font-size: 0.875rem;
    font-weight: 700;
    color: #1a1a2e;
}

@media (max-width: 900px) {
    .marketing-grid,
    .reports-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .admin-page .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .admin-page .header-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .admin-page .search-input {
        width: 100%;
    }

    .admin-page .filter-select {
        width: 100%;
    }

    .btn-primary {
        width: 100%;
    }

    .report-stats {
        flex-wrap: wrap;
    }
}


/* =========================================================
   LAYOUT + NAVIGATION (moved from scoped CSS for reliability)
   ========================================================= */

.layout-wrapper {
    display: flex;
    min-height: 100vh;
    background-color: #f5f6fa;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: 260px;
    min-width: 0;
    transition: margin-left 0.3s ease;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: #ffffff;
    border-bottom: 1px solid #e8eaed;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 12px;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.top-bar-left .page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid #e8eaed;
    background: transparent;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.hamburger,
.hamburger::before,
.hamburger::after {
    content: '';
    display: block;
    width: 18px;
    height: 2px;
    background: #1a1a2e;
    position: relative;
    transition: all 0.2s;
}

.hamburger::before {
    position: absolute;
    top: -6px;
}

.hamburger::after {
    position: absolute;
    top: 6px;
}

.top-bar .top-bar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.top-bar .btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #e8eaed;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.top-bar .btn-icon:hover {
    background: #f0f1f5;
}

.user-avatar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 16px;
    border-left: 1px solid #e8eaed;
}

.user-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: #1a1a2e;
}

.user-role {
    font-size: 0.75rem;
    color: #6c757d;
}

.btn-logout {
    margin-left: 8px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid #e8eaed;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.btn-logout:hover {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

.content-area {
    padding: 24px 32px;
    flex: 1;
    min-width: 0;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 190;
    border: none;
    cursor: pointer;
}

/* Hidden checkbox that drives the CSS-only sidebar toggle */
.sidebar-toggle-input {
    display: none;
}

/* Sidebar */
.sidebar {
    width: 260px;
    height: 100vh;
    background: #1a1a2e;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #4f46e5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 700;
    font-size: 1.125rem;
}

.brand-text {
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 700;
}

.btn-close-sidebar {
    display: none;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.125rem;
    cursor: pointer;
    padding: 4px 8px;
}

.btn-close-sidebar:hover {
    color: #ffffff;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin: 2px 12px;
    border-radius: 8px;
    transition: background 0.2s;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    background: #4f46e5;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.7);
    gap: 12px;
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-item.active .nav-link {
    color: #ffffff;
}

.nav-icon {
    font-size: 1.125rem;
    width: 24px;
    text-align: center;
}

.nav-text {
    flex: 1;
}

.nav-chevron {
    font-size: 1rem;
    opacity: 0.5;
}

/* Tablet */
@media (max-width: 1024px) {
    .content-area {
        padding: 20px 24px;
    }

    .top-bar {
        padding: 14px 24px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .main-content {
        margin-left: 0 !important;
    }

    .btn-menu-toggle {
        display: flex !important;
    }

    .top-bar {
        padding: 12px 16px;
    }

    .top-bar-left .page-title {
        font-size: 1.25rem;
    }

    .content-area {
        padding: 16px;
    }

    .user-info {
        display: none;
    }

    .user-avatar {
        padding-left: 12px;
    }

    .top-bar .top-bar-right {
        gap: 8px;
    }

    /* Sidebar off-screen by default; slides in when the toggle checkbox is checked.
       !important ensures these win over any stale scoped-CSS bundle. */
    .sidebar {
        transform: translateX(-100%) !important;
    }

    .sidebar-toggle-input:checked ~ .sidebar {
        transform: translateX(0) !important;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
    }

    /* Overlay is hidden until the sidebar is open */
    .sidebar-toggle-input:checked ~ .sidebar-overlay {
        display: block;
    }

    .btn-close-sidebar {
        display: block !important;
    }
}

@media (max-width: 480px) {
    .top-bar-left .page-title {
        font-size: 1.125rem;
    }

    .top-bar .btn-icon {
        width: 36px;
        height: 36px;
    }
}
