:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.4);

    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-overlay: rgba(15, 23, 42, 0.85);

    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    --border-color: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.1);

    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    --container-width: 1440px;
    --header-height: 80px;
    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] {
    --primary: #4f46e5;
    --primary-hover: #4338ca;

    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-overlay: rgba(255, 255, 255, 0.9);

    --text-main: #0f172a;
    --text-muted: #64748b;

    --border-color: rgba(0, 0, 0, 0.1);
    --glass-border: rgba(0, 0, 0, 0.05);
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    background-image: radial-gradient(circle at top right, rgba(99, 102, 241, 0.15), transparent 40%),
        radial-gradient(circle at bottom left, rgba(168, 85, 247, 0.1), transparent 40%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: 'Tajawal', 'Inter', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main,
#main-content {
    flex: 1;
    width: 100%;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

button {
    font-family: inherit;
}

.container {
    max-width: var(--container-width);
    width: 92%;
    margin: 0 auto;
    padding: 0 20px;
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.35);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.card-glass {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    transition: var(--transition);
    font-size: 0.95rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

header {
    height: var(--header-height);
    background: var(--bg-overlay);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-menu {
    display: flex;
    gap: 25px;
}

.nav-menu a {
    color: var(--text-muted);
    font-weight: 500;
    position: relative;
    padding: 5px 0;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--primary);
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}

.nav-menu a:hover::after {
    width: 100%;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.balance-pill {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.theme-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    transition: 0.2s;
}

.theme-btn:hover {
    color: var(--text-main);
    transform: rotate(15deg);
}

.burger-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
}

.hero-section {
    padding: 60px 0 40px;
    text-align: center;
}

.hero-title {
    font-size: 2.5rem;
    margin-bottom: 15px;
    line-height: 1.2;
}

.hero-text {
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    padding-bottom: 80px;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    transition: var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-glow);
}

.product-img-wrapper {
    position: relative;
    height: 180px;
    background: #000;
    overflow: hidden;
}

.product-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-card:hover .product-img-wrapper img {
    transform: scale(1.1);
}

.product-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
}

.product-meta {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
}

.price {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
}

.info-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    font-size: 0.9rem;
    z-index: 2;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.info-btn:hover {
    background: var(--primary);
    transform: scale(1.1);
}

.site-footer {
    margin-top: auto;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 60px 0 20px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-col h4 {
    color: var(--text-main);
    margin-bottom: 15px;
    font-weight: 600;
}

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col a {
    color: var(--text-muted);
}

.footer-col a:hover {
    color: var(--primary);
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-links a {
    width: 40px;
    height: 40px;
    background: var(--bg-main);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--border-color);
}

.social-links a:hover {
    background: var(--primary);
    color: #fff;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background: var(--bg-card);
    padding: 80px 30px;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.mobile-menu.active {
    transform: translateX(0);
}

.mobile-menu ul {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.mobile-menu a {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-menu a:hover {
    color: var(--primary);
}

@media (max-width: 768px) {
    .burger-btn {
        display: block;
    }

    /* Maximize horizontal space on mobile */
    .container {
        width: 100%;
        padding: 0 10px;
        /* Reduced from 20px */
        max-width: 100%;
    }

    .card-glass {
        padding: 15px;
        /* Reduced from 24px */
        border-radius: 12px;
        /* Slightly smaller radius */
    }

    .nav-center,
    .nav-auth {
        display: none;
    }

    .nav-actions .currency-dropdown,
    .nav-actions>.theme-btn {
        display: none !important;
    }

    .mobile-menu {
        display: block;
    }

    .hero-title {
        font-size: 2rem;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .product-img-wrapper {
        height: 140px;
    }

    .product-content {
        padding: 15px;
    }

    .price {
        font-size: 1rem;
    }

    .bottom-burger-menu {
        display: flex;
        justify-content: space-around;
        align-items: center;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-card);
        border-top: 1px solid var(--border-color);
        padding: 8px 0 max(8px, env(safe-area-inset-bottom));
        z-index: 999;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
        backdrop-filter: blur(10px);
    }

    .burger-menu-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 8px 16px;
        text-decoration: none;
        color: var(--text-muted);
        transition: all 0.2s;
        flex: 1;
        max-width: 120px;
    }

    .burger-menu-item i {
        font-size: 1.4rem;
        transition: all 0.2s;
    }

    .burger-menu-item span {
        font-size: 0.7rem;
        font-weight: 500;
        transition: all 0.2s;
    }

    .burger-menu-item.active {
        color: var(--primary);
    }

    .burger-menu-item.active i {
        transform: translateY(-2px);
    }

    .burger-menu-item:hover {
        color: var(--primary);
    }

    body {
        padding-bottom: 70px;
    }
}

@media (min-width: 769px) {
    .bottom-burger-menu {
        display: none !important;
    }
}

.sidebar,
.admin-layout,
.admin-table {}

.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: #111827;
    border-right: 1px solid var(--border-color);
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: width 0.3s;
}

.admin-layout.collapsed .sidebar {
    width: 80px;
}

.admin-layout.collapsed .content {
    margin-left: 80px;
    width: calc(100% - 80px);
}

.content {
    flex: 1;
    margin-left: 260px;
    width: calc(100% - 260px);
    padding: 30px;
}

.sidebar-header {
    padding: 20px;
    color: var(--primary);
    font-weight: 800;
    font-size: 1.5rem;
    display: flex;
    justify-content: space-between;
}

.sidebar-nav {
    padding: 20px 10px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px;
    color: #9ca3af;
    border-radius: 8px;
    margin-bottom: 5px;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: var(--primary);
    color: #fff;
}

.sidebar-nav i {
    width: 25px;
    margin-right: 10px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .content {
        margin-left: 0;
        width: 100%;
    }

    .admin-layout.collapsed .sidebar {
        transform: translateX(0);
        width: 260px;
    }
}

.filter-glass {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.data-table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.data-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    background: var(--bg-card);
    min-width: 800px;
}

.data-table th {
    background: rgba(15, 23, 42, 0.6);
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-main);
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.status-pill {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.status-pending {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.status-failed {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.page-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.user-dropdown {
    position: relative;
    display: inline-block;
}

.user-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.user-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 110%;
    margin-top: 0;
    background: var(--bg-card);
    min-width: 220px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    z-index: 2000;
    overflow: hidden;
    animation: fadeIn 0.2s ease;
}

.user-dropdown-content.show {
    display: block;
}

.user-dropdown-content a {
    display: block;
    padding: 12px 20px;
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
}

.user-dropdown-content a:last-child {
    border-bottom: none;
}

.user-dropdown-content a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary);
    padding-left: 25px;
}

.auth-wrapper {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #a855f7);
}

.auth-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 10px;
    text-align: center;
}

.auth-subtitle {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 30px;
}

@media (max-width: 768px) {

    .nav-center {
        display: none;
    }

    .nav-auth {
        display: flex;
    }

    .nav-auth .btn {
        display: none;
    }

    .user-dropdown {
        display: none !important;
    }

    .balance-pill {
        display: flex !important;
        margin-right: 10px;
    }

    .burger-btn {
        display: block;
    }
}
}

.user-dropdown-content.show {
    display: block;
}

.user-dropdown-content a {
    color: var(--text-main);
    padding: 12px 20px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.user-dropdown-content a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary);
}

.user-dropdown-content hr {
    margin: 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

[data-theme="light"] .category-title,
[data-theme="light"] .category-card h3 {
    color: #111827 !important;
}

[data-theme="light"] table th {
    color: #4b5563;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 60px;
}

/* Responsive Table Styles (Card View on Mobile) */
@media (max-width: 768px) {
    .data-table-wrapper {
        overflow-x: visible;
        border: none;
    }

    .data-table {
        min-width: 100%;
        display: block;
        background: transparent;
    }

    .data-table thead {
        display: none;
    }

    .data-table tbody {
        display: block;
        width: 100%;
    }

    .data-table tr {
        display: block;
        width: 100%;
        margin-bottom: 15px;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        padding: 5px 0;
        box-shadow: var(--shadow-md);
    }

    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        padding: 12px 15px;
        border-bottom: 1px solid var(--border-color);
        font-size: 0.9rem;
        width: 100%;
    }

    .data-table td:last-child {
        border-bottom: none;
    }

    /* Label Styling */
    .data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        font-size: 0.8rem;
        text-transform: uppercase;
        flex-shrink: 0;
    }

    .data-table td>span,
    .data-table td>div {
        text-align: end;
        max-width: 60%;
    }
}