/**
 * TopVelocity Dark Theme Auth Styles
 * Shared across: Login, Registration, Forgot Password, Org Registration
 */

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

body.tv-auth-dark {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 50%, #0f0f0f 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #fff;
}

/* Container */
.tv-auth-wrapper {
    width: 100%;
    max-width: 480px;
}

.tv-auth-wrapper.tv-auth-wide {
    max-width: 600px;
}

/* Logo */
.tv-auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.tv-auth-logo img {
    height: 50px;
    width: auto;
}

.tv-auth-logo a {
    display: inline-block;
}

/* Card */
.tv-auth-card {
    background: linear-gradient(145deg, #1e1e1e, #252525);
    border: 1px solid #333;
    border-radius: 20px;
    padding: 40px 35px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

/* Header */
.tv-auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.tv-auth-header h1 {
    font-size: 26px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 10px;
}

.tv-auth-header p {
    font-size: 15px;
    color: #9ca3af;
    line-height: 1.5;
}

/* Section Headers (for multi-section forms) */
.tv-auth-section {
    margin-bottom: 24px;
}

.tv-auth-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #6b7280;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #333;
}

/* Alerts */
.tv-auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.5;
}

.tv-auth-alert svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.tv-auth-alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.tv-auth-alert-success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #86efac;
}

.tv-auth-alert-info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

/* Error/Success Messages (legacy classes) */
.tv-error-message {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tv-error-message::before {
    content: '⚠️';
    font-size: 16px;
}

.tv-success-message {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #86efac;
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tv-success-message::before {
    content: '✓';
    font-size: 16px;
}

/* Form */
.tv-auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Form Groups */
.tv-form-group {
    display: flex;
    flex-direction: column;
}

.tv-form-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    color: #e5e7eb;
    margin-bottom: 8px;
}

.tv-form-group label .required {
    color: #ef4444;
}

/* Input Wrapper with Icons */
.tv-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.tv-input-wrapper > svg {
    position: absolute;
    left: 14px;
    color: #6b7280;
    pointer-events: none;
    z-index: 1;
}

.tv-input-wrapper input,
.tv-input-wrapper select {
    padding-left: 44px !important;
}

/* Ensure password toggle button SVGs are clickable */
.tv-toggle-password svg {
    position: static;
    pointer-events: auto;
}

/* Inputs */
.tv-auth-form input[type="text"],
.tv-auth-form input[type="email"],
.tv-auth-form input[type="password"],
.tv-auth-form input[type="tel"],
.tv-auth-form input[type="number"],
.tv-auth-form select,
.tv-auth-form textarea {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #444;
    border-radius: 10px;
    font-size: 15px;
    color: #ffffff;
    transition: all 0.2s ease;
    -webkit-appearance: none;
}

.tv-auth-form input::placeholder,
.tv-auth-form textarea::placeholder {
    color: #6b7280;
}

.tv-auth-form input:focus,
.tv-auth-form select:focus,
.tv-auth-form textarea:focus {
    outline: none;
    border-color: #c41e3a;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.15);
}

/* Select Dropdown */
.tv-auth-form select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 44px;
}

.tv-auth-form select option {
    background: #1e1e1e;
    color: #ffffff;
}

/* Password Toggle */
.tv-toggle-password {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tv-toggle-password:hover {
    color: #9ca3af;
}

/* Checkbox */
.tv-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #9ca3af;
}

.tv-checkbox-label input[type="checkbox"] {
    display: none;
}

.tv-checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #444;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.tv-checkbox-label input:checked + .tv-checkbox-custom {
    background: #c41e3a;
    border-color: #c41e3a;
}

.tv-checkbox-label input:checked + .tv-checkbox-custom::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

/* NEW: Improved Checkbox Wrapper (for better click targets) */
.tv-checkbox-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #9ca3af;
    padding: 4px 0;
    user-select: none;
}

.tv-checkbox-wrapper input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.tv-checkbox-box {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: 2px solid #444;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.05);
}

.tv-checkbox-box svg {
    opacity: 0;
    color: white;
    transition: opacity 0.15s ease;
}

.tv-checkbox-wrapper:hover .tv-checkbox-box {
    border-color: #c41e3a;
    background: rgba(196, 30, 58, 0.1);
}

.tv-checkbox-wrapper:focus {
    outline: none;
}

.tv-checkbox-wrapper:focus .tv-checkbox-box {
    border-color: #c41e3a;
    box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.2);
}

.tv-checkbox-wrapper input:checked + .tv-checkbox-box {
    background: #c41e3a;
    border-color: #c41e3a;
}

