/**
 * Auth Modern CSS - Login & Register Sayfaları
 * ÇiftçidenEve Design System
 *
 * Mobile-first, modern tasarım
 */

/* ========================================
   CSS Variables
   ======================================== */
:root {
    --auth-primary: #1A6355;
    --auth-accent: #b9475e;
    --auth-accent-hover: #e79275;
    --auth-bg-soft: #FFF3E5;
    --auth-bg-white: #ffffff;
    --auth-text-primary: #1A6355;
    --auth-text-secondary: #596b7c;
    --auth-text-muted: #7d91a3;
    --auth-border: #d4dade;
    --auth-border-focus: #1A6355;
    --auth-border-error: #b9475e;
    --auth-shadow: 0 4px 24px rgba(26, 99, 85, 0.08);
    --auth-shadow-hover: 0 8px 32px rgba(26, 99, 85, 0.12);
    --auth-radius: 16px;
    --auth-radius-sm: 12px;
    --auth-radius-xs: 8px;
    --auth-input-height: 54px;
    --auth-spacing-xs: 8px;
    --auth-spacing-sm: 12px;
    --auth-spacing-md: 16px;
    --auth-spacing-lg: 24px;
    --auth-spacing-xl: 32px;
    --auth-transition: all 0.2s ease;
}

/* ========================================
   Auth Container
   ======================================== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--auth-bg-soft) 0%, #fff 100%);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--auth-bg-white);
    border-radius: var(--auth-radius);
    box-shadow: var(--auth-shadow);
    padding: var(--auth-spacing-lg);
    transition: var(--auth-transition);
}

.auth-card:hover {
    box-shadow: var(--auth-shadow-hover);
}

/* ========================================
   Auth Header
   ======================================== */
.auth-header {
    text-align: center;
    margin-bottom: var(--auth-spacing-xl);
}

.auth-logo {
    width: 80px;
    height: auto;
    margin-bottom: var(--auth-spacing-md);
}

.auth-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 28px;
    font-weight: 600;
    color: var(--auth-text-primary);
    margin: 0 0 var(--auth-spacing-xs);
}

.auth-subtitle {
    font-family: 'Fira Sans', sans-serif;
    font-size: 15px;
    color: var(--auth-text-muted);
    margin: 0;
}

/* ========================================
   Auth Tabs (Login/Register Switch)
   ======================================== */
.auth-tabs {
    display: flex;
    background: var(--auth-bg-soft);
    border-radius: var(--auth-radius-sm);
    padding: 4px;
    margin-bottom: var(--auth-spacing-lg);
}

.auth-tab {
    flex: 1;
    padding: 12px 16px;
    text-align: center;
    font-family: 'Fira Sans', sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: var(--auth-text-secondary);
    text-decoration: none;
    border-radius: var(--auth-radius-xs);
    transition: var(--auth-transition);
}

.auth-tab:hover {
    color: var(--auth-text-primary);
}

.auth-tab.active {
    background: var(--auth-bg-white);
    color: var(--auth-text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ========================================
   Form Elements
   ======================================== */
.auth-form-group {
    margin-bottom: var(--auth-spacing-md);
}

.auth-label {
    display: block;
    font-family: 'Fira Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--auth-text-primary);
    margin-bottom: var(--auth-spacing-xs);
}

.auth-input-wrapper {
    position: relative;
}

.auth-input {
    width: 100%;
    height: var(--auth-input-height);
    padding: 0 16px;
    font-family: 'Fira Sans', sans-serif;
    font-size: 16px;
    color: var(--auth-text-primary);
    background: var(--auth-bg-white);
    border: 2px solid var(--auth-border);
    border-radius: var(--auth-radius-sm);
    outline: none;
    transition: var(--auth-transition);
    box-sizing: border-box;
}

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

.auth-input:focus {
    border-color: var(--auth-border-focus);
    box-shadow: 0 0 0 4px rgba(26, 99, 85, 0.1);
}

.auth-input.error {
    border-color: var(--auth-border-error);
    background: #fff8f8;
}

.auth-input.error:focus {
    box-shadow: 0 0 0 4px rgba(185, 71, 94, 0.1);
}

/* Password Toggle */
.auth-password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--auth-text-muted);
    transition: var(--auth-transition);
}

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

