/* ============================================
   FORMULA ONEDERFUL — Admin Panel CSS
   ============================================ */

:root {
    --green-primary: #4CAF50;
    --green-dark: #2E7D32;
    --green-light: #C8E6C9;
    --green-50: #E8F5E9;
    --orange-primary: #FF9800;
    --blue-primary: #2196F3;
    --pink-primary: #E91E63;
    --white: #FFFFFF;
    --gray-50: #FAFAFA;
    --gray-100: #F5F5F5;
    --gray-200: #EEEEEE;
    --gray-300: #E0E0E0;
    --gray-400: #BDBDBD;
    --gray-500: #9E9E9E;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
    --transition-fast: 0.2s ease;
    --transition-base: 0.3s ease;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 15px;
}

body {
    font-family: var(--font-body);
    color: var(--gray-800);
    background: var(--gray-100);
    display: flex;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ============================================
   Sidebar
   ============================================ */

.sidebar {
    width: 250px;
    background: var(--gray-900);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform var(--transition-base);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

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

.logo-circle-admin {
    width: 40px;
    height: 40px;
    background: var(--green-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo-fo-admin {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 800;
    color: var(--white);
}

.logo-fo-admin sup {
    font-size: 7px;
    color: var(--orange-primary);
}

.admin-title {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    transition: all var(--transition-fast);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--white);
}

.nav-item.active {
    background: rgba(76, 175, 80, 0.2);
    color: var(--green-primary);
}

.nav-item svg {
    opacity: 0.7;
    flex-shrink: 0;
}

.nav-item.active svg {
    opacity: 1;
    stroke: var(--green-primary);
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ============================================
   Main Content
   ============================================ */

.main-content {
    flex: 1;
    margin-left: 250px;
    min-height: 100vh;
}

.top-bar {
    background: var(--white);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar h2 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    flex: 1;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
}

.admin-badge {
    background: var(--green-50);
    color: var(--green-dark);
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Sections */
.content-section {
    display: none;
    padding: 32px;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.section-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-toolbar h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
}

/* ============================================
   Stats Grid
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--white);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--gray-200);
    transition: all var(--transition-base);
}

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

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

.stat-value {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 2px;
}

.stat-green {
    border-left: 4px solid var(--green-primary);
}

.stat-blue {
    border-left: 4px solid var(--blue-primary);
}

.stat-orange {
    border-left: 4px solid var(--orange-primary);
}

.stat-pink {
    border-left: 4px solid var(--pink-primary);
}

/* ============================================
   Cards
   ============================================ */

.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.card h3 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    margin-bottom: 16px;
    color: var(--gray-900);
}

.card-desc {
    color: var(--gray-600);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 24px;
}

/* ============================================
   Tables
   ============================================ */

.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    background: var(--gray-50);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-600);
    border-bottom: 1px solid var(--gray-200);
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.data-table tr:hover td {
    background: var(--gray-50);
}

.table-img {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

code {
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--gray-700);
}

.empty-state {
    text-align: center;
    color: var(--gray-500);
    padding: 32px 0;
    font-size: 0.9rem;
}

/* ============================================
   Badges
   ============================================ */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-green {
    background: var(--green-50);
    color: var(--green-dark);
}

.badge-blue {
    background: #E3F2FD;
    color: #1565C0;
}

.badge-orange {
    background: #FFF3E0;
    color: #E65100;
}

.badge-pink {
    background: #FCE4EC;
    color: #AD1457;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.btn-primary:hover {
    background: var(--green-dark);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-800);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-danger {
    background: #FFEBEE;
    color: #C62828;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

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

/* ============================================
   Status Select
   ============================================ */

.status-select {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-300);
    font-size: 0.8rem;
    font-family: var(--font-body);
    background: var(--white);
    cursor: pointer;
}

.status-select:focus {
    outline: none;
    border-color: var(--green-primary);
}

.order-count {
    font-size: 0.85rem;
    color: var(--gray-500);
}

/* ============================================
   Charts (CSS-based)
   ============================================ */

.chart-container {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bar-chart {
    width: 100%;
}

.bar-item {
    margin-bottom: 16px;
}

.bar-label {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--gray-700);
}

.bar-track {
    height: 24px;
    background: var(--gray-100);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 4px;
}

.bar-fill {
    height: 100%;
    border-radius: 12px;
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    min-width: 4px;
}

.bar-green {
    background: linear-gradient(135deg, #4CAF50, #81C784);
}

.bar-blue {
    background: linear-gradient(135deg, #2196F3, #64B5F6);
}

.bar-orange {
    background: linear-gradient(135deg, #FF9800, #FFB74D);
}

.bar-value {
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* Vertical bar chart */
.bar-chart-vertical {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    height: 180px;
    padding-bottom: 30px;
    width: 100%;
}

.vbar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    position: relative;
}

.vbar-value {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.vbar-track {
    flex: 1;
    width: 36px;
    background: var(--gray-100);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
}

.vbar-fill {
    width: 100%;
    background: linear-gradient(to top, #4CAF50, #81C784);
    border-radius: 6px;
    transition: height 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    min-height: 4px;
}

.vbar-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 8px;
    position: absolute;
    bottom: -24px;
}

/* ============================================
   SEO
   ============================================ */

.seo-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.seo-score {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: var(--gray-50);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
}

.score-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.score-green {
    background: var(--green-50);
    border: 3px solid var(--green-primary);
}

.score-orange {
    background: #FFF3E0;
    border: 3px solid var(--orange-primary);
}

.score-red {
    background: #FFEBEE;
    border: 3px solid #f44336;
}

.score-value {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1;
}

.score-label {
    font-size: 0.7rem;
    color: var(--gray-500);
}

.score-meta strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.score-meta span {
    font-size: 0.85rem;
    color: var(--gray-600);
}

.seo-checks-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.seo-check {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--gray-50);
}

.seo-check.pass {
    border-left: 3px solid var(--green-primary);
}

.seo-check.warning {
    border-left: 3px solid var(--orange-primary);
}

.seo-status {
    font-size: 1rem;
    margin-top: 2px;
}

.seo-check-info strong {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.seo-check-info p {
    font-size: 0.8rem;
    color: var(--gray-600);
}

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

.recommendation {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: #FFF8E1;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--orange-primary);
}

.rec-icon {
    font-size: 1.2rem;
    margin-top: 2px;
}

.recommendation strong {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.recommendation p {
    font-size: 0.8rem;
    color: var(--gray-700);
    line-height: 1.5;
}

/* ============================================
   Modal
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    backdrop-filter: blur(4px);
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
    font-family: var(--font-heading);
    margin-bottom: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-600);
}

.modal-body {
    padding: 24px;
}

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 4px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.9rem;
    background: var(--white);
    transition: border-color var(--transition-fast);
}

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

/* Image Upload */
.image-upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--gray-50);
    position: relative;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-upload-area:hover {
    border-color: var(--green-primary);
    background: var(--green-50);
}

.image-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--gray-500);
}

.image-upload-placeholder svg {
    opacity: 0.4;
}

.image-upload-placeholder span {
    font-size: 0.9rem;
    font-weight: 500;
}

.image-upload-placeholder small {
    font-size: 0.75rem;
    color: var(--gray-400);
}

.image-preview {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* ============================================
   Toast
   ============================================ */

.admin-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--gray-900);
    color: var(--white);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 5000;
    animation: toastIn 0.4s ease, toastOut 0.4s ease 2.6s forwards;
    border-left: 4px solid var(--green-primary);
}

@keyframes toastIn {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* ============================================
   Login Overlay
   ============================================ */

.login-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.login-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.login-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.5s ease;
}

.login-logo {
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
}

.login-logo .logo-circle-admin {
    width: 64px;
    height: 64px;
    box-shadow: 0 8px 24px rgba(76, 175, 80, 0.3);
}

.login-logo .logo-fo-admin {
    font-size: 22px;
}

.login-title {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 32px;
}

.login-input-group {
    display: flex;
    gap: 8px;
}

.login-input {
    flex: 1;
    padding: 14px 18px;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.08);
    color: var(--white);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: all var(--transition-fast);
}

.login-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.login-input:focus {
    outline: none;
    border-color: var(--green-primary);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
    background: rgba(255, 255, 255, 0.12);
}

.login-btn {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--green-primary);
    color: var(--white);
    font-size: 1.3rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.login-btn:hover {
    background: var(--green-dark);
    transform: scale(1.05);
}

.login-error {
    color: #ef5350;
    font-size: 0.85rem;
    margin-top: 16px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.login-error.visible {
    opacity: 1;
}

.totp-secret-display {
    font-family: monospace;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.35);
    word-break: break-all;
    margin-top: 8px;
}

.login-card.shake {
    animation: shakeAnim 0.5s ease;
}

@keyframes shakeAnim {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-12px);
    }

    40% {
        transform: translateX(12px);
    }

    60% {
        transform: translateX(-8px);
    }

    80% {
        transform: translateX(8px);
    }
}

/* Description cell in products table */
.desc-cell {
    max-width: 200px;
    color: var(--gray-600);
}

.desc-cell small {
    line-height: 1.4;
}

/* Logout button */
.nav-item-logout:hover {
    background: rgba(244, 67, 54, 0.15) !important;
    color: #ef5350 !important;
}

.nav-item-logout:hover svg {
    stroke: #ef5350;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .content-section {
        padding: 20px 16px;
    }

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

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

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}