/* --- CSS Reset & Base Styles --- */
:root {
    --primary-600: #7F56D9;
    --primary-700: #6941C6;
    --gray-900: #101828;
    --gray-700: #344054;
    --gray-600: #475467;
    --gray-300: #D0D5DD;
    --gray-200: #EAECF0;
    --gray-100: #F2F4F7;
    --gray-50: #F9FAFB;
    --white: #FFFFFF;

    --font-family: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    color: var(--gray-600);
    background-color: var(--white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.hidden { display: none !important; }

a {
    text-decoration: none;
    color: inherit;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    transition: background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 32px;
}

/* --- Reusable Components --- */
.btn {
    padding: 12px 20px;
    display: inline-flex;
    align-items: center;
    position: relative;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary-600);
    color: var(--white);
    box-shadow: 0px 1px 2px rgba(16, 24, 40, 0.05);
}

.btn-primary:hover {
    background-color: var(--primary-700);
}

.btn-secondary {
    background-color: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    box-shadow: 0px 1px 2px rgba(16, 24, 40, 0.05);
}

.btn-secondary:hover {
    background-color: var(--gray-50);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #d93333;
}

/* --- Header / Navbar --- */
.header {
    background-color: var(--white);
    padding: 16px 0;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(8px);
    background-color: rgba(255, 255, 255, 0.8);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 20px;
    color: var(--gray-900);
}

.nav-links {
    display: none; /* Hidden on mobile */
}

.nav-links ul {
    list-style: none;
    display: flex;
    gap: 32px;
}

.nav-links a {
    font-weight: 600;
    font-size: 16px;
    color: var(--gray-600);
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--primary-700);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-menu-btn {
    display: block;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

/* --- Hero Section --- */
.hero {
    padding: 96px 0;
    text-align: center;
}

.hero-content {
    max-width: 768px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 48px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.02em;
    margin-bottom: 24px;
}

.hero p {
    font-size: 20px;
    line-height: 1.5;
    color: var(--gray-600);
    margin-bottom: 48px;
}

.hero-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 64px;
}

.hero-image {
    padding: 0 32px;
}

.hero-image img {
    width: 100%;
    max-width: 900px;
    border-radius: 12px;
    box-shadow: 0px 32px 64px -12px rgba(16, 24, 40, 0.14);
}

/* --- Trusted By Section --- */
.trusted-by {
    padding: 64px 0;
    text-align: center;
}

.trusted-by p {
    color: var(--gray-600);
    font-weight: 500;
    margin-bottom: 32px;
}

.logos {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 32px;
}

.logos img {
    height: 32px;
    filter: grayscale(1);
    opacity: 0.6;
    transition: all 0.2s;
}
.logos img:hover {
    filter: grayscale(0);
    opacity: 1;
}

/* --- Features Section --- */
.features {
    padding: 96px 0;
    background-color: var(--gray-50);
}

.features-header {
    text-align: center;
    max-width: 768px;
    margin: 0 auto 64px;
}

.features-header h2 {
    font-size: 36px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 20px;
}

.features-header p {
    font-size: 20px;
    line-height: 1.5;
}

.features-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
}

.feature-card {
    background-color: var(--white);
    padding: 24px;
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    transition: box-shadow 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0px 12px 16px -4px rgba(16, 24, 40, 0.08), 0px 4px 6px -2px rgba(16, 24, 40, 0.03);
}

.feature-card .icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-100, #F9F5FF); /* Fallback */
    border: 1px solid var(--primary-200, #E9D7FE);
    margin-bottom: 20px;
}

.feature-card h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 16px;
    line-height: 1.5;
}

/* --- CTA Section --- */
.cta {
    padding: 96px 0;
    background-color: var(--gray-900);
    color: var(--white);
}

.cta-content {
    text-align: center;
    max-width: 768px;
    margin: 0 auto;
}

.cta h2 {
    font-size: 36px;
    font-weight: 600;
    margin-bottom: 20px;
}

.cta p {
    font-size: 20px;
    line-height: 1.5;
    color: var(--gray-200);
    margin-bottom: 40px;
}

/* --- Footer --- */
.footer {
    padding: 64px 0 48px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    gap: 32px;
}

.footer-logo-column p {
    margin-top: 24px;
    line-height: 1.5;
}

.footer-column h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 16px;
}

