:root {
    --body-bg: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-white: #ffffff;
    --card-bg: #ffffff;
    --card-alt-bg: #f1f5f9;
    --border: #e2e8f0;
    --border-strong: #d1d5db;
    --border-light: #f1f5f9;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --success-bg: #f0fdf4;
    --success-border: #bbf7d0;
    --error: #dc2626;
    --error-bg: #fef2f2;
    --error-border: #fecaca;
    --header-bg: #0f172a;
    --hero-bg: #0f172a;
    --input-bg: #ffffff;
    --slider-overlay-from: rgba(15,23,42,0.85);
    --slider-overlay-to: rgba(15,23,42,0.4);
    --hover-bg: #f1f5f9;
    --stat-card-bg: #ffffff;
    --stat-card-border: #e2e8f0;
}

body.dark-mode {
    --body-bg: #0f172a;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-white: #ffffff;
    --card-bg: #1e293b;
    --card-alt-bg: #334155;
    --border: #334155;
    --border-strong: #475569;
    --border-light: #1e293b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #1e3a5f;
    --success: #22c55e;
    --success-bg: #14532d;
    --success-border: #166534;
    --error: #ef4444;
    --error-bg: #450a0a;
    --error-border: #7f1d1d;
    --header-bg: #020617;
    --hero-bg: #020617;
    --input-bg: #1e293b;
    --slider-overlay-from: rgba(2,6,23,0.85);
    --slider-overlay-to: rgba(2,6,23,0.4);
    --hover-bg: #334155;
    --stat-card-bg: #1e293b;
    --stat-card-border: #334155;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--body-bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { text-decoration: none; color: var(--primary); transition: color 0.2s ease; }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; height: auto; display: block; }

h1 { font-size: 2.5rem; font-weight: 800; line-height: 1.2; color: var(--text-primary); }
h2 { font-size: 1.75rem; font-weight: 700; line-height: 1.3; color: var(--text-primary); }
h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.4; }

/* Header */
.nav-container {
    background: var(--header-bg);
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 12px rgba(15,23,42,0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-brand {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-white);
    letter-spacing: -0.5px;
}

.nav-brand span { color: #2563eb; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
}

.nav-links a {
    color: rgba(255,255,255,0.85);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-white);
    border-bottom-color: #2563eb;
}

.nav-links .btn-logout {
    background: rgba(255,255,255,0.1);
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--text-white);
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.nav-links .btn-logout:hover {
    background: #ef4444;
    border-color: #ef4444;
}

/* Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
    width: 100%;
}

/* Hero Slider */
.hero-slider {
    position: relative;
    width: 100%;
    height: 480px;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 3rem;
    background: var(--header-bg);
}

.hero-slide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    z-index: 1;
}

.hero-slide.active {
    opacity: 1;
    z-index: 2;
}

.hero-slide .slide-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(15,23,42,0.85) 0%, rgba(15,23,42,0.4) 100%);
    z-index: 1;
}

.hero-slide .slide-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: var(--text-white);
    padding: 2rem;
    max-width: 700px;
}

.hero-slide .slide-content h1 {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-white);
    margin-bottom: 0.75rem;
}

.hero-slide .slide-content h2 {
    font-size: 1.2rem;
    font-weight: 400;
    color: rgba(255,255,255,0.8);
    margin-bottom: 1.5rem;
}

.btn-primary {
    display: inline-block;
    background: var(--primary);
    color: var(--text-white);
    padding: 0.85rem 2rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37,99,235,0.35);
    color: var(--text-white);
}

.slider-dots {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    z-index: 3;
}

.slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.slider-dot.active {
    background: var(--card-bg);
    width: 28px;
    border-radius: 5px;
}

/* Section Titles */
.section-title { margin-bottom: 2rem; }
.section-title h1 { font-size: 2rem; margin-bottom: 0.25rem; }
.section-title h2 { font-size: 1rem; font-weight: 400; color: var(--text-secondary); }

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.75rem;
}

@media (max-width: 1100px) {
    .product-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); }
    .hero-slider { height: 320px; }
    .hero-slide .slide-content h1 { font-size: 2rem; }
    .nav-container { flex-wrap: wrap; height: auto; padding: 1rem 0; }
    .nav-links { flex-wrap: wrap; gap: 0.75rem; }
}

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

/* Product Card */
.product-card {
    background: var(--card-bg);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(15,23,42,0.12);
}

.product-card .card-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    background: #e2e8f0;
}

