/* ============================================================
   GiveAwaysTitan — Global Stylesheet v2
   Dark SaaS theme · auth + app pages
   ============================================================ */

/* Google Fonts import — Inter */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --clr-bg:          #0d0f17;
    --clr-surface:     #141720;
    --clr-surface-2:   #1c2030;
    --clr-surface-3:   #222639;
    --clr-border:      #262c3f;
    --clr-primary:     #6366f1;
    --clr-primary-h:   #818cf8;
    --clr-accent:      #7c3aed;
    --clr-accent-h:    #a78bfa;
    --clr-success:     #22c55e;
    --clr-error:       #ef4444;
    --clr-warning:     #f59e0b;
    --clr-text:        #e2e8f0;
    --clr-text-muted:  #8892a4;
    --clr-text-dim:    #4a556b;

    --font-sans:  'Inter', system-ui, -apple-system, sans-serif;
    --radius-sm:  6px;
    --radius-md:  12px;
    --radius-lg:  20px;

    --shadow-card: 0 0 0 1px var(--clr-border), 0 8px 40px rgba(0,0,0,.55);
    --shadow-glow: 0 0 20px rgba(99,102,241,.25);

    --nav-h: 60px;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    background: var(--clr-bg);
    color: var(--clr-text);
    min-height: 100vh;
    line-height: 1.6;
}

a { color: var(--clr-primary-h); text-decoration: none; transition: color .2s; }
a:hover { color: var(--clr-accent-h); }
img { display: block; max-width: 100%; }

/* ── Utility ─────────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.text-muted { color: var(--clr-text-muted); }
.text-sm    { font-size: .875rem; }

/* ── Brand Icon (shared) ─────────────────────────────────── */
.brand-icon {
    width: 34px; height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent));
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-glow);
    flex-shrink: 0;
}
.brand-icon svg { width: 18px; height: 18px; fill: #fff; }

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 24px 16px;
    background:
        radial-gradient(ellipse 80% 60% at 50% -10%, rgba(99,102,241,.18) 0%, transparent 60%),
        var(--clr-bg);
}

.auth-card {
    width: 100%; max-width: 440px;
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-lg);
    padding: 48px 40px 40px;
    box-shadow: var(--shadow-card);
    animation: fadeUp .35s ease both;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