.footer-column ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-column a {
    font-weight: 500;
    transition: color 0.2s;
}

.footer-column a:hover {
    color: var(--primary-700);
}

.footer-bottom {
    margin-top: 64px;
    padding-top: 32px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-direction: column;
    gap: 24px;
}

.footer-bottom p {
    font-size: 14px;
}

.social-links {
    display: flex;
    gap: 24px;
}

.social-links a:hover svg {
    opacity: 0.7;
}

/* --- Responsive Design --- */
@media (min-width: 768px) {
    .mobile-menu-btn {
        display: none;
    }
    .nav-links {
        display: block;
    }
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 48px 32px;
    }
    .footer-bottom {
        flex-direction: row;
    }
}

@media (min-width: 1024px) {
    .hero-content {
        text-align: left;
    }
    .hero .container {
        display: flex;
        align-items: center;
        gap: 64px;
    }
    .hero-content {
        flex: 1;
        margin: 0;
    }
    .hero-image {
        flex: 1;
        padding: 0;
    }
    .hero-buttons {
        justify-content: flex-start;
    }
    .features-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .footer-grid {
        grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    }
}

/* === ADMIN PANEL LAYOUT === */

.app-wrapper {
    display: flex;
    position: relative;
}

.sidebar {
    width: var(--sidebar-width, 280px);
    background-color: var(--white);
    border-right: 1px solid var(--gray-200);
    padding: 24px 16px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease-in-out;
    z-index: 1001;
}

.sidebar .logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 24px 8px;
    border-bottom: 1px solid #ECECEC;
    margin-bottom: 24px;
}

.sidebar .logo-section .logo-text {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
    white-space: nowrap;
}

.sidebar-nav {
    flex-grow: 1;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 4px;
    transition: all 0.2s ease-in-out;
}

.sidebar-nav li a:hover {
    background-color: var(--gray-100);
    color: #5B3DF5;
}

.sidebar-nav li a.active {
    background-image: linear-gradient(to right, #5B3DF5, #7C4DFF);
    color: var(--white);
    font-weight: 600;
    box-shadow: 0 8px 20px -5px rgba(91, 61, 245, 0.3);
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--gray-200);
    padding-top: 24px;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width, 280px);
    padding-top: var(--navbar-height, 72px);
    transition: margin-left 0.2s ease-in-out;
}

.main-content .navbar {
    height: var(--navbar-height, 72px);
    background-color: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: var(--sidebar-width, 280px);
    right: 0;
    z-index: 1000;
    transition: left 0.2s ease-in-out;
}

.navbar-left, .navbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.navbar-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-500);
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
}

.navbar-btn:hover {
    background-color: var(--gray-100);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
}

.page-content {
    padding: 32px;
}

/* --- PRODUCTS PAGE SPECIFIC STYLES --- */