.auth-password-toggle svg {
    width: 20px;
    height: 20px;
    display: block;
}

.auth-input[type="password"] ~ .auth-password-toggle .icon-hide,
.auth-input[type="text"] ~ .auth-password-toggle .icon-show {
    display: none;
}

.auth-input[type="password"] ~ .auth-password-toggle .icon-show,
.auth-input[type="text"] ~ .auth-password-toggle .icon-hide {
    display: block;
}

/* Phone Input with International Country Code */
.auth-phone-wrapper {
    display: flex;
    align-items: center;
}

.auth-country-select {
    height: var(--auth-input-height);
    padding: 0 8px 0 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Fira Sans', sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: var(--auth-text-primary);
    background: var(--auth-bg-soft);
    border: 2px solid var(--auth-border);
    border-right: none;
    border-radius: var(--auth-radius-sm) 0 0 var(--auth-radius-sm);
    cursor: pointer;
    transition: var(--auth-transition);
    position: relative;
    min-width: 95px;
}

.auth-country-select:hover {
    background: #f5ebe0;
}

.auth-country-flag {
    font-size: 20px;
    line-height: 1;
}

.auth-country-code {
    font-size: 14px;
    color: var(--auth-text-secondary);
}

.auth-country-arrow {
    width: 12px;
    height: 12px;
    color: var(--auth-text-muted);
    transition: var(--auth-transition);
}

.auth-country-select.open .auth-country-arrow {
    transform: rotate(180deg);
}

/* Country Dropdown */
.auth-country-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 280px;
    max-height: 300px;
    overflow-y: auto;
    background: var(--auth-bg-white);
    border: 2px solid var(--auth-border);
    border-radius: var(--auth-radius-sm);
    box-shadow: var(--auth-shadow);
    z-index: 1000;
    display: none;
}

.auth-country-dropdown.show {
    display: block;
}

.auth-country-search {
    position: sticky;
    top: 0;
    background: var(--auth-bg-white);
    padding: 8px;
    border-bottom: 1px solid var(--auth-border);
}

.auth-country-search input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    font-family: 'Fira Sans', sans-serif;
    font-size: 14px;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-xs);
    outline: none;
}

.auth-country-search input:focus {
    border-color: var(--auth-primary);
}

.auth-country-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: var(--auth-transition);
}

.auth-country-option:hover {
    background: var(--auth-bg-soft);
}

.auth-country-option.selected {
    background: rgba(26, 99, 85, 0.1);
}

.auth-country-option-flag {
    font-size: 20px;
}

.auth-country-option-name {
    flex: 1;
    font-size: 14px;
    color: var(--auth-text-primary);
}

.auth-country-option-code {
    font-size: 13px;
    color: var(--auth-text-muted);
}

.auth-phone-wrapper .auth-input {
    border-radius: 0 var(--auth-radius-sm) var(--auth-radius-sm) 0;
}

/* Hidden input for country code */
.auth-phone-country-input {
    display: none;
}

/* Error Message */
.auth-error {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: var(--auth-spacing-sm) var(--auth-spacing-md);
    background: #fff0f0;
    border: 1px solid #ffcdd2;
    border-radius: var(--auth-radius-xs);
    margin-bottom: var(--auth-spacing-md);
}

.auth-error-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: var(--auth-border-error);
}

.auth-error-text {
    font-family: 'Fira Sans', sans-serif;
    font-size: 14px;
    color: var(--auth-border-error);
    line-height: 1.4;
}

/* Field Error (inline) */
.auth-field-error {
    font-family: 'Fira Sans', sans-serif;
    font-size: 13px;
    color: var(--auth-border-error);
    margin-top: 6px;
}

/* ========================================
   Checkbox & Radio
   ======================================== */
