:root {
    /* Apple/Modern Dark Theme Palette */
    --bg-color: #000000;
    --sidebar-bg: rgba(28, 28, 30, 0.75);
    --card-bg: rgba(44, 44, 46, 0.6);
    --border-color: rgba(255, 255, 255, 0.1);

    --primary-blue: #0A84FF;
    --primary-green: #30D158;
    --primary-red: #FF453A;
    --primary-purple: #BF5AF2;
    --text-primary: #FFFFFF;
    --text-secondary: #8E8E93;

    --glass-blur: blur(20px);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.12);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.24);

    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    background-image: radial-gradient(circle at 50% 0%, #1c1c1e 0%, #000000 70%);
    min-height: 100vh;
    overflow: hidden;
    /* App-like feel */
}

/* Typography & Utilities */
h1,
h2,
h3 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

.fade-in-up {
    animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

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

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

/* Glass Effect */
.glass {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
}

/* Auth Screen */
#login-container {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-box {
    width: 360px;
    padding: 40px;
    border-radius: 24px;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.brand-icon {
    font-size: 40px;
    color: var(--primary-blue);
    margin-bottom: 20px;
}

.login-header h1 {
    font-size: 24px;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 32px;
}

.input-group {
    position: relative;
    margin-bottom: 16px;
}

.input-group i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 14px;
}

.input-group input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    background: rgba(118, 118, 128, 0.24);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 15px;
    transition: all 0.2s;
}

.input-group input:focus {
    outline: none;
    background: rgba(118, 118, 128, 0.35);
    box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.5);
}

.btn-primary {
    width: 100%;
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 14px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s;
    margin-top: 10px;
}

.btn-primary:active {
    transform: scale(0.98);
}

/* Dashboard Layout */
#dashboard-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: 100vh;
}

.sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
}

.sidebar-header {
    margin-bottom: 40px;
    padding: 0 12px;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    color: var(--primary-blue);
}

.nav-links {
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

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

.nav-item.active {
    background: var(--primary-blue);
    color: white;
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
}

.btn-text:hover {
    color: var(--primary-red);
}

/* Main Content */
.main-content {
    overflow-y: auto;
    padding: 32px 40px;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 40px;
}

#page-title {
    font-size: 32px;
    margin-bottom: 4px;
}

.last-update {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background: rgba(255, 69, 58, 0.2);
    border: 1px solid var(--primary-red);
    color: var(--primary-red);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: var(--primary-red);
    color: white;
}

.btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    padding: 24px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 20px;
}

.icon-box {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.icon-box.blue {
    background: rgba(10, 132, 255, 0.15);
    color: var(--primary-blue);
}

.icon-box.purple {
    background: rgba(191, 90, 242, 0.15);
    color: var(--primary-purple);
}

.icon-box.green {
    background: rgba(48, 209, 88, 0.15);
    color: var(--primary-green);
}

.icon-box.red {
    background: rgba(255, 69, 58, 0.15);
    color: var(--primary-red);
}

.stat-info h3 {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-num {
    font-size: 28px;
    font-weight: 700;
}

/* Charts */
.charts-section {
    padding: 32px;
    border-radius: var(--radius-lg);
}

.chart-header h3 {
    font-size: 18px;
    margin-bottom: 24px;
}

.chart-wrapper {
    height: 300px;
    width: 100%;
}

/* Promotions Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
    padding-top: 24px;
}

.product-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

.product-image {
    height: 180px;
    width: 100%;
    background-color: white;
    position: relative;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 20px;
}

.discount-tag {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--primary-red);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}

.discount-tag.hot-deal {
    background: linear-gradient(135deg, #FF453A, #FF9500);
    animation: pulse-glow 2s infinite;
    box-shadow: 0 0 12px rgba(255, 69, 58, 0.6);
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 12px rgba(255, 69, 58, 0.6);
    }

    50% {
        box-shadow: 0 0 20px rgba(255, 149, 0, 0.8);
    }
}

.unavailable-tag {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(142, 142, 147, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.product-image.unavailable {
    opacity: 0.5;
    filter: grayscale(50%);
}

.toolbar .filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.product-details {
    padding: 16px;
}

.product-brand {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 4px;
}

.product-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    height: 40px;
    overflow: hidden;
    margin-bottom: 12px;
}

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.current-price {
    font-size: 18px;
    font-weight: 700;
    color: white;
}

.old-price {
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: line-through;
}

.card-actions {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
}

.action-btn {
    font-size: 13px;
    color: var(--primary-blue);
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
}

/* Settings Form */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.settings-card {
    padding: 24px;
    border-radius: var(--radius-lg);
}

.settings-card .card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    color: var(--primary-blue);
    font-size: 18px;
}

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

.setting-item label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.input-modern {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    padding: 10px 12px;
    border-radius: 8px;
    color: white;
    font-family: inherit;
}

.input-modern:focus {
    border-color: var(--primary-blue);
    outline: none;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

/* Toggle Switch (iOS Style) */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 30px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(120, 120, 128, 0.32);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
    background-color: var(--primary-green);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Time Picker */
.time-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.btn-icon-remove {
    background: none;
    border: none;
    color: var(--primary-red);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-remove:hover {
    background: rgba(255, 69, 58, 0.1);
}

.save-bar {
    position: sticky;
    bottom: 20px;
    display: flex;
    justify-content: flex-end;
    margin-top: 30px;
    align-items: center;
    gap: 15px;
}

.btn-primary.large {
    width: auto;
    padding: 12px 32px;
    font-size: 16px;
    margin-top: 0;
    box-shadow: 0 4px 12px rgba(10, 132, 255, 0.4);
}

#save-status {
    font-size: 14px;
    font-weight: 500;
}

/* Filter Slider */
.slider-container {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 300px;
}

input[type=range] {
    flex: 1;
    accent-color: var(--primary-blue);
}

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

.modal-content {
    width: 700px;
    border-radius: 24px;
    padding: 32px;
    position: relative;
    background: #1c1c1e;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
}

.btn-external {
    display: inline-block;
    margin-top: 20px;
    text-decoration: none;
    color: var(--primary-blue);
    font-weight: 600;
}

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

    .nav-item span,
    .logo span {
        display: none;
    }

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