.product-card .card-body {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card .card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.product-card .card-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.product-card .card-type {
    font-size: 0.75rem;
    font-weight: 600;
    color: #2563eb;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.product-card .card-price {
    font-size: 1.3rem;
    font-weight: 800;
    color: #2563eb;
    margin-top: auto;
    margin-bottom: 0.75rem;
}

.product-card .card-action {
    display: inline-block;
    text-align: center;
    padding: 0.6rem 1rem;
    background: var(--card-alt-bg);
    color: var(--text-primary);
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.product-card .card-action:hover {
    background: var(--primary);
    color: var(--text-white);
}

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    position: relative;
}

.auth-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(15,23,42,0.5);
}

.auth-container {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 440px;
    padding: 2rem;
}

.auth-card {
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.auth-card h1 {
    color: var(--text-white);
    font-size: 1.75rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-card h2 {
    color: rgba(255,255,255,0.6);
    font-size: 0.95rem;
    font-weight: 400;
    text-align: center;
    margin-bottom: 2rem;
}

.form-group { margin-bottom: 1.25rem; }

.form-group label {
    display: block;
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    color: var(--text-white);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s ease;
    outline: none;
}

.form-group input::placeholder { color: rgba(255,255,255,0.4); }

.form-group input:focus,
.form-group textarea:focus {
    border-color: #2563eb;
    background: rgba(255,255,255,0.15);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.2);
}

.form-group textarea { min-height: 100px; resize: vertical; }
.form-group input[type="file"] { padding: 0.5rem; }

.btn-submit {
    width: 100%;
    padding: 0.85rem;
    background: var(--primary);
    color: var(--text-white);
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
}

.btn-submit:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37,99,235,0.35);
}

.btn-auth {
    padding: 0.75rem 2rem;
    white-space: nowrap;
    font-size: 0.9rem;
    width: auto;
}

.auth-link {
    text-align: center;
    margin-top: 1.25rem;
    color: rgba(255,255,255,0.6);
    font-size: 0.9rem;
}

.auth-link a { color: #60a5fa; font-weight: 600; }
.auth-link a:hover { color: #93c5fd; }

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-error {
    background: rgba(239,68,68,0.2);
    border: 1px solid rgba(239,68,68,0.3);
    color: #fca5a5;
}

.alert-success {
    background: rgba(34,197,94,0.2);
    border: 1px solid rgba(34,197,94,0.3);
    color: #86efac;
}

.admin-content .alert-error {
    background: var(--error-bg);
    border-color: #fecaca;
    color: #dc2626;
}

.admin-content .alert-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #16a34a;
}

/* Admin Layout */
.admin-layout { display: flex; min-height: calc(100vh - 64px); }

.admin-sidebar {
    width: 260px;
    background: var(--header-bg);
    padding: 2rem 1.5rem;
    flex-shrink: 0;
}

.admin-sidebar h2 {
    color: var(--text-white);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1.5rem;
    opacity: 0.6;
}

.admin-sidebar a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    color: rgba(255,255,255,0.7);
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
}

.admin-sidebar a:hover,
.admin-sidebar a.active {
    background: rgba(37,99,235,0.2);
    color: var(--text-white);
}

.admin-content {
    flex: 1;
    padding: 2rem;
    background: var(--body-bg);
}

.page-wrap {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.admin-content h1 { font-size: 1.75rem; margin-bottom: 0.25rem; }
.admin-content .page-subtitle { color: var(--text-secondary); margin-bottom: 2rem; font-size: 0.95rem; }

/* Metrics */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

.metric-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.metric-card .metric-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.metric-card .metric-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
}

/* Table */
.table-container {
    background: var(--card-bg);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.table-container table { width: 100%; border-collapse: collapse; }

.table-container th {
    text-align: left;
    padding: 1rem 1.25rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    background: var(--body-bg);
    border-bottom: 2px solid var(--border);
}

.table-container td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
    vertical-align: middle;
}

.table-container tr:last-child td { border-bottom: none; }
.table-container tr:hover td { background: var(--body-bg); }

.table-container .table-img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    background: #e2e8f0;
}

/* Action buttons */
.action-group { display: flex; gap: 0.5rem; }