.auth-checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.auth-checkbox {
    width: 20px;
    height: 20px;
    margin: 0;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--auth-primary);
}

.auth-checkbox-label {
    font-family: 'Fira Sans', sans-serif;
    font-size: 14px;
    color: var(--auth-text-secondary);
    line-height: 1.4;
    cursor: pointer;
}

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

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

/* ========================================
   Row Utilities
   ======================================== */
.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--auth-spacing-md);
    margin-bottom: var(--auth-spacing-md);
}

.auth-link {
    font-family: 'Fira Sans', sans-serif;
    font-size: 14px;
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--auth-transition);
}

.auth-link:hover {
    color: var(--auth-accent);
    text-decoration: underline;
}

/* ========================================
   Buttons
   ======================================== */
.auth-btn {
    width: 100%;
    height: var(--auth-input-height);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: 'Fira Sans', sans-serif;
    font-size: 16px;
    font-weight: 600;
    border: 2px solid transparent;
    border-radius: var(--auth-radius-sm);
    cursor: pointer;
    transition: var(--auth-transition);
    text-decoration: none;
}

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

/* Primary Button */
.auth-btn-primary {
    background: var(--auth-accent);
    color: #fff;
    border-color: var(--auth-accent);
}

.auth-btn-primary:hover:not(:disabled) {
    background: var(--auth-accent-hover);
    border-color: var(--auth-accent-hover);
}

/* Secondary Button */
.auth-btn-secondary {
    background: var(--auth-bg-white);
    color: var(--auth-text-primary);
    border-color: var(--auth-border);
}

.auth-btn-secondary:hover:not(:disabled) {
    background: var(--auth-bg-soft);
    border-color: var(--auth-primary);
}

/* ========================================
   Divider
   ======================================== */
.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--auth-spacing-md);
    margin: var(--auth-spacing-lg) 0;
}

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

.auth-divider-text {
    font-family: 'Fira Sans', sans-serif;
    font-size: 13px;
    color: var(--auth-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   Social Buttons
   ======================================== */
.auth-social-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--auth-spacing-sm);
    margin-top: var(--auth-spacing-lg);
}

.auth-social-btn {
    width: 100%;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-family: 'Fira Sans', sans-serif;
    font-size: 15px;
    font-weight: 500;
    border: 2px solid var(--auth-border);
    border-radius: var(--auth-radius-sm);
    background: var(--auth-bg-white);
    color: var(--auth-text-primary);
    cursor: pointer;
    transition: var(--auth-transition);
    text-decoration: none;
}

.auth-social-btn:hover {
    background: var(--auth-bg-soft);
    border-color: var(--auth-primary);
}

.auth-social-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Google Button */
.auth-social-btn-google:hover {
    border-color: #4285f4;
}

/* Apple Button */
.auth-social-btn-apple:hover {
    border-color: #000;
}

/* Facebook Button */
.auth-social-btn-facebook:hover {
    border-color: #1877f2;
}

/* ========================================
   Cloudflare Turnstile
   ======================================== */
.auth-turnstile {
    display: flex;
    justify-content: center;
    margin: var(--auth-spacing-md) 0;
}

.auth-turnstile iframe {
    border-radius: var(--auth-radius-xs) !important;
}

/* ========================================
   Footer Links
   ======================================== */
.auth-footer {
    text-align: center;
    margin-top: var(--auth-spacing-lg);
    padding-top: var(--auth-spacing-lg);
    border-top: 1px solid var(--auth-border);
}

.auth-footer-text {
    font-family: 'Fira Sans', sans-serif;
    font-size: 14px;
    color: var(--auth-text-muted);
}

.auth-footer-text a {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 600;
}

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

/* ========================================
   Loading State
   ======================================== */
.auth-btn-loading {
    position: relative;
    color: transparent !important;
}

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

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

/* ========================================
   Terms Section
   ======================================== */
.auth-terms {
    margin: var(--auth-spacing-md) 0;
}

.auth-terms-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: var(--auth-spacing-sm);
}

.auth-terms-item:last-child {
    margin-bottom: 0;
}