.auth-brand {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 32px;
}
.auth-brand-icon {
    width: 38px; height: 38px; border-radius: 10px;
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent));
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-glow);
}
.auth-brand-icon svg { width: 20px; height: 20px; fill: #fff; }
.auth-brand-name { font-size: 1.05rem; font-weight: 700; letter-spacing: -.02em; }

.auth-title    { font-size: 1.65rem; font-weight: 700; letter-spacing: -.03em; margin-bottom: 6px; }
.auth-subtitle { font-size: .9rem; color: var(--clr-text-muted); margin-bottom: 32px; }

.auth-icon-wrap {
    width: 56px; height: 56px; border-radius: 50%;
    background: rgba(99,102,241,.12); border: 1px solid rgba(99,102,241,.25);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 20px; color: var(--clr-primary-h);
}
.auth-icon-wrap svg { width: 26px; height: 26px; }
.auth-icon-error { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.25); color: #fca5a5; }

.form-meta { display: flex; justify-content: flex-end; margin-top: -12px; margin-bottom: 20px; }
.form-meta a { font-size: .8rem; color: var(--clr-text-muted); }
.form-meta a:hover { color: var(--clr-primary-h); }

.auth-divider { border: none; border-top: 1px solid var(--clr-border); margin: 24px 0; }
.auth-footer  { text-align: center; font-size: .875rem; color: var(--clr-text-muted); }
.auth-footer a { font-weight: 600; }

/* ============================================================
   APP LAYOUT — Top Navbar
   ============================================================ */
.app-nav {
    position: sticky; top: 0; z-index: 100;
    height: var(--nav-h);
    background: rgba(20,23,32,.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--clr-border);
    display: flex; align-items: center;
    padding: 0 24px;
    gap: 16px;
}

.app-nav-brand {
    display: flex; align-items: center; gap: 10px;
    font-weight: 700; font-size: .95rem;
    color: var(--clr-text); text-decoration: none;
    margin-right: auto;
}
.app-nav-brand:hover { color: var(--clr-text); }

.app-nav-links {
    display: flex; align-items: center; gap: 4px;
    list-style: none;
}
.app-nav-links a {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: .875rem; font-weight: 500;
    color: var(--clr-text-muted);
    transition: background .2s, color .2s;
}
.app-nav-links a:hover,
.app-nav-links a.active {
    background: var(--clr-surface-3);
    color: var(--clr-text);
}
.app-nav-links .nav-logout a {
    color: var(--clr-error);
}
.app-nav-links .nav-logout a:hover {
    background: rgba(239,68,68,.1);
    color: #fca5a5;
}

/* ── App page wrapper ────────────────────────────────────── */
.app-page {
    min-height: calc(100vh - var(--nav-h));
    padding: 40px 24px 60px;
    background:
        radial-gradient(ellipse 70% 40% at 80% -5%, rgba(99,102,241,.1) 0%, transparent 55%),
        var(--clr-bg);
}

.app-container { max-width: 1080px; margin: 0 auto; }
.app-container-sm { max-width: 680px; margin: 0 auto; }

/* ── Page header ─────────────────────────────────────────── */
.page-header { margin-bottom: 32px; }
.page-title { font-size: 1.75rem; font-weight: 700; letter-spacing: -.03em; }
.page-desc  { font-size: .95rem; color: var(--clr-text-muted); margin-top: 6px; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: 0 2px 16px rgba(0,0,0,.3);
}

.card-sm { padding: 16px 20px; }
.card-lg { padding: 32px; }

/* ── Giveaway card ───────────────────────────────────────── */
.giveaway-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.giveaway-card {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex; flex-direction: column;
    transition: border-color .25s, transform .2s, box-shadow .25s;
}
.giveaway-card:hover {
    border-color: var(--clr-primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(99,102,241,.2);
}

.giveaway-card-img {
    width: 100%; height: 180px;
    object-fit: cover;
    background: var(--clr-surface-2);
}
.giveaway-card-img-placeholder {
    width: 100%; height: 140px;
    background: linear-gradient(135deg, var(--clr-surface-2), var(--clr-surface-3));
    display: flex; align-items: center; justify-content: center;
    color: var(--clr-text-dim); font-size: 2rem;
}

.giveaway-card-body { padding: 20px; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.giveaway-card-title { font-size: 1.05rem; font-weight: 700; color: var(--clr-text); }
.giveaway-card-desc { font-size: .875rem; color: var(--clr-text-muted); line-height: 1.55; }

.giveaway-meta {
    display: flex; flex-wrap: wrap; gap: 12px;
    font-size: .8rem; color: var(--clr-text-dim);
    margin-top: 4px;
}
.giveaway-meta span { display: flex; align-items: center; gap: 4px; }

.giveaway-card-footer { padding: 0 20px 20px; }

/* ── Dashboard nav cards ─────────────────────────────────── */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.dash-nav-card {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
    transition: border-color .2s, background .2s, transform .2s;
    text-decoration: none; color: var(--clr-text);
}
.dash-nav-card:hover {
    border-color: var(--clr-primary);
    background: var(--clr-surface-2);
    transform: translateY(-2px);
    color: var(--clr-text);
}
.dash-nav-card.danger { border-color: rgba(239,68,68,.2); }
.dash-nav-card.danger:hover { border-color: var(--clr-error); background: rgba(239,68,68,.05); }

.dash-nav-icon {
    width: 40px; height: 40px; border-radius: 10px;
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent));
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-glow);
}
.dash-nav-icon svg { width: 18px; height: 18px; stroke: #fff; }
.dash-nav-card.danger .dash-nav-icon { background: linear-gradient(135deg, #b91c1c, var(--clr-error)); box-shadow: none; }

.dash-nav-label { font-size: .9rem; font-weight: 600; }
.dash-nav-desc  { font-size: .78rem; color: var(--clr-text-muted); }

/* ── Profile info ────────────────────────────────────────── */
.profile-avatar {
    width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent));
    display: flex; align-items: center; justify-content: center;
    font-size: 1.35rem; font-weight: 700; color: #fff;
    flex-shrink: 0;
}
.profile-header { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.profile-name   { font-size: 1.15rem; font-weight: 700; }
.profile-meta   { font-size: .85rem; color: var(--clr-text-muted); }

.info-row { display: flex; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--clr-border); font-size: .9rem; }
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--clr-text-muted); min-width: 130px; font-weight: 500; }

