/* ==========================================================================
   Terupshk Design System - Modern Kurdish Dark Glassmorphism
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Vazirmatn:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --bg-primary: #080b11;
    --bg-secondary: #0f1624;
    --bg-card: rgba(18, 26, 43, 0.72);
    --bg-card-hover: rgba(24, 34, 56, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(139, 92, 246, 0.35);

    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    --gold-gradient: linear-gradient(135deg, #f59e0b 0%, #fbbf24 50%, #fef08a 100%);
    --cyan-gradient: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --emerald-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --danger-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);

    --accent-purple: #8b5cf6;
    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    --accent-gold: #f59e0b;
    --accent-danger: #ef4444;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 35px rgba(139, 92, 246, 0.25);
    --shadow-gold: 0 0 40px rgba(245, 158, 11, 0.3);

    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;

    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Vazirmatn', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
    line-height: 1.6;
}

/* Background Ambient Glows */
.ambient-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.55;
    animation: pulse-glow 8s ease-in-out infinite alternate;
}

.glow-1 {
    top: -120px;
    right: 10%;
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.4) 0%, transparent 70%);
}

.glow-2 {
    bottom: 5%;
    left: -100px;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.35) 0%, transparent 70%);
    animation-delay: -4s;
}

.glow-3 {
    top: 40%;
    left: 45%;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(217, 70, 239, 0.2) 0%, transparent 70%);
}

@keyframes pulse-glow {
    0% { transform: scale(1) translate(0, 0); opacity: 0.45; }
    50% { transform: scale(1.15) translate(20px, 15px); opacity: 0.65; }
    100% { transform: scale(0.95) translate(-15px, -10px); opacity: 0.45; }
}

/* Layout */
.app-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px 48px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 36px;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    user-select: none;
}

.logo-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
    font-size: 22px;
}

.logo-text h1 {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, #ffffff 40%, #c4b5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text span {
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: block;
    margin-top: -2px;
}

.header-badges {
    display: flex;
    align-items: center;
    gap: 10px;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent-emerald);
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-emerald);
    box-shadow: 0 0 10px var(--accent-emerald);
    animation: blink 1.6s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

.count-chip {
    padding: 6px 14px;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    color: #c4b5fd;
    font-family: 'Plus Jakarta Sans', 'Vazirmatn', sans-serif;
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 620px;
    width: 100%;
    margin: 0 auto;
}

/* Hero Section */
.hero-section {
    text-align: center;
    margin-bottom: 30px;
    width: 100%;
}

.hero-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 18px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-full);
    font-size: 0.86rem;
    font-weight: 700;
    color: #fde68a;
    margin-bottom: 18px;
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.15);
}

.hero-title {
    font-size: 2.2rem;
    font-weight: 900;
    line-height: 1.35;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #ffffff 30%, #e2e8f0 70%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto;
    font-weight: 400;
}

/* Glass Card */
.glass-card {
    width: 100%;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
}

/* Notice Box */
.security-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-md);
    font-size: 0.84rem;
    color: #93c5fd;
    margin-bottom: 26px;
}

.security-notice .icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Registration Form */
.form-group {
    margin-bottom: 22px;
    position: relative;
}

.form-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-label span.req {
    color: var(--accent-purple);
    font-size: 0.76rem;
    font-weight: 500;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    right: 16px;
    color: var(--text-muted);
    font-size: 1.15rem;
    pointer-events: none;
    transition: var(--transition);
}

.form-input {
    width: 100%;
    padding: 14px 48px 14px 16px;
    background: rgba(15, 23, 42, 0.7);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.98rem;
    transition: var(--transition);
    outline: none;
    direction: rtl;
}

.form-input:focus {
    border-color: var(--accent-purple);
    background: rgba(20, 29, 50, 0.9);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.18);
}

.form-input:focus + .input-icon {
    color: var(--accent-purple);
}

.form-input.is-invalid {
    border-color: var(--accent-danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.input-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 6px;
    display: block;
}

/* Submit Button */
.btn-submit {
    width: 100%;
    padding: 16px 28px;
    background: var(--primary-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: #ffffff;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 25px -5px rgba(139, 92, 246, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px -5px rgba(139, 92, 246, 0.6);
}

.btn-submit:active:not(:disabled) {
    transform: translateY(0);
}

.btn-submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    filter: grayscale(0.2);
}

/* Spinner */
.spinner {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Feedback Alert Banner */
.alert-banner {
    display: none;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    margin-top: 20px;
    animation: fadeIn 0.3s ease;
}

.alert-banner.success {
    display: flex;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

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

.alert-banner.info {
    display: flex;
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: #67e8f9;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Already Registered / Ticket View */
.ticket-view {
    display: none;
    text-align: center;
    padding: 10px 0;
}

.ticket-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.15);
    border: 2px solid rgba(16, 185, 129, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    color: var(--accent-emerald);
    margin: 0 auto 18px;
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.25);
}

.ticket-title {
    font-size: 1.45rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 8px;
}

.ticket-subtitle {
    font-size: 0.92rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.ticket-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px dashed rgba(139, 92, 246, 0.4);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 22px;
    text-align: right;
}

.ticket-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
}

.ticket-row:last-child {
    border-bottom: none;
}

.ticket-label {
    color: var(--text-muted);
}

.ticket-val {
    font-weight: 700;
    color: #ffffff;
    font-family: 'Plus Jakarta Sans', 'Vazirmatn', sans-serif;
}

.ticket-badge {
    padding: 4px 12px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 700;
}

/* Footer */
.app-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 48px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    font-size: 0.82rem;
    color: var(--text-muted);
}

