/* ThanksCode Web App - Mobile-First Responsive Design */

:root {
    --primary: #8B5CF6;
    --primary-dark: #7C3AED;
    --secondary: #3B82F6;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --bg-primary: #F9FAFB;
    --bg-secondary: #FFFFFF;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --border: #E5E7EB;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Stealth Mode Screen */
.stealth-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.stealth-logo {
    margin-bottom: 30px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.9; }
}

.stealth-title {
    font-size: 64px;
    margin-bottom: 16px;
}

.stealth-subtitle {
    color: var(--text-secondary);
    font-size: 18px;
    margin-bottom: 40px;
}

.stealth-form {
    width: 100%;
    max-width: 300px;
}

.stealth-form .form-group {
    margin-bottom: 20px;
}

.stealth-form input {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    transition: all 0.3s ease;
    text-align: center;
    letter-spacing: 1px;
}

.stealth-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* Screen Management */
.screen {
    min-height: 100vh;
    transition: opacity 0.3s ease;
}

.hidden {
    display: none !important;
}

/* Auth Screen */
.auth-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.logo {
    text-align: center;
    margin-bottom: 20px;
}

.auth-container h1 {
    text-align: center;
    color: var(--primary);
    font-size: 32px;
    margin-bottom: 8px;
}

.tagline {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

/* Tab Switcher */
.tab-switcher {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 4px;
    box-shadow: var(--shadow);
}

.tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab.active {
    background: var(--primary);
    color: white;
}

/* Forms */
.auth-form {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: var(--bg-primary);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 12px;
}

/* Stripe Card Element */
.stripe-card-element {
    padding: 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--bg-primary);
    transition: all 0.3s ease;
    min-height: 40px;
    position: relative;
    z-index: 1;
}

.stripe-card-element iframe {
    position: relative;
    z-index: 2;
}

.stripe-card-element:focus-within {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.card-errors {
    color: var(--danger);
    font-size: 14px;
    margin-top: 8px;
    min-height: 20px;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

/* Messages */
.error-message {
    padding: 12px;
    background: #FEE2E2;
    color: var(--danger);
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.success-message {
    padding: 12px;
    background: #D1FAE5;
    color: var(--success);
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

/* App Screen */
.app-header {
    background: var(--bg-secondary);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header h2 {
    color: var(--primary);
    font-size: 24px;
}

.header-buttons {
    display: flex;
    gap: 4px;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: var(--bg-primary);
    color: var(--primary);
}

/* Balance Card */
.balance-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 32px 20px;
    margin: 20px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.balance-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.balance-amount {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 8px;
}

.user-email {
    font-size: 14px;
    opacity: 0.8;
}

/* Action Grid */
.action-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 0 20px;
    margin-bottom: 24px;
}

.action-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 16px;
    padding: 24px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.action-btn:active {
    transform: translateY(0);
}

.action-btn span {
    font-size: 14px;
    font-weight: 600;
}

/* Stats */
.stats-container {
    padding: 0 20px;
    margin-bottom: 24px;
}

.stats-container h3 {
    margin-bottom: 16px;
    color: var(--text-primary);
}

.stat-card {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-card span {
    color: var(--text-secondary);
    font-size: 14px;
}

.stat-card strong {
    font-size: 24px;
    color: var(--primary);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
    color: var(--text-primary);
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 32px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
}

.modal-body {
    padding: 20px;
}

/* Quick Amounts */
.quick-amounts {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.amount-btn {
    padding: 12px 8px;
    border: 2px solid var(--border);
    background: var(--bg-primary);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.amount-btn:hover,
.amount-btn.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

.available-balance {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 14px;
}

.available-balance span {
    color: var(--success);
    font-weight: 600;
}

/* Code Display */
.code-display {
    text-align: center;
    margin: 20px 0;
}

.code-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 2px;
    background: var(--bg-primary);
    padding: 16px;
    border-radius: 12px;
    margin: 12px 0;
    font-family: 'Courier New', monospace;
}

/* Responsive Design */
@media (min-width: 768px) {
    .auth-container {
        padding: 40px;
    }
    
    .balance-card {
        margin: 40px auto;
        max-width: 600px;
    }
    
    .action-grid {
        max-width: 600px;
        margin: 0 auto 40px;
        padding: 0 20px;
    }
    
    .stats-container {
        max-width: 600px;
        margin: 0 auto 40px;
        padding: 0 20px;
    }
}

@media (min-width: 1024px) {
    .balance-amount {
        font-size: 56px;
    }
    
    .action-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* My Codes Grid */
.codes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.code-card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid var(--border);
}

.code-card:hover:not(.claimed) {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.code-card.claimed {
    opacity: 0.6;
    cursor: default;
}

.code-number {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
    word-break: break-all;
}

.code-amount {
    font-size: 24px;
    font-weight: 700;
    color: var(--success);
    margin: 8px 0;
}

.code-card.claimed .code-amount {
    color: var(--text-secondary);
}

.code-status {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
}

.no-codes-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.no-codes-message p {
    margin: 8px 0;
}

/* Loading State */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

/* ============================================
   NEW STYLES: Forgot Password, Contact, Terms
   ============================================ */

/* Forgot password link */
.forgot-wrap {
    text-align: right;
    margin-top: 12px;
}

.forgot-wrap a {
    color: var(--primary);
    font-size: 14px;
    text-decoration: none;
    font-weight: 500;
}

.forgot-wrap a:hover {
    text-decoration: underline;
}

/* Terms checkbox */
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: normal;
    margin-bottom: 0;
}

.checkbox-label input[type="checkbox"] {
    margin-top: 2px;
    width: 18px;
    height: 18px;
    min-width: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.checkbox-label span a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.checkbox-label span a:hover {
    text-decoration: underline;
}

/* Textarea */
.form-group textarea {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: var(--bg-primary);
    resize: vertical;
    min-height: 100px;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

/* Modal description text */
.modal-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

/* Step dots for password reset */
.step-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}

.step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    transition: all 0.3s ease;
}

.step-dot.active {
    background: var(--primary);
    width: 28px;
    border-radius: 5px;
}