.tv-checkbox-wrapper input:checked + .tv-checkbox-box svg {
    opacity: 1;
}

.tv-checkbox-text {
    line-height: 1.4;
}

/* Remember Row - Flex layout with forgot password */
.tv-remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.tv-remember-row .tv-forgot-link {
    color: #c41e3a;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

.tv-remember-row .tv-forgot-link:hover {
    color: #e31837;
    text-decoration: underline;
}

/* Links */
.tv-auth-link {
    color: #c41e3a;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.tv-auth-link:hover {
    color: #e31837;
    text-decoration: underline;
}

.tv-forgot-link {
    font-weight: 500;
    font-size: 13px;
    color: #9ca3af;
    text-decoration: none;
}

.tv-forgot-link:hover {
    color: #c41e3a;
}

/* Buttons */
.tv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tv-btn svg {
    width: 20px;
    height: 20px;
}

.tv-btn-primary {
    background: linear-gradient(135deg, #c41e3a 0%, #e31837 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(196, 30, 58, 0.3);
}

.tv-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(196, 30, 58, 0.4);
}

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

.tv-btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.tv-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
}

.tv-btn-outline {
    background: transparent;
    color: #9ca3af;
    border: 1px solid #444;
}

.tv-btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    border-color: #666;
}

.tv-btn-block {
    width: 100%;
}

.tv-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Divider */
.tv-auth-divider {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 24px 0;
    color: #6b7280;
    font-size: 13px;
}

.tv-auth-divider::before,
.tv-auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #333;
}

/* Footer Links */
.tv-auth-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #333;
}

.tv-auth-footer p {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 12px;
}

.tv-auth-footer a {
    color: #c41e3a;
    text-decoration: none;
    font-weight: 600;
}

.tv-auth-footer a.tv-btn {
    color: #ffffff;
}

.tv-auth-footer a.tv-btn:hover {
    text-decoration: none;
}

.tv-auth-footer a:hover {
    text-decoration: underline;
}

/* Page Footer */
.tv-auth-page-footer {
    text-align: center;
    margin-top: 30px;
}

.tv-auth-page-footer p {
    font-size: 13px;
    color: #6b7280;
}

.tv-auth-page-footer a {
    color: #9ca3af;
    text-decoration: none;
}

.tv-auth-page-footer a:hover {
    color: #ffffff;
}

/* Features Row */
.tv-auth-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #333;
}

.tv-auth-feature {
    text-align: center;
}

.tv-auth-feature-icon {
    font-size: 24px;
    margin-bottom: 6px;
}

.tv-auth-feature-text {
    font-size: 12px;
    color: #9ca3af;
}

/* Form Row (2 columns) */
.tv-form-row {
    display: flex;
    flex-direction: column;
}

.tv-form-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Responsive */
@media (max-width: 520px) {
    .tv-auth-card {
        padding: 30px 24px;
    }
    
    .tv-auth-header h1 {
        font-size: 22px;
    }
    
    .tv-form-row-2col {
        grid-template-columns: 1fr;
    }
    
    .tv-auth-features {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* Loading State */
.tv-auth-loading {
    position: relative;
    pointer-events: none;
}

.tv-auth-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: tv-spin 0.8s linear infinite;
}

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

/* Button Loading */
.tv-btn.tv-loading {
    color: transparent;
    position: relative;
}

.tv-btn.tv-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: tv-spin 0.8s linear infinite;
}

/* Back Link */
.tv-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #9ca3af;
    font-size: 14px;
    text-decoration: none;
    margin-bottom: 20px;
}

.tv-back-link:hover {
    color: #ffffff;
}

.tv-back-link svg {
    width: 16px;
    height: 16px;
}

/* ==========================================
   CRITICAL: Hide WordPress Admin Bar
   ========================================== */
body.tv-auth-dark #wpadminbar,
body:has(.tv-auth-card) #wpadminbar,
body:has(.tv-auth-wrapper) #wpadminbar {
    display: none !important;
}

html.tv-auth-dark,
html:has(.tv-auth-card),
html:has(.tv-auth-wrapper) {
    margin-top: 0 !important;
}

/* Hide any WordPress theme elements */
body.tv-auth-dark .site-header,
body.tv-auth-dark .site-footer,
body.tv-auth-dark header.header,
body.tv-auth-dark footer.footer,
body.tv-auth-dark nav.navigation,
body:has(.tv-auth-card) .site-header,
body:has(.tv-auth-card) .site-footer,
body:has(.tv-auth-card) header,
body:has(.tv-auth-card) footer,
body:has(.tv-auth-wrapper) .site-header,
body:has(.tv-auth-wrapper) .site-footer,
body:has(.tv-auth-wrapper) header,
body:has(.tv-auth-wrapper) footer {
    display: none !important;
}

