/**
 * AlertOwl - Authentication Pages Styles
 * Matches the existing dashboard design system
 */

/* ===========================================
   CSS VARIABLES (matches dashboard)
   =========================================== */
:root {
    /* Background colors */
    --bg-primary: #0a0a0b;
    --bg-secondary: #141417;
    --bg-tertiary: #1c1c21;
    --bg-hover: #252529;
    
    /* Text colors */
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    
    /* Accent colors */
    --accent-teal: #14b8a6;
    --accent-teal-dim: #0d9488;
    --accent-red: #ef4444;
    --accent-orange: #f97316;
    --accent-yellow: #eab308;
    --accent-green: #22c55e;
    
    /* Borders */
    --border: #27272a;
    --border-light: #3f3f46;
    
    /* Effects */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --radius: 12px;
    --radius-sm: 8px;
}

/* ===========================================
   BASE STYLES
   =========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

a {
    color: var(--accent-teal);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-teal-dim);
    text-decoration: underline;
}

/* ===========================================
   AUTH PAGE LAYOUT
   =========================================== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(20, 184, 166, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(20, 184, 166, 0.04) 0%, transparent 50%),
        var(--bg-primary);
}

.auth-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 48px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow);
}

/* Wider card for signup (has more fields) */
.auth-card.wide {
    max-width: 520px;
}

/* ===========================================
   LOGO & HEADERS
   =========================================== */
.auth-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.auth-logo svg {
    width: 40px;
    height: 40px;
}

.auth-logo h1 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-teal) 0%, #5eead4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.auth-subtitle {
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 15px;
}

/* ===========================================
   FORM ELEMENTS
   =========================================== */
.form-group {
    margin-bottom: 20px;
}

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

.form-label .required {
    color: var(--accent-red);
    margin-left: 2px;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-teal);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.form-input.input-error {
    border-color: var(--accent-red);
}

.form-input.input-error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* Input with icon wrapper */
.input-wrapper {
    position: relative;
}

/* FIX: Password input needs padding for toggle button only */
.input-wrapper .form-input {
    padding-right: 48px; /* Space for password toggle */
}

/* FIX: Password toggle button positioning */
.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #71717a;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2; /* Ensure it's above input */
}

.password-toggle:hover {
    color: var(--text-secondary);
}

.input-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* Phone input with country code */
.phone-input-group {
    display: flex;
    gap: 0; /* Changed from 8px to 0 for seamless look */
}

.country-select {
    width: 100px;
    padding: 14px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
}

.country-select:focus {
    outline: none;
    border-color: var(--accent-teal);
}

.phone-input-group .form-input {
    flex: 1;
}

/* Form hints */
.form-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ===========================================
   BUTTONS
   =========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-teal) 0%, var(--accent-teal-dim) 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 12px;
}

.btn-ghost:hover:not(:disabled) {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.btn-danger {
    background: var(--accent-red);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 10px 16px;
    font-size: 14px;
}

/* ===========================================
   PLAN SELECTION CARDS - FIXED
   =========================================== */
.plan-cards {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
}

.plan-card {
    flex: 1;
    position: relative;
    /* FIX: Added left padding to make room for checkbox */
    padding: 20px 20px 20px 44px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.plan-card:hover {
    border-color: var(--border-light);
}

.plan-card.selected {
    border-color: var(--accent-teal);
    background: rgba(20, 184, 166, 0.05);
}

.plan-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.plan-badge {
    position: absolute;
    top: -10px;
    /* FIX: Moved badge to center-right to avoid checkbox */
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 10px;
    background: var(--accent-teal);
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    white-space: nowrap;
}

.plan-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.plan-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-teal);
    margin-bottom: 8px;
}

.plan-description {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* FIX: Checkmark indicator - better positioning */
.plan-card::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 50%;
    transition: all 0.2s;
    background: var(--bg-tertiary);
}

.plan-card.selected::before {
    background: var(--accent-teal);
    border-color: var(--accent-teal);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E");
    background-size: 14px;
    background-position: center;
    background-repeat: no-repeat;
}

/* Remove the old ::after pseudo-element */
.plan-card::after {
    display: none;
}

/* ===========================================
   CHECKBOX
   =========================================== */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 24px;
}

