/* =============================================
   SJ88 License — Candy Pop Design System
   Based on mockup #18-candy-pop
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Prompt:wght@400;600&display=swap');

/* ───── Reset & Base ───── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Nunito', 'Prompt', sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-attachment: fixed;
    color: #2d1b69;
    font-size: 14px;
    line-height: 1.5;
}

a { color: #764ba2; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ───── Layout ───── */
.layout { display: flex; min-height: 100vh; }

/* ───── Sidebar ───── */
.sidebar {
    width: 250px;
    background: rgba(255, 255, 255, .12);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, .2);
    padding: 20px 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.logo {
    padding: 0 20px 24px;
    font-size: 22px;
    font-weight: 900;
    color: #fff;
    text-shadow: 2px 2px 0 rgba(0, 0, 0, .1);
}

.logo span {
    font-size: 11px;
    display: block;
    font-weight: 400;
    color: rgba(255, 255, 255, .6);
    margin-top: 2px;
    text-shadow: none;
}

.nav-item {
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, .6);
    cursor: pointer;
    transition: .2s;
    font-size: 13px;
    font-weight: 600;
    border-radius: 0 24px 24px 0;
    margin-right: 12px;
    text-decoration: none;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, .1);
    text-decoration: none;
}

.nav-item.active {
    color: #764ba2;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
}

.nav-item.active:hover { text-decoration: none; }

/* ───── Main Content ───── */
.main {
    flex: 1;
    padding: 28px;
    margin-left: 250px;
    min-height: 100vh;
}

.header h1 {
    font-size: 24px;
    font-weight: 900;
    margin-bottom: 24px;
    color: #fff;
}

/* ───── Stats Grid ───── */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 20px;
    padding: 20px;
    transition: .3s;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
}

.stat-emoji { font-size: 32px; margin-bottom: 6px; }

.stat-label {
    font-size: 11px;
    color: #9b8fa0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.stat-value {
    font-size: 30px;
    font-weight: 900;
    margin-top: 4px;
}

.stat-sub {
    font-size: 10px;
    color: #c4b5cf;
    margin-top: 4px;
    font-weight: 600;
}