/* ==========================================
   Checkbox Click Fix
   ========================================== */
.tv-checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.tv-checkbox-row input[type="checkbox"] {
    /* Make checkbox larger and easier to click */
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    cursor: pointer;
    accent-color: #c41e3a;
    /* Remove any pointer-events issues */
    pointer-events: auto;
    position: relative;
    z-index: 1;
}

.tv-checkbox-row label {
    cursor: pointer;
    user-select: none;
    margin: 0;
    flex: 1;
}

/* Custom checkbox styling */
.tv-custom-checkbox {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 0;
}

.tv-custom-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.tv-custom-checkbox .checkmark {
    width: 22px;
    height: 22px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid #444;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.tv-custom-checkbox:hover .checkmark {
    border-color: #c41e3a;
    background: rgba(196, 30, 58, 0.1);
}

.tv-custom-checkbox input:checked + .checkmark {
    background: #c41e3a;
    border-color: #c41e3a;
}

.tv-custom-checkbox .checkmark::after {
    content: '';
    display: none;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}

.tv-custom-checkbox input:checked + .checkmark::after {
    display: block;
}

.tv-custom-checkbox .checkbox-label {
    color: #9ca3af;
    font-size: 14px;
}

/* ==========================================
   Mobile Responsive Styles
   ========================================== */
@media (max-width: 480px) {
    body.tv-auth-dark {
        padding: 10px;
    }
    
    .tv-auth-wrapper {
        max-width: 100%;
    }
    
    .tv-auth-card {
        padding: 24px 20px;
        margin: 0;
        border-radius: 16px;
        max-width: 100%;
    }
    
    .tv-auth-header h1,
    .tv-auth-header h2 {
        font-size: 22px;
    }
    
    .tv-auth-header p {
        font-size: 14px;
    }
    
    .tv-auth-logo img {
        max-width: 180px;
        height: auto;
    }
    
    /* Stack form rows on mobile */
    .tv-form-row-responsive {
        flex-direction: column !important;
    }
    
    .tv-form-row-responsive > div {
        width: 100% !important;
        min-width: 100% !important;
    }
    
    /* Buttons */
    .tv-btn {
        font-size: 14px;
        padding: 12px 16px;
    }
    
    .tv-btn-block {
        white-space: normal;
        text-align: center;
    }
    
    /* Inputs */
    .tv-auth-form input[type="text"],
    .tv-auth-form input[type="email"],
    .tv-auth-form input[type="password"],
    .tv-auth-form input[type="tel"],
    .tv-auth-form select {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
    
    /* Plan cards */
    .tv-plan-card {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    
    .tv-plan-card .tv-plan-price {
        margin-top: 8px;
    }
}

@media (max-width: 375px) {
    .tv-auth-card {
        padding: 20px 16px;
    }
    
    .tv-auth-header h1,
    .tv-auth-header h2 {
        font-size: 20px;
    }
    
    .tv-btn {
        font-size: 13px;
        padding: 12px 14px;
    }
    
    .tv-auth-logo img {
        max-width: 150px;
    }
}

/* ==========================================
   Form Validation States
   ========================================== */
.tv-input-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.tv-input-success {
    border-color: #22c55e !important;
}

.tv-field-error {
    color: #fca5a5;
    font-size: 12px;
    margin-top: 6px;
}

/* Password strength bars */
.tv-password-strength {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.tv-strength-bar {
    flex: 1;
    height: 3px;
    background: #333;
    border-radius: 2px;
    transition: background 0.2s;
}

/* Toggle password visibility button */
.tv-toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    font-size: 16px;
}

.tv-toggle-password:hover {
    color: #e5e7eb;
}

/* ==========================================
   Enhanced Notification Animations
   ========================================== */
.tv-auth-alert,
.tv-error-message,
.tv-success-message {
    animation: tv-slideDown 0.3s ease-out;
}

@keyframes tv-slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Shake animation for error states */
@keyframes tv-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.tv-auth-form.tv-shake {
    animation: tv-shake 0.5s ease-out;
}

/* Input error highlight */
.tv-auth-form input.tv-input-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* Rate limit warning styling */
.tv-auth-alert-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fcd34d;
}

/* Locked out state */
.tv-btn.tv-btn-locked {
    background: #333 !important;
    box-shadow: none !important;
    cursor: not-allowed !important;
    transform: none !important;
}

.tv-btn.tv-btn-locked:hover {
    transform: none !important;
    box-shadow: none !important;
}
