/**
 * UI Components & Utilities
 * Loading, Toast, Modal, Progress Bar, Fake reCAPTCHA
 * 
 * @author  Umut
 * @version 1.0.0
 */

/* ==========================================
   Loading Spinner
   ========================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    text-align: center;
    color: white;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 16px;
    font-weight: 600;
    color: white;
}

/* ==========================================
   Toast Notifications
   ========================================== */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast-item {
    min-width: 300px;
    max-width: 400px;
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-item.removing {
    animation: slideOutRight 0.3s ease forwards;
}

@keyframes slideOutRight {
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 14px;
}

.toast-item.success .toast-icon {
    background: #10B981;
    color: white;
}

.toast-item.error .toast-icon {
    background: #EF4444;
    color: white;
}

.toast-item.warning .toast-icon {
    background: #F59E0B;
    color: white;
}

.toast-item.info .toast-icon {
    background: #3B82F6;
    color: white;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.toast-message {
    font-size: 13px;
    color: #64748B;
}

.toast-close {
    background: none;
    border: none;
    color: #94A3B8;
    cursor: pointer;
    padding: 0;
    font-size: 20px;
    line-height: 1;
}

.toast-close:hover {
    color: #334155;
}

/* ==========================================
   Progress Bar (Modern & Professional)
   ========================================== */

.progress-steps {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    margin-bottom: 48px;
    position: relative;
    background: #fff;
    padding: 24px 32px;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    position: relative;
}

.progress-step:not(:last-child)::after {
    content: '';
    position: absolute;
    right: -30px;
    width: 60px;
    height: 2px;
    background: #e2e8f0;
    transition: background 0.3s ease;
}

.progress-step.completed:not(:last-child)::after {
    background: linear-gradient(90deg, #10b981, var(--brand-600, #4f46e5));
}

.progress-step-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 3px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: #94a3b8;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.progress-step.active .progress-step-circle {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.progress-step.completed .progress-step-circle {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.progress-step-label {
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
}

.progress-step.active .progress-step-label {
    color: #0f172a;
    font-weight: 700;
}

.progress-step.completed .progress-step-label {
    color: #0f172a;
}

/* ==========================================
   Security Verification (Minimal & Modern)
   ========================================== */

.g-recaptcha {
    width: 100%;
    max-width: 400px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    position: relative;
    padding: 18px 20px;
    transition: all 0.3s ease;
}

.g-recaptcha:hover {
    border-color: #cbd5e1;
}

.g-recaptcha.success {
    background: #f0fdf4;
    border-color: #86efac;
}

.recaptcha-inner {
    display: flex;
    align-items: center;
    gap: 14px;
}

.recaptcha-checkbox-border {
    width: 28px;
    height: 28px;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    flex-shrink: 0;
}

.g-recaptcha:hover .recaptcha-checkbox-border {
    border-color: #94a3b8;
}

.recaptcha-checkbox-border.checked {
    background: #10b981;
    border-color: #10b981;
}

.recaptcha-checkbox-checkmark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 18px;
    height: 18px;
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.recaptcha-checkbox-border.checked .recaptcha-checkbox-checkmark {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.recaptcha-checkbox-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid var(--brand-600, #4f46e5);
    border-radius: 50%;
    animation: recaptcha-spin 0.7s linear infinite;
    opacity: 0;
}

.recaptcha-checkbox-border.loading .recaptcha-checkbox-spinner {
    opacity: 1;
}

@keyframes recaptcha-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.recaptcha-text-container {
    flex: 1;
}

.recaptcha-text {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
    user-select: none;
    letter-spacing: -0.01em;
}

.recaptcha-text-sub {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #64748b;
    margin-top: 3px;
}

.recaptcha-icon-shield {
    width: 22px;
    height: 22px;
    color: var(--brand-600, #4f46e5);
    flex-shrink: 0;
}

.g-recaptcha.success .recaptcha-icon-shield {
    color: #10b981;
}

/* Hidden real checkbox */
.g-recaptcha input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* ==========================================
   Custom Modal
   ========================================== */

.custom-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.custom-modal.active {
    display: flex;
    opacity: 1;
}

.custom-modal-content {
    background: white;
    border-radius: 16px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.custom-modal.active .custom-modal-content {
    transform: scale(1);
}

.custom-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #F1F5F9;
}

.custom-modal-title {
    font-size: 24px;
    font-weight: 700;
    color: #0F172A;
}

.custom-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #94A3B8;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.custom-modal-close:hover {
    background: #F1F5F9;
    color: #0F172A;
}

.custom-modal-body {
    color: #475569;
    line-height: 1.6;
}

/* ==========================================
   Card Components
   ========================================== */

.feature-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    border: 1px solid #E2E8F0;
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.feature-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.feature-card-title {
    font-size: 18px;
    font-weight: 700;
    color: #0F172A;
    margin-bottom: 8px;
}

.feature-card-text {
    font-size: 14px;
    color: #64748B;
    line-height: 1.6;
}

/* ==========================================
   Responsive
   ========================================== */

@media (max-width: 768px) {
    .toast-container {
        right: 10px;
        left: 10px;
    }
    
    .toast-item {
        min-width: auto;
        max-width: 100%;
    }
    
    .g-recaptcha {
        width: 100%;
        max-width: 400px;
    }
    
    .progress-steps {
        padding: 20px 16px;
        overflow-x: auto;
        justify-content: flex-start;
    }
    
    .progress-step {
        padding: 0 12px;
    }
    
    .progress-step:not(:last-child)::after {
        width: 40px;
        right: -20px;
    }
    
    .progress-step-circle {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .progress-step-label {
        font-size: 12px;
    }
}

/* ==========================================
   Skeleton Loading
   ========================================== */

.skeleton {
    background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

/* ==========================================
   Pulse Animation
   ========================================== */

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ==========================================
   Fade Animations
   ========================================== */

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* ==========================================
   Button Loading State
   ========================================== */

.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