/* Card & Table */
.table-card {
    background-color: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    box-shadow: 0px 1px 2px rgba(16, 24, 40, 0.05);
}
.card-header { padding: 20px 24px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.search-wrapper { position: relative; flex-grow: 1; max-width: 400px; }
.search-wrapper.global-search { max-width: 320px; }
.search-wrapper svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--gray-500); }
.search-wrapper input { width: 100%; padding: 10px 14px 10px 40px; border: 1px solid var(--gray-300); border-radius: 8px; font-size: 14px; transition: all 0.2s; box-shadow: 0px 1px 2px rgba(16, 24, 40, 0.05); }
.search-wrapper input:focus { outline: none; border-color: var(--primary-600); box-shadow: 0 0 0 4px #F4EBFF; }
.filter-actions { display: flex; gap: 12px; }
.table-wrapper { overflow: auto; }
.products-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.products-table thead { position: sticky; top: 0; z-index: 10; background-color: var(--gray-50); }
.products-table th, .products-table td { padding: 12px 24px; text-align: left; border-bottom: 1px solid var(--gray-200); white-space: nowrap; }
.products-table th { font-weight: 500; color: var(--gray-600); cursor: pointer; user-select: none; }
.products-table th .sort-icon { opacity: 0.3; margin-left: 4px; }
.products-table th.sorted .sort-icon { opacity: 1; }
.products-table th:hover { background-color: var(--gray-100); }
.products-table tbody tr:hover { background-color: var(--gray-50); }
.products-table .col-checkbox { width: 1%; padding-right: 0; }
.products-table .col-image { width: 60px; }
.product-image-sm { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; background-color: var(--gray-50); border: 1px solid var(--gray-200); }
.status-badge { padding: 2px 8px; border-radius: 16px; font-weight: 500; font-size: 12px; text-align: center; display: inline-block; }
.status-badge.active { background-color: #ECFDF3; color: #027A48; }
.status-badge.inactive { background-color: #F2F4F7; color: #344054; }
.action-buttons { display: flex; gap: 8px; }
.action-btn { background: none; border: none; cursor: pointer; padding: 4px; border-radius: 6px; transition: background-color 0.2s; color: var(--gray-500); }
.action-btn:hover { background-color: var(--gray-200); color: var(--gray-700); }
.card-footer { padding: 16px 24px; display: flex; justify-content: space-between; align-items: center; color: var(--gray-600); font-size: 14px; border-top: 1px solid var(--gray-200); }
.pagination-controls { display: flex; align-items: center; gap: 8px; }
.pagination-controls button { background-color: var(--white); border: 1px solid var(--gray-300); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--gray-700); }
.pagination-controls button:disabled { opacity: 0.5; cursor: not-allowed; }
.pagination-controls button.active { background-color: var(--gray-50); border-color: var(--gray-300); }

/* --- Skeleton Loader --- */
.skeleton-row { display: flex; align-items: center; gap: 24px; padding: 12px 24px; border-bottom: 1px solid var(--gray-200); }
.skeleton { background-color: #f0f0f0; border-radius: 8px; animation: shimmer 1.5s infinite linear; background-image: linear-gradient(90deg, #f0f0f0 0px, #e0e0e0 40px, #f0f0f0 80px); background-size: 600px 100%; }
@keyframes shimmer { 0% { background-position: -300px 0; } 100% { background-position: 300px 0; } }
.skeleton-checkbox { width: 18px; height: 18px; border-radius: 4px; flex-shrink: 0; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: 8px; flex-shrink: 0; }
.skeleton-text { height: 1em; border-radius: 4px; }

/* --- Empty State --- */
.empty-state { text-align: center; padding: 80px 24px; }
.empty-state svg { color: var(--primary-600); margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; color: var(--gray-900); }
.empty-state p { color: var(--gray-600); margin-bottom: 24px; }

/* --- Drawer (Add/Edit Product) --- */
.drawer-overlay { position: fixed; inset: 0; background-color: rgba(16, 24, 40, 0.6); z-index: 1040; opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; }
.drawer-overlay.active { opacity: 1; visibility: visible; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 100%; max-width: 640px; background-color: var(--white); box-shadow: -5px 0 15px rgba(0,0,0,0.1); transform: translateX(100%); transition: transform 0.3s ease-in-out; display: flex; flex-direction: column; }
.drawer-overlay.active .drawer { transform: translateX(0); }
.drawer-header { padding: 24px; border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.drawer-header h2 { margin: 0; font-size: 20px; color: var(--gray-900); }
.close-btn { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--gray-500); line-height: 1; padding: 4px; }
.drawer-body { flex-grow: 1; overflow-y: auto; padding: 32px 24px; }
.drawer-footer { padding: 16px 24px; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 12px; background-color: var(--white); flex-shrink: 0; }
.form-section { margin-bottom: 32px; }
.form-section h4 { font-size: 14px; margin: 0 0 20px 0; font-weight: 600; color: var(--gray-900); }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 14px; color: var(--gray-700); }
.form-group input, .form-group select { width: 100%; padding: 10px 14px; border: 1px solid var(--gray-300); border-radius: 8px; font-size: 14px; transition: all 0.2s; box-shadow: 0px 1px 2px rgba(16, 24, 40, 0.05); }
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--primary-600); box-shadow: 0 0 0 4px #F4EBFF; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.error-message { color: var(--danger-color); font-size: 12px; margin-top: 4px; min-height: 1em; }
input.invalid, select.invalid { border-color: var(--danger-color); }
input.invalid:focus, select.invalid:focus { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1); }
.price-summary { display: flex; gap: 24px; background-color: var(--gray-50); padding: 12px; border-radius: 8px; margin-top: 8px; font-size: 14px; color: var(--gray-600); }
.price-summary span { font-weight: 600; color: var(--gray-900); }