/* ========================================
   Password Strength Indicator
   ======================================== */
.auth-password-strength {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

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

.auth-strength-bar.active {
    background: var(--auth-border-error);
}

.auth-strength-bar.active.medium {
    background: #f59e0b;
}

.auth-strength-bar.active.strong {
    background: #10b981;
}

.auth-strength-text {
    font-size: 12px;
    color: var(--auth-text-muted);
    margin-top: 4px;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 480px) {
    .auth-container {
        padding: 16px;
        align-items: flex-start;
        padding-top: 40px;
    }

    .auth-card {
        padding: 20px;
        border-radius: var(--auth-radius-sm);
    }

    .auth-title {
        font-size: 24px;
    }

    .auth-tabs {
        margin-bottom: var(--auth-spacing-md);
    }

    .auth-tab {
        padding: 10px 12px;
        font-size: 14px;
    }

    .auth-row {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--auth-spacing-sm);
    }

    .auth-social-buttons {
        gap: var(--auth-spacing-xs);
    }
}

@media (min-width: 768px) {
    .auth-card {
        padding: var(--auth-spacing-xl) 40px;
    }

    .auth-logo {
        width: 100px;
    }

    .auth-title {
        font-size: 32px;
    }
}

/* ========================================
   Animation
   ======================================== */
.auth-fade-in {
    animation: authFadeIn 0.3s ease;
}

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

/* ========================================
   Popup Mode Overrides (MagnificPopup)
   ======================================== */

/* MagnificPopup full centering - target all wrapper levels */
.mfp-wrap {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.mfp-container {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
}

.mfp-content {
    position: relative !important;
    max-width: 480px !important;
    width: 100% !important;
    margin: 0 auto !important;
}

/* Ensure popup has proper background overlay */
.mfp-bg {
    background: rgba(0, 0, 0, 0.6) !important;
}

/* Center the popup card */
.auth-card.auth-popup {
    max-width: 440px;
    width: 100%;
    margin: 0 auto;
    background: var(--auth-bg-white);
    border-radius: var(--auth-radius);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    padding: var(--auth-spacing-lg);
    position: relative;
}

/* Close button inside auth-popup */
.auth-popup .mfp-close {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    width: 36px !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    color: var(--auth-text-muted) !important;
    background: var(--auth-bg-soft) !important;
    border: none !important;
    border-radius: 50% !important;
    opacity: 1 !important;
    transition: var(--auth-transition) !important;
    cursor: pointer !important;
    z-index: 10 !important;
    font-size: 0 !important; /* Hide any text content */
    line-height: 1 !important;
}

.auth-popup .mfp-close svg {
    width: 18px !important;
    height: 18px !important;
    stroke: currentColor !important;
    display: block !important;
}

.auth-popup .mfp-close:hover {
    color: var(--auth-accent) !important;
    background: #ffe4dc !important;
}

/* Mobile popup - full screen with scroll */
@media (max-width: 500px) {
    .mfp-wrap {
        align-items: flex-start !important;
    }

    .mfp-container {
        padding: 0 !important;
        min-height: 100vh !important;
        align-items: flex-start !important;
    }

    .mfp-content {
        max-width: 100% !important;
        min-height: 100vh !important;
    }

    .auth-card.auth-popup {
        padding: var(--auth-spacing-md);
        border-radius: 0;
        min-height: 100vh;
        max-width: 100%;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
    }

    /* Adjust header padding for close button */
    .auth-popup .auth-header {
        padding-top: 30px;
    }

    /* Move close button to top-right corner */
    .auth-popup .mfp-close {
        top: 10px !important;
        right: 10px !important;
        width: 40px !important;
        height: 40px !important;
        background: rgba(0, 0, 0, 0.05) !important;
    }

    .auth-popup .mfp-close svg {
        width: 20px !important;
        height: 20px !important;
    }

    /* Make form take available space */
    .auth-popup form {
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    /* Push footer to bottom */
    .auth-popup .auth-footer {
        margin-top: auto;
    }
}