.btn-edit {
    padding: 0.4rem 1rem;
    background: var(--card-alt-bg);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-edit:hover { background: var(--primary); color: var(--text-white); }

.btn-delete {
    padding: 0.4rem 1rem;
    background: var(--error-bg);
    color: #dc2626;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-delete:hover { background: #dc2626; color: var(--text-white); }

.btn-add {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    background: var(--primary);
    color: var(--text-white);
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    margin-bottom: 1.5rem;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.btn-add:hover {
    background: var(--primary-hover);
    color: var(--text-white);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37,99,235,0.3);
}

/* User Dashboard */
.user-greeting {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    padding: 2rem;
    border-radius: 16px;
    color: var(--text-white);
    margin-bottom: 2rem;
}

.user-greeting h1 { color: var(--text-white); font-size: 1.75rem; margin-bottom: 0.25rem; }
.user-greeting p { color: rgba(255,255,255,0.7); font-size: 0.95rem; }

/* Footer */
.site-footer {
    background: var(--header-bg);
    color: rgba(255,255,255,0.6);
    text-align: center;
    padding: 1.5rem 2rem;
    font-size: 0.85rem;
    margin-top: auto;
}

.site-footer strong { color: var(--text-white); }

/* Empty state */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-secondary); }
.empty-state p { font-size: 1.1rem; margin-bottom: 1rem; }

/* Product form */
.form-card { max-width: 640px; }
.form-card .form-group select option { background: var(--header-bg); color: var(--text-white); }