/* Image Upload */
.image-upload-box { border: 2px dashed var(--gray-300); border-radius: 12px; padding: 24px; text-align: center; cursor: pointer; transition: border-color 0.2s, background-color 0.2s; position: relative; }
.image-upload-box:hover, .image-upload-box.dragover { border-color: var(--primary-600); background-color: #F9F5FF; }
.image-upload-placeholder p { margin: 8px 0; color: var(--gray-600); }
.file-browse-link { color: var(--primary-600); font-weight: 600; }
#image-preview-container { position: relative; display: inline-block; }
#image-preview { max-width: 120px; max-height: 120px; border-radius: 8px; }
.remove-image-btn { position: absolute; top: -10px; right: -10px; background-color: var(--gray-700); color: white; border: 2px solid white; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 16px; line-height: 1; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.remove-image-btn:hover { background-color: var(--danger-color); }

/* Status Toggle Switch */
.status-toggle { display: flex; align-items: center; gap: 12px; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }
input:checked + .slider { background-color: var(--success-color); }
input:focus + .slider { box-shadow: 0 0 1px var(--success-color); }
input:checked + .slider:before { transform: translateX(20px); }

/* Spinner */
.spinner { border: 2px solid rgba(255,255,255,0.3); border-top: 2px solid white; border-radius: 50%; width: 16px; height: 16px; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.btn .btn-text.hidden + .spinner { display: block; }

/* Confirmation Modal */
.modal-overlay { position: fixed; inset: 0; background-color: rgba(16, 24, 40, 0.6); z-index: 1050; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; }
.modal-overlay:not(.hidden) { opacity: 1; visibility: visible; }
.modal { background-color: white; border-radius: 14px; width: 100%; max-width: 400px; box-shadow: 0 5px 15px rgba(0,0,0,0.2); transform: scale(0.95); transition: transform 0.3s; }
.modal-overlay:not(.hidden) .modal { transform: scale(1); }
.modal-header { padding: 20px; display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { margin: 0; font-size: 18px; color: var(--gray-900); }
.modal-body { padding: 24px; color: var(--gray-600); }
.modal-footer { padding: 20px; background-color: var(--gray-50); border-bottom-left-radius: 14px; border-bottom-right-radius: 14px; display: flex; justify-content: flex-end; gap: 12px; }

/* Toast Notification */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; }
.toast { background-color: var(--card-color); color: var(--text-primary); padding: 16px; border-radius: 10px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); display: flex; align-items: center; gap: 12px; margin-bottom: 10px; border-left: 4px solid; opacity: 0; transform: translateX(100%); animation: slideIn 0.5s forwards; min-width: 300px; }
.toast.success { border-left-color: var(--success-color); }
.toast.error { border-left-color: var(--danger-color); }
.toast.hiding { animation: slideOut 0.5s forwards; }
@keyframes slideIn { to { opacity: 1; transform: translateX(0); } }
@keyframes slideOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(100%); } }

/* Popover */
.popover { background-color: var(--card-color); border: 1px solid var(--border-color); border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); width: 320px; z-index: 1010; }
.popover-header { padding: 16px; border-bottom: 1px solid var(--border-color); }
.popover-header h4 { margin: 0; font-size: 16px; font-weight: 600; }
.popover-body { padding: 16px; }
.popover-footer { padding: 16px; border-top: 1px solid var(--border-color); display: flex; justify-content: space-between; }
.btn-sm { padding: 8px 12px; font-size: 14px; }

/* Popover */
.popover { background-color: var(--card-color); border: 1px solid var(--border-color); border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); width: 320px; z-index: 1010; }
.popover-header { padding: 16px; border-bottom: 1px solid var(--border-color); }
.popover-header h4 { margin: 0; font-size: 16px; font-weight: 600; }
.popover-body { padding: 16px; }
.popover-footer { padding: 16px; border-top: 1px solid var(--border-color); display: flex; justify-content: space-between; }
.btn-sm { padding: 8px 12px; font-size: 14px; }

/* Popover */
.popover {
    background-color: var(--card-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    width: 320px;
    z-index: 1010;
}
.popover-header { padding: 16px; border-bottom: 1px solid var(--border-color); }
.popover-header h4 { margin: 0; font-size: 16px; font-weight: 600; }
.popover-body { padding: 16px; }
.popover-footer { padding: 16px; border-top: 1px solid var(--border-color); display: flex; justify-content: space-between; }
.btn-sm { padding: 8px 12px; font-size: 14px; }