.admin-trigger-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.admin-trigger-btn:hover {
    border-color: var(--accent-purple);
    color: var(--accent-purple);
    background: rgba(139, 92, 246, 0.08);
}

/* ==========================================================================
   Admin Modal & Lucky Draw Studio
   ========================================================================== */

.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(4, 7, 13, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.modal-backdrop.is-open {
    display: flex;
    animation: fadeIn 0.25s ease;
}

.modal-window {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8);
    position: relative;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.5);
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition);
    padding: 4px;
    border-radius: 6px;
}

.btn-close-modal:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* PIN Screen */
.pin-screen {
    max-width: 360px;
    margin: 40px auto;
    text-align: center;
}

.pin-icon {
    font-size: 2.8rem;
    margin-bottom: 12px;
}

.pin-input {
    width: 100%;
    letter-spacing: 12px;
    font-size: 1.8rem;
    text-align: center;
    padding: 12px;
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.8);
    border: 2px solid var(--border-color);
    color: #ffffff;
    margin-bottom: 18px;
    outline: none;
}

.pin-input:focus {
    border-color: var(--accent-purple);
}

/* Admin Tabs */
.admin-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 22px;
}

.tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    padding: 10px 18px;
    font-family: inherit;
    font-size: 0.94rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn.is-active {
    color: var(--accent-purple);
    border-bottom-color: var(--accent-purple);
}

/* Lucky Draw Studio */
.raffle-studio {
    background: radial-gradient(circle at center, rgba(139, 92, 246, 0.15) 0%, rgba(15, 23, 42, 0.8) 100%);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: var(--radius-lg);
    padding: 36px 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
}

.drum-display {
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(8, 11, 17, 0.85);
    border: 2px solid rgba(245, 158, 11, 0.35);
    border-radius: var(--radius-md);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8), 0 0 25px rgba(245, 158, 11, 0.15);
    margin: 20px 0;
}

.drum-name {
    font-size: 2.2rem;
    font-weight: 900;
    background: linear-gradient(135deg, #ffffff 40%, #fbbf24 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s ease;
}

.drum-name.rolling {
    animation: nameJitter 0.08s infinite alternate;
}

@keyframes nameJitter {
    from { transform: translateY(-2px) scale(0.99); opacity: 0.9; }
    to { transform: translateY(2px) scale(1.01); opacity: 1; }
}

.drum-email {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-family: 'Plus Jakarta Sans', sans-serif;
    margin-top: 4px;
}

.raffle-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

.btn-raffle {
    padding: 14px 34px;
    background: var(--gold-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: #000000;
    font-family: inherit;
    font-size: 1.15rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: var(--shadow-gold);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
}

.btn-raffle:hover:not(:disabled) {
    transform: scale(1.04);
    box-shadow: 0 0 45px rgba(245, 158, 11, 0.5);
}

.btn-raffle:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.sound-toggle-btn {
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.sound-toggle-btn.active {
    background: rgba(139, 92, 246, 0.15);
    border-color: var(--accent-purple);
    color: #c4b5fd;
}

/* Winner Banner */
.winner-banner {
    display: none;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(217, 70, 239, 0.2) 100%);
    border: 2px solid #fbbf24;
    border-radius: var(--radius-md);
    padding: 18px 22px;
    margin-top: 20px;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% { transform: scale(0.85); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Table */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 16px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
}

.btn-secondary {
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

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

.table-responsive {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: right;
}

.data-table th, .data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.data-table th {
    background: rgba(15, 23, 42, 0.8);
    font-weight: 700;
    color: var(--text-secondary);
}

.data-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.badge-winner {
    background: rgba(245, 158, 11, 0.18);
    color: #fde68a;
    border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.76rem;
    font-weight: 700;
}

/* Confetti Canvas */
#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
}

/* Responsive */
@media (max-width: 640px) {
    .app-header {
        padding: 12px 16px;
        margin-bottom: 24px;
    }
    .hero-title {
        font-size: 1.7rem;
    }
    .glass-card {
        padding: 24px 18px;
    }
    .drum-name {
        font-size: 1.6rem;
    }
    .app-footer {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}