.admin-content .form-group label { color: var(--text-secondary); }
.admin-content .form-group input,
.admin-content .form-group textarea,
.admin-content .form-group select {
    background: var(--card-bg);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
}
.admin-content .form-group input:focus,
.admin-content .form-group textarea:focus {
    border-color: var(--primary);
    background: var(--card-bg);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.admin-content .form-group input::placeholder { color: var(--text-muted); }

/* Chat / Messages */
.chat-layout { display: flex; gap: 1.5rem; min-height: 500px; }

.chat-sidebar {
    width: 300px;
    flex-shrink: 0;
    background: var(--card-bg);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    overflow-y: auto;
    max-height: 600px;
}

.chat-sidebar h3 {
    padding: 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.chat-conversation {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    overflow: hidden;
}

.chat-conversation .chat-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    font-weight: 700;
    font-size: 1rem;
}

.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    max-height: 400px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-bubble {
    max-width: 75%;
    padding: 0.85rem 1.25rem;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.5;
    position: relative;
}

.chat-bubble.sent {
    align-self: flex-end;
    background: var(--primary);
    color: var(--text-white);
    border-bottom-right-radius: 4px;
}

.chat-bubble.received {
    align-self: flex-start;
    background: var(--card-alt-bg);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.chat-bubble .bubble-meta {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 0.4rem;
}

.chat-bubble.sent .bubble-meta { text-align: right; }

.chat-input-area {
    padding: 1rem 1.5rem;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: 0.75rem;
}

.chat-input-area input {
    flex: 1;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease;
}

.chat-input-area input:focus { border-color: #2563eb; }

.chat-input-area button {
    padding: 0.7rem 1.5rem;
    background: var(--primary);
    color: var(--text-white);
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s ease;
    font-family: inherit;
}

.chat-input-area button:hover { background: var(--primary-hover); }

.chat-thread-item {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background 0.2s ease;
}

.chat-thread-item:hover { background: var(--body-bg); }

.chat-thread-item.active {
    background: #eff6ff;
    border-left: 3px solid #2563eb;
}

.chat-thread-item .thread-sender {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-thread-item .thread-preview {
    font-size: 0.82rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-thread-item .thread-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.chat-thread-item .unread-badge {
    display: inline-block;
    background: var(--primary);
    color: var(--text-white);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 10px;
    margin-left: 0.5rem;
}

.chat-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    min-height: 200px;
    font-size: 0.95rem;
}

.new-message-form { margin-bottom: 1.5rem; }
.new-message-form textarea { min-height: 120px; }

@media (max-width: 768px) {
    .chat-layout { flex-direction: column; }
    .chat-sidebar { width: 100%; max-height: none; }
    .chat-bubble { max-width: 90%; }
}

.upload-zone {
    border: 2px dashed var(--border-strong);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all .3s;
    background: var(--card-alt-bg);
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--primary); background: var(--primary-light); }
.upload-placeholder p { color: var(--text-secondary); margin-bottom: 4px; }
.upload-placeholder .hint { font-size: .82rem; color: var(--text-muted); }

.image-preview { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.preview-item { position: relative; width: 150px; height: 150px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--card-alt-bg); }
.preview-item img { width: 100%; height: 100%; object-fit: cover; }
.preview-item .crop-btn { position: absolute; bottom: 4px; left: 4px; right: 4px; padding: 4px; font-size: .75rem; background: rgba(0,0,0,.6); color: #fff; border: none; border-radius: 4px; cursor: pointer; }
.preview-item .remove-btn { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; background: rgba(239,68,68,.9); color: #fff; border: none; border-radius: 50%; cursor: pointer; font-size: .8rem; display: flex; align-items: center; justify-content: center; }

.crop-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(15,23,42,.7); display: flex; align-items: center; justify-content: center; z-index: 2000; }
.crop-modal { background: var(--card-bg); border-radius: 16px; padding: 24px; max-width: 90vw; max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.crop-modal h3 { margin-bottom: 16px; font-size: 1.1rem; color: var(--text-primary); }
.crop-container { position: relative; display: inline-block; }
.crop-container img { max-width: 600px; max-height: 400px; display: block; }
.crop-box { position: absolute; border: 2px dashed #fff; background: rgba(37,99,235,.15); cursor: move; box-shadow: 0 0 0 9999px rgba(0,0,0,.5); }
.crop-handle { position: absolute; width: 12px; height: 12px; background: #fff; border: 2px solid #2563eb; border-radius: 50%; }
.crop-handle.nw { top: -6px; left: -6px; cursor: nw-resize; }
.crop-handle.ne { top: -6px; right: -6px; cursor: ne-resize; }
.crop-handle.sw { bottom: -6px; left: -6px; cursor: sw-resize; }
.crop-handle.se { bottom: -6px; right: -6px; cursor: se-resize; }
.crop-actions { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }

.level-badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.level-1 { background: #fee2e2; color: #dc2626; }
.level-2 { background: #fef3c7; color: #d97706; }
.level-3 { background: #dbeafe; color: #2563eb; }
.level-4 { background: #d1fae5; color: #059669; }
.level-5 { background: var(--card-alt-bg); color: var(--text-secondary); }
.level-6 { background: #f3f4f6; color: #9ca3af; }
.level-7 { background: #ede9fe; color: #7c3aed; }

/* ── Dark Mode ── */
body.dark-mode .nav-container { background: var(--header-bg); }
body.dark-mode .hero-slider { background: var(--hero-bg); }
body.dark-mode .hero-slide .slide-overlay { background: linear-gradient(135deg, var(--slider-overlay-from) 0%, var(--slider-overlay-to) 100%); }
body.dark-mode .nav-links a { color: rgba(255,255,255,0.7); }
body.dark-mode .nav-links a:hover,
body.dark-mode .nav-links a.active { color: #fff; }
body.dark-mode .nav-links .btn-logout { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.1); }
body.dark-mode .stat-card { background: var(--stat-card-bg); border-color: var(--stat-card-border); }
body.dark-mode .stat-card .num { color: var(--text-white); }
body.dark-mode .cp-card { background: var(--card-bg); border-color: var(--border); }
body.dark-mode .cp-card h3 { color: var(--text-primary); }
body.dark-mode .tbl-wrap table th { background: var(--card-alt-bg); color: var(--text-secondary); }
body.dark-mode .tbl-wrap table td { border-bottom-color: var(--border); }
body.dark-mode .tbl-wrap table tr:hover td { background: var(--hover-bg); }
body.dark-mode input, body.dark-mode textarea, body.dark-mode select {
    background: var(--input-bg);
    color: var(--text-primary);
    border-color: var(--border-strong);
}
body.dark-mode input:focus, body.dark-mode textarea:focus, body.dark-mode select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}
body.dark-mode .alert-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
body.dark-mode .alert-error { background: var(--error-bg); border-color: var(--error-border); color: var(--error); }
body.dark-mode .form-card { background: var(--card-bg); border-color: var(--border); }
body.dark-mode .page-subtitle { color: var(--text-secondary); }
body.dark-mode .chat-sidebar { background: var(--card-bg); border-color: var(--border); }
body.dark-mode .chat-thread-item { border-bottom-color: var(--border); }
body.dark-mode .chat-thread-item:hover { background: var(--hover-bg); }
body.dark-mode .chat-thread-item.active { background: var(--hover-bg); }
body.dark-mode .chat-header { border-bottom-color: var(--border); }
body.dark-mode .chat-messages { background: var(--body-bg); }
body.dark-mode .chat-bubble.sent { background: var(--primary); color: #fff; }
body.dark-mode .chat-bubble.received { background: var(--card-alt-bg); color: var(--text-primary); }
body.dark-mode .chat-input-area { border-top-color: var(--border); }
body.dark-mode .chat-input-area input { background: var(--input-bg); color: var(--text-primary); border-color: var(--border-strong); }
body.dark-mode .announcement-card { background: var(--card-alt-bg); border-color: var(--border); }
body.dark-mode .badge-on { background: #14532d; color: #22c55e; }
body.dark-mode .badge-off { background: #450a0a; color: #ef4444; }
body.dark-mode .product-card { background: var(--card-bg); border-color: var(--border); }
body.dark-mode .product-card:hover { border-color: var(--primary); box-shadow: 0 4px 16px rgba(59,130,246,0.15); }
body.dark-mode .upload-zone { background: var(--card-alt-bg); border-color: var(--border-strong); }
body.dark-mode .upload-zone:hover, body.dark-mode .upload-zone.drag-over { border-color: var(--primary); background: var(--primary-light); }
body.dark-mode .upload-placeholder p { color: var(--text-secondary); }
body.dark-mode .upload-placeholder .hint { color: var(--text-muted); }
body.dark-mode .crop-overlay { background: rgba(0,0,0,.8); }
body.dark-mode .crop-modal { background: var(--card-bg); }
body.dark-mode .crop-modal h3 { color: var(--text-primary); }
body.dark-mode .crop-box { border-color: var(--primary); background: rgba(59,130,246,.15); }
body.dark-mode .crop-handle { background: var(--primary); }
body.dark-mode .preview-item { background: var(--card-alt-bg); border-color: var(--border); }
body.dark-mode .level-badge.level-1 { background: #450a0a; color: #fca5a5; }
body.dark-mode .level-badge.level-2 { background: #451a03; color: #fbbf24; }
body.dark-mode .level-badge.level-3 { background: #1e3a5f; color: #93c5fd; }
body.dark-mode .level-badge.level-4 { background: #14532d; color: #86efac; }
body.dark-mode .level-badge.level-6 { background: #1e293b; color: #94a3b8; }
body.dark-mode .level-badge.level-7 { background: #3b0764; color: #c4b5fd; }
body.dark-mode .btn-sm-g { background: var(--card-alt-bg); color: var(--text-primary); border-color: var(--border); }
body.dark-mode .btn-sm-d { background: #450a0a; color: #fca5a5; }
body.dark-mode .btn-sm-p { background: var(--primary); color: #fff; }
body.dark-mode .tbl-wrap table tr:hover { background: transparent; }
body.dark-mode .chat-empty { color: var(--text-muted); }
body.dark-mode .search-user-link { color: var(--text-primary); border-bottom-color: var(--border) !important; }
body.dark-mode .search-user-link:hover { background: var(--hover-bg); }
body.dark-mode .search-user-link span:last-child { color: var(--primary); }
body.dark-mode .admin-content { color: var(--text-primary); }
body.dark-mode .subtitle { color: var(--text-secondary); }
body.dark-mode .cp-sidebar { background: var(--card-bg); border-color: var(--border); }
body.dark-mode .cp-sidebar a { color: var(--text-secondary); }
body.dark-mode .cp-sidebar a:hover,
body.dark-mode .cp-sidebar a.active { background: var(--hover-bg); color: var(--text-primary); }
body.dark-mode .cp-sidebar a i { color: var(--primary); }
body.dark-mode .dark-mode-btn { opacity: 0.9; }
body.dark-mode .admin-content .form-group label { color: var(--text-secondary); }
body.dark-mode .admin-content .form-group input,
body.dark-mode .admin-content .form-group textarea,
body.dark-mode .admin-content .form-group select { color: var(--text-primary); border-color: var(--border-strong); }
body.dark-mode .admin-content .form-group input:focus,
body.dark-mode .admin-content .form-group textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.2); }
body.dark-mode .admin-content .form-group input::placeholder { color: var(--text-muted); }
body.dark-mode .admin-content .inline-form input,
body.dark-mode .admin-content .inline-form select { color: var(--text-primary); border-color: var(--border-strong); }

/* ── Wishlist Heart ── */
.wishlist-btn {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    transition: transform 0.2s, color 0.2s;
    color: #1e293b;
    line-height: 1;
}
.wishlist-btn:hover {
    transform: scale(1.2);
    color: #ef4444;
}
.wishlist-btn.wishlist-active {
    color: #ef4444;
}
.wishlist-btn.wishlist-active:hover {
    color: #dc2626;
}

.dark-mode-btn {
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    opacity: 0.7;
}
.dark-mode-btn:hover { opacity: 1; background: rgba(255,255,255,0.1); }