.checkbox-input {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    accent-color: var(--accent-teal);
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-label {
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1.5;
}

.checkbox-label a {
    color: var(--accent-teal);
}

/* ===========================================
   ERROR & SUCCESS MESSAGES
   =========================================== */
.error-message {
    display: none;
    align-items: center;
    gap: 10px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 20px;
}

.error-message.show {
    display: flex;
}

.success-message {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 32px 20px;
}

.success-message.show {
    display: flex;
}

.success-icon {
    width: 64px;
    height: 64px;
    background: rgba(34, 197, 94, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.success-icon svg {
    width: 32px;
    height: 32px;
    color: var(--accent-green);
}

.success-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
}

.success-text {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 24px;
}

/* ===========================================
   DIVIDERS & LINKS
   =========================================== */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-divider span {
    padding: 0 16px;
    color: var(--text-muted);
    font-size: 13px;
}

.auth-footer {
    margin-top: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-footer a {
    font-weight: 500;
}

/* Inline link in form */
.form-link {
    display: block;
    text-align: right;
    margin-top: -12px;
    margin-bottom: 20px;
    font-size: 13px;
}

/* ===========================================
   VERIFICATION STATES
   =========================================== */
.verify-container {
    text-align: center;
    padding: 20px 0;
}

.verify-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.verify-icon.loading {
    background: rgba(20, 184, 166, 0.1);
}

.verify-icon.success {
    background: rgba(34, 197, 94, 0.1);
}

.verify-icon.error {
    background: rgba(239, 68, 68, 0.1);
}

.verify-icon svg {
    width: 40px;
    height: 40px;
}

.verify-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 12px;
}

.verify-text {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 24px;
    line-height: 1.6;
}

/* ===========================================
   WARNING BANNERS
   =========================================== */
.warning-banner {
    display: none;
    align-items: flex-start;
    gap: 12px;
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.3);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.warning-banner.show {
    display: flex;
}

.warning-banner svg {
    width: 20px;
    height: 20px;
    color: var(--accent-yellow);
    flex-shrink: 0;
    margin-top: 2px;
}

.warning-banner-content {
    flex: 1;
}

.warning-banner-title {
    font-weight: 600;
    color: var(--accent-yellow);
    margin-bottom: 4px;
}

.warning-banner-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.warning-banner .btn {
    padding: 8px 16px;
    font-size: 13px;
}

/* ===========================================
   LOADING SPINNER
   =========================================== */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent-teal);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner.large {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

/* ===========================================
   RESPONSIVE DESIGN
   =========================================== */
@media (max-width: 520px) {
    .auth-card {
        padding: 32px 24px;
    }
    
    .auth-title {
        font-size: 24px;
    }
    
    .plan-cards {
        flex-direction: column;
    }
    
    .plan-card {
        /* FIX: Adjust padding for mobile */
        padding: 16px 16px 16px 44px;
    }
    
    .plan-badge {
        /* FIX: Reposition badge for mobile */
        left: auto;
        right: 12px;
        transform: none;
    }
    
    .phone-input-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .country-select {
        width: 100%;
    }
    
    /* FIX: Country picker wrapper for mobile */
    .country-picker-wrapper {
        width: 100%;
    }
    
    .country-picker-btn {
        width: 100%;
        border-radius: 8px;
        border-right: 1px solid var(--border);
    }
    
    .phone-input-group .form-input {
        border-radius: 8px;
    }
}

/* ===========================================
   PASSWORD STRENGTH INDICATOR
   =========================================== */
.password-strength {
    margin-top: 8px;
}

.strength-bars {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
}

.strength-bar {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    transition: background 0.3s ease;
}

/* ===========================================
   FIELD ERRORS (inline validation)
   =========================================== */
.field-error {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-red);
    font-size: 13px;
    margin-top: 6px;
}

.field-error svg {
    flex-shrink: 0;
}

/* ===========================================
   COUNTDOWN TIMER
   =========================================== */
.countdown {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 14px;
}

.countdown-number {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-teal);
}

/* ===========================================
   PASSWORD REQUIREMENTS CHECKLIST
   =========================================== */
.password-requirements {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
    margin-top: 8px;
    font-size: 11px;
}

.password-requirements > div {
    display: flex;
    align-items: center;
    gap: 4px;
}