.c1 { color: #667eea; }
.c2 { color: #f093fb; }
.c3 { color: #764ba2; }
.c4 { color: #ff6b6b; }
.c5 { color: #2ecc71; }

/* ───── Panels ───── */
.panel {
    background: #fff;
    border-radius: 20px;
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
}

.panel-header {
    padding: 14px 20px;
    border-bottom: 1px solid #f0e4f3;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.panel-title {
    font-size: 14px;
    font-weight: 800;
    color: #764ba2;
}

.panel-body { padding: 20px; }

/* ───── Buttons ───── */
.btn {
    padding: 8px 18px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    transition: .2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
}

.btn-candy {
    background: linear-gradient(135deg, #667eea, #764ba2, #f093fb);
    color: #fff;
    box-shadow: 0 4px 12px rgba(118, 75, 162, .3);
}

.btn-candy:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(118, 75, 162, .4);
}

.btn-outline {
    background: #fff;
    border: 2px solid #f0e4f3;
    color: #764ba2;
}

.btn-outline:hover { border-color: #764ba2; }

.btn-sm { padding: 5px 12px; font-size: 11px; }

.btn-danger {
    background: linear-gradient(135deg, #e74c3c, #ff6b6b);
    color: #fff;
    box-shadow: 0 4px 12px rgba(231, 76, 60, .3);
}

.btn-success {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: #fff;
}

.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* Small action buttons */
.qbtn {
    padding: 3px 10px;
    border-radius: 12px;
    border: 2px solid #f0e4f3;
    background: #fff;
    color: #764ba2;
    font-size: 10px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    transition: .2s;
}

.qbtn:hover {
    border-color: #764ba2;
    background: #764ba2;
    color: #fff;
}

/* ───── Tables ───── */
table { width: 100%; border-collapse: collapse; }

th {
    text-align: left;
    padding: 10px 20px;
    font-size: 10px;
    color: #c4b5cf;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 700;
    white-space: nowrap;
}

td {
    padding: 10px 20px;
    font-size: 12px;
    border-bottom: 1px solid #f8f0fb;
    font-weight: 600;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #fef7ff; }

.td-mono {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #667eea;
}

/* ───── Badges ───── */
.badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    display: inline-block;
    white-space: nowrap;
}

.b-on { background: #e8fae8; color: #27ae60; }
.b-off { background: #ffe0e0; color: #e74c3c; }
.b-free { background: #e0ecff; color: #667eea; }
.b-pro { background: #f0e4f3; color: #764ba2; }
.b-vip { background: #ffe8f0; color: #e91e90; }
.b-warn { background: #fff3e0; color: #f39c12; }
.b-info { background: #e0f0ff; color: #3498db; }

/* ───── Dots (Online Status) ───── */
.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}

.dot.on { background: #2ecc71; box-shadow: 0 0 6px rgba(46, 204, 113, .4); }
.dot.off { background: #ddd; }

/* ───── Coupon Code ───── */
.coupon-code {
    font-family: 'Courier New', monospace;
    color: #764ba2;
    font-weight: 800;
    font-size: 12px;
    background: #f0e4f3;
    padding: 2px 8px;
    border-radius: 10px;
    cursor: pointer;
}

.coupon-code:hover { background: #e0d0e8; }

/* ───── Progress Bar ───── */
.pbar {
    height: 5px;
    background: #f0e4f3;
    border-radius: 3px;
    width: 70px;
    margin-top: 3px;
}

.pfill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #667eea, #f093fb);
}

/* ───── Grid Layouts ───── */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.three-col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
}

/* ───── Forms ───── */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #764ba2;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 16px;
    border: 2px solid #f0e4f3;
    border-radius: 14px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #2d1b69;
    outline: none;
    transition: .2s;
    background: #fff;
}

.form-control:focus {
    border-color: #764ba2;
    box-shadow: 0 0 0 3px rgba(118, 75, 162, .1);
}

.form-control::placeholder { color: #c4b5cf; }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%23764ba2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

/* ───── Modal ───── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(45, 27, 105, .4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show { display: flex; }

.modal {
    background: #fff;
    border-radius: 24px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .2);
    animation: modal-in .3s ease;
}

@keyframes modal-in {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #f0e4f3;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 16px;
    font-weight: 800;
    color: #764ba2;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f0e4f3;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #764ba2;
    transition: .2s;
}

.modal-close:hover { background: #764ba2; color: #fff; }

.modal-body { padding: 24px; }

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #f0e4f3;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ───── Toast Notifications ───── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 12px 20px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .15);
    animation: toast-in .3s ease, toast-out .3s ease 3s forwards;
    max-width: 400px;
}

@keyframes toast-in { from { transform: translateX(100px); opacity: 0; } }
@keyframes toast-out { to { transform: translateX(100px); opacity: 0; } }

.toast-success { background: linear-gradient(135deg, #27ae60, #2ecc71); }
.toast-error { background: linear-gradient(135deg, #e74c3c, #ff6b6b); }
.toast-info { background: linear-gradient(135deg, #667eea, #764ba2); }

/* ───── Flash Messages ───── */
.flash {
    padding: 12px 20px;
    border-radius: 14px;
    margin-bottom: 16px;
    font-weight: 600;
    font-size: 13px;
}

.flash-success { background: #e8fae8; color: #27ae60; }
.flash-error { background: #ffe0e0; color: #e74c3c; }
.flash-info { background: #e0ecff; color: #667eea; }

/* ───── Search & Filters ───── */
.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.search-input {
    padding: 8px 16px;
    border: 2px solid rgba(255, 255, 255, .3);
    border-radius: 20px;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    outline: none;
    width: 280px;
    transition: .2s;
    backdrop-filter: blur(8px);
}

.search-input::placeholder { color: rgba(255, 255, 255, .5); }
.search-input:focus { border-color: #fff; background: rgba(255, 255, 255, .25); }

.filter-select {
    padding: 8px 16px;
    border: 2px solid rgba(255, 255, 255, .3);
    border-radius: 20px;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    outline: none;
    backdrop-filter: blur(8px);
    cursor: pointer;
}

.filter-select option { color: #2d1b69; background: #fff; }

/* ───── Pagination ───── */
.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    padding: 16px 0;
}

.page-btn {
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    color: #764ba2;
    background: #fff;
    border: 2px solid #f0e4f3;
    cursor: pointer;
    text-decoration: none;
    transition: .2s;
}

.page-btn:hover, .page-btn.active {
    background: #764ba2;
    color: #fff;
    border-color: #764ba2;
    text-decoration: none;
}

/* ───── Empty State ───── */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #c4b5cf;
}

.empty-state .emoji { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-weight: 600; }

/* ───── Login Page ───── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .15);
    text-align: center;
}

.login-card h1 {
    font-size: 28px;
    font-weight: 900;
    color: #764ba2;
    margin-bottom: 6px;
}

.login-card p {
    color: #9b8fa0;
    font-size: 13px;
    margin-bottom: 30px;
    font-weight: 600;
}

.login-card .btn { width: 100%; justify-content: center; padding: 12px; font-size: 14px; }

/* ───── Responsive ───── */
@media (max-width: 1200px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .two-col { grid-template-columns: 1fr; }
    .three-col { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .sidebar { width: 200px; }
    .main { margin-left: 200px; padding: 16px; }
    .stats { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
}

/* ───── Utility ───── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: #c4b5cf; }
.text-danger { color: #e74c3c; }
.text-success { color: #27ae60; }
.font-mono { font-family: 'Courier New', monospace; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.nowrap { white-space: nowrap; }
