/* ============================================
   TWIDLE - GLOBAL CSS
   Complete styles for all pages
   ============================================ */

/* ─── CSS Variables ────────────────────────────── */
:root {
    /* Colors - Light Mode */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F8F9FA;
    --bg-input: #FFFFFF;
    --bg-hover: #F3F4F6;
    --border: #E5E7EB;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    
    /* Brand Colors */
    --violet: #8B5CF6;
    --accent-color: #8B5CF6;
    --accent-hover: #7C3AED;
    --blue: #1A4AFF;
    --coral: #FF7B54;
    --error: #EF4444;
    --success: #10B981;
    --warning: #F59E0B;
}

/* ─── Dark Mode Variables ───────────────────────── */
.dark-mode {
    --bg-primary: #0A0A0A;
    --bg-secondary: #111111;
    --bg-input: #1A1A1A;
    --bg-hover: #1F2937;
    --border: #2A2A2A;
    --text-primary: #F0F3FF;
    --text-secondary: #9CA3AF;
    --violet: #8B5CF6;
    --accent-color: #8B5CF6;
    --accent-hover: #7C3AED;
}

/* ─── Base Styles ────────────────────────────────── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ─── Typography ──────────────────────────────────── */
h1 { font-size: 2.5rem; font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 600; }
h3 { font-size: 1.25rem; font-weight: 600; }
h4 { font-size: 1.1rem; font-weight: 600; }

p {
    color: var(--text-secondary);
}

/* ─── Links ──────────────────────────────────────── */
a {
    color: var(--violet);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover {
    text-decoration: underline;
    color: var(--accent-hover);
}

/* ─── Buttons ────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-size: 1rem;
    font-family: inherit;
}

.btn-primary {
    background-color: var(--violet);
    color: #ffffff;
    width: 100%;
}
.btn-primary:hover {
    background-color: var(--accent-hover);
    text-decoration: none;
    transform: translateY(-1px);
}
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.btn-secondary:hover {
    background-color: var(--bg-hover);
    text-decoration: none;
}

.btn-danger {
    background-color: var(--error);
    color: #ffffff;
}
.btn-danger:hover {
    background-color: #dc2626;
    text-decoration: none;
}

/* ─── Inputs ─────────────────────────────────────── */
input,
textarea,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--violet);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}
input::placeholder,
textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* ─── Forms ──────────────────────────────────────── */
.form-group {
    margin-bottom: 1.25rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.form-helper {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ─── Containers ─────────────────────────────────── */
.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 1.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    background: var(--bg-primary);
}

/* ─── Cards ───────────────────────────────────────── */
.card {
    background-color: var(--bg-secondary);
    border-radius: 1.5rem;
    padding: 2rem;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.3s ease;
}
.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* ─── Modals ──────────────────────────────────────── */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}
.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 1.5rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
}
.modal-header .close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    transition: background 0.2s;
}
.modal-header .close-modal:hover {
    background: var(--bg-hover);
}

.modal-body {
    padding: 1.5rem;
}
.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ─── Animations ──────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ─── Loading States ─────────────────────────────── */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    color: var(--text-secondary);
}
.loading-spinner i {
    font-size: 1.5rem;
    color: var(--violet);
}

/* ─── Empty States ────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-secondary);
}
.empty-state i {
    font-size: 3rem;
    color: var(--text-secondary);
    opacity: 0.5;
    margin-bottom: 1rem;
}
.empty-state h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}
.empty-state p {
    max-width: 300px;
    margin: 0 auto;
}

/* ─── Error States ────────────────────────────────── */
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
}
.error-state i {
    font-size: 3rem;
    color: var(--error);
    margin-bottom: 1rem;
}
.error-state h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* ─── PWA Install Button ─────────────────────────── */
/* Solid PWA Install Button - Light & Dark Mode */
#installPwaWrapper {
    position: fixed !important;
    top: 12px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 999999 !important;
    border-radius: 12px !important;
    padding: 0 !important;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4) !important;
    overflow: hidden !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transition: all 0.3s ease !important;
    max-width: 90% !important;
    animation: slideDown 0.5s ease !important;
    border: none !important;
    outline: none !important;
    /* SOLID BACKGROUND - Always purple */
    background: #8B5CF6 !important;
    background-color: #8B5CF6 !important;
    opacity: 1 !important;
}

#installPwaWrapper button {
    /* SOLID BACKGROUND - Always purple */
    background: #8B5CF6 !important;
    background-color: #8B5CF6 !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 10px 20px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    cursor: pointer !important;
    /* WHITE TEXT - Always visible */
    color: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 160px !important;
    transition: all 0.3s ease !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    letter-spacing: 0.3px !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2) !important;
    justify-content: center !important;
    opacity: 1 !important;
    margin: 0 !important;
    line-height: 1.4 !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

#installPwaWrapper button:hover {
    background: #7C3AED !important;
    background-color: #7C3AED !important;
}

#installPwaWrapper:hover {
    box-shadow: 0 6px 30px rgba(139, 92, 246, 0.5) !important;
    transform: translateX(-50%) scale(1.02) !important;
}

/* Force solid background on all elements inside */
#installPwaWrapper,
#installPwaWrapper *,
#installPwaWrapper button,
#installPwaWrapper button * {
    background-opacity: 1 !important;
    opacity: 1 !important;
}

/* Dark mode override - keep it purple and solid */
.dark-mode #installPwaWrapper,
.dark-mode #installPwaWrapper button {
    background: #8B5CF6 !important;
    background-color: #8B5CF6 !important;
}

.dark-mode #installPwaWrapper button:hover {
    background: #7C3AED !important;
    background-color: #7C3AED !important;
}

/* ─── Utility ────────────────────────────────────── */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mx-auto { margin-left: auto; margin-right: auto; }
.w-100 { width: 100%; }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

.hidden { display: none !important; }
.visible { display: block !important; }

.relative { position: relative; }
.absolute { position: absolute; }

/* ─── Scrollbar ───────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
    background: var(--violet);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover);
}

/* ─── Selection ───────────────────────────────────── */
::selection {
    background: var(--violet);
    color: #ffffff;
}

/* ─── Icon Button ─────────────────────────────────── */
.icon-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-btn:hover {
    background: var(--bg-hover);
}

/* ─── Responsive ──────────────────────────────────── */
@media (max-width: 640px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.25rem; }
    .container { padding: 1rem; }
    .card { padding: 1.25rem; }
    .modal-content { margin: 10px; }
    #installPwaWrapper button {
        padding: 8px 16px !important;
        font-size: 13px !important;
        min-width: 140px !important;
    }
}

@media (max-width: 400px) {
    .card { padding: 1rem; }
    .btn { padding: 0.6rem 1rem; font-size: 0.9rem; }
    #installPwaWrapper button {
        padding: 6px 12px !important;
        font-size: 12px !important;
        min-width: 120px !important;
    }
}
/* World Cup Mode */
.world-cup-mode {
    --accent-color: #1a8c5e; /* World Cup Green */
    --accent-hover: #146d4a;
}

.world-cup-mode .header {
    background: linear-gradient(135deg, #1a8c5e, #f5c518);
    border-bottom: 2px solid #f5c518;
}

.world-cup-mode .header h2::after {
    content: " ⚽";
}

.world-cup-mode .nav-item.active {
    color: #f5c518;
}