/* ============================================================
   FORM ELEMENTS (shared between auth + app)
   ============================================================ */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block; font-size: .82rem; font-weight: 600;
    color: var(--clr-text-muted); letter-spacing: .04em;
    text-transform: uppercase; margin-bottom: 7px;
}
.form-control {
    width: 100%; padding: 11px 14px;
    background: var(--clr-surface-2); border: 1px solid var(--clr-border);
    border-radius: var(--radius-sm); color: var(--clr-text);
    font-family: var(--font-sans); font-size: .95rem; outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.form-control::placeholder { color: var(--clr-text-dim); }
.form-control:focus {
    border-color: var(--clr-primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,.2);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 20px;
    border: none; border-radius: var(--radius-sm);
    font-family: var(--font-sans); font-size: .9rem; font-weight: 600;
    cursor: pointer; transition: opacity .2s, transform .15s, box-shadow .2s;
    text-decoration: none; white-space: nowrap; letter-spacing: .01em;
}
.btn:active { transform: scale(.97); }

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent));
    color: #fff; box-shadow: 0 4px 16px rgba(99,102,241,.35);
    margin-top: 8px;
}
.btn-primary:hover { opacity: .9; box-shadow: 0 6px 24px rgba(99,102,241,.45); color: #fff; }

.btn-inline {
    width: auto;
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent));
    color: #fff; box-shadow: 0 4px 16px rgba(99,102,241,.35);
}
.btn-inline:hover { opacity: .9; color: #fff; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--clr-border);
    color: var(--clr-text-muted);
}
.btn-outline:hover { border-color: var(--clr-primary); color: var(--clr-text); background: var(--clr-surface-2); }

.btn-lg { padding: 13px 28px; font-size: 1rem; }
.btn-sm { padding: 6px 14px; font-size: .82rem; }

/* ============================================================
   BADGES / STATUS
   ============================================================ */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 99px;
    font-size: .75rem; font-weight: 600; letter-spacing: .03em;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }

.badge-active   { background: rgba(34,197,94,.12);  color: #4ade80; }
.badge-upcoming { background: rgba(99,102,241,.15); color: #818cf8; }
.badge-ended    { background: rgba(100,116,139,.15); color: #94a3b8; }
.badge-claimed  { background: rgba(34,197,94,.12);  color: #4ade80; }
.badge-pending  { background: rgba(245,158,11,.12); color: #fbbf24; }

/* ============================================================
   TABLE
   ============================================================ */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left; padding: 10px 14px;
    font-size: .75rem; font-weight: 600; letter-spacing: .05em;
    text-transform: uppercase; color: var(--clr-text-dim);
    border-bottom: 1px solid var(--clr-border);
}
.data-table td {
    padding: 14px; font-size: .9rem; color: var(--clr-text);
    border-bottom: 1px solid rgba(38,44,63,.6);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: rgba(99,102,241,.04); }

/* ============================================================
   ALERT / MESSAGE
   ============================================================ */
.alert {
    border-radius: var(--radius-sm); padding: 12px 14px;
    font-size: .875rem; line-height: 1.5; margin-bottom: 20px;
    display: flex; gap: 10px; align-items: flex-start;
}
.alert-error   { background: rgba(239,68,68,.1);  border: 1px solid rgba(239,68,68,.3);  color: #fca5a5; }
.alert-success { background: rgba(34,197,94,.1);  border: 1px solid rgba(34,197,94,.3);  color: #86efac; }
.alert-list {
    background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3);
    border-radius: var(--radius-sm); padding: 12px 14px 12px 28px;
    margin-bottom: 20px; color: #fca5a5; font-size: .875rem;
}
.alert-list li + li { margin-top: 4px; }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
    text-align: center; padding: 60px 20px;
    color: var(--clr-text-muted);
}
.empty-state-icon {
    font-size: 3rem; margin-bottom: 16px; opacity: .4;
}
.empty-state h3 { font-size: 1.1rem; font-weight: 600; color: var(--clr-text); margin-bottom: 8px; }
.empty-state p  { font-size: .9rem; margin-bottom: 20px; }

/* ── Section divider ─────────────────────────────────────── */
.section-sep { border: none; border-top: 1px solid var(--clr-border); margin: 28px 0; }

/* == Congratulations page ────────────────────────────────── */
.confetti-bg {
    min-height: calc(100vh - var(--nav-h));
    display: flex; align-items: center; justify-content: center;
    padding: 40px 20px;
    background:
        radial-gradient(ellipse 70% 50% at 50% 0%, rgba(99,102,241,.2) 0%, transparent 60%),
        var(--clr-bg);
}
.success-card {
    text-align: center; max-width: 500px; width: 100%;
    background: var(--clr-surface); border: 1px solid var(--clr-border);
    border-radius: var(--radius-lg); padding: 52px 40px 44px;
    box-shadow: var(--shadow-card);
    animation: fadeUp .4s ease both;
}
.success-icon {
    width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 24px;
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent));
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-glow);
}
.success-icon svg { width: 34px; height: 34px; stroke: #fff; }
.success-title { font-size: 1.8rem; font-weight: 700; letter-spacing: -.03em; margin-bottom: 10px; }
.success-desc  { color: var(--clr-text-muted); margin-bottom: 28px; }
.success-actions { display: flex; flex-direction: column; gap: 10px; }

/* ============================================================
   ADMIN PANEL — specific components
   ============================================================ */

/* ── Admin nav accent ────────────────────────────────────── */
.nav-admin-badge {
    display: inline-flex; align-items: center;
    padding: 2px 8px; border-radius: 99px;
    background: rgba(245,158,11,.15);
    border: 1px solid rgba(245,158,11,.3);
    color: #fbbf24; font-size: .7rem; font-weight: 700;
    letter-spacing: .05em; margin-left: 6px;
    vertical-align: middle;
}

/* ── Stat cards grid ─────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex; flex-direction: column; gap: 8px;
    transition: border-color .2s, transform .2s;
}
.stat-card:hover { border-color: var(--clr-primary); transform: translateY(-2px); }

.stat-icon {
    width: 36px; height: 36px; border-radius: 9px;
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent));
    display: flex; align-items: center; justify-content: center;
}
.stat-icon svg { width: 16px; height: 16px; stroke: #fff; }

.stat-value {
    font-size: 1.75rem; font-weight: 700;
    letter-spacing: -.03em; color: var(--clr-text);
    line-height: 1.1;
}
.stat-label {
    font-size: .78rem; color: var(--clr-text-muted);
    text-transform: uppercase; letter-spacing: .04em; font-weight: 600;
}
.stat-sub {
    font-size: .78rem; color: var(--clr-text-dim);
}

/* ── Admin page two-column layout ───────────────────────── */
.admin-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 860px) {
    .admin-layout { grid-template-columns: 1fr; }
}

/* ── Inline form row (label + input on same line) ────────── */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ── Btn danger ──────────────────────────────────────────── */
.btn-danger {
    background: rgba(239,68,68,.15);
    border: 1px solid rgba(239,68,68,.3);
    color: #fca5a5;
}
.btn-danger:hover {
    background: rgba(239,68,68,.25);
    border-color: var(--clr-error);
    color: #fff;
}

/* ── Btn warning (draw) ──────────────────────────────────── */
.btn-warning {
    background: rgba(245,158,11,.15);
    border: 1px solid rgba(245,158,11,.3);
    color: #fbbf24;
}
.btn-warning:hover {
    background: rgba(245,158,11,.25);
    border-color: var(--clr-warning);
    color: #fff;
}

/* ── Extra badges ────────────────────────────────────────── */
.badge-disabled { background: rgba(239,68,68,.1); color: #fca5a5; }
.badge-admin    { background: rgba(245,158,11,.12); color: #fbbf24; }
.badge-drawn    { background: rgba(34,197,94,.12); color: #4ade80; }
.badge-nodraw   { background: rgba(245,158,11,.12); color: #fbbf24; }

/* ── Thumbnail in table ──────────────────────────────────── */
.table-thumb {
    width: 44px; height: 36px; border-radius: 5px;
    object-fit: cover; background: var(--clr-surface-2);
}

/* ── Admin table action cell ─────────────────────────────── */
.td-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Collapsible form panel ──────────────────────────────── */
.panel-header {
    display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; user-select: none;
    padding-bottom: 16px; border-bottom: 1px solid var(--clr-border);
    margin-bottom: 20px;
}
.panel-header h2 { font-size: 1rem; font-weight: 700; }
.panel-toggle-icon { transition: transform .2s; color: var(--clr-text-dim); }
.panel-body.collapsed { display: none; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
    .auth-card { padding: 36px 24px 28px; }
    .auth-title { font-size: 1.4rem; }
    .app-page { padding: 24px 16px 48px; }
    .page-title { font-size: 1.4rem; }
    .giveaway-grid { grid-template-columns: 1fr; }
    .dash-grid { grid-template-columns: 1fr 1fr; }
    .app-nav-links { display: none; }
    .success-card { padding: 36px 24px 32px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
