/* ============================================
   LOGIN PAGE - Modern Design 2026
   Light Theme Default - Green Accent
   ============================================ */

/* CSS Variables */
:root {
    --primary-color: #4a9d3f;
    --primary-gradient: linear-gradient(135deg, #4a9d3f 0%, #68b35a 100%);
    --primary-glow: rgba(74, 157, 63, 0.3);
    
    --bg-body: #f5f5f5;
    --bg-body-gradient: 
        radial-gradient(ellipse at 20% 20%, rgba(74, 157, 63, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(74, 157, 63, 0.04) 0%, transparent 50%);
    --bg-card: #ffffff;
    --bg-input: #f0f2f5;
    
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a68;
    --text-muted: #8c8ca1;
    --text-label: #1a1a2e;
    
    --border-glass: rgba(0, 0, 0, 0.08);
    --border-input: rgba(0, 0, 0, 0.12);
    --border-focus: rgba(74, 157, 63, 0.6);
    
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 40px rgba(74, 157, 63, 0.1);
    --shadow-btn: 0 4px 15px rgba(74, 157, 63, 0.3);
    
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;
    
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-body);
    background-image: var(--bg-body-gradient);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-primary);
    padding: 20px;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==== LOGO ==== */
.form-logo {
    margin-bottom: 32px;
    animation: logoFadeIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    justify-content: center;
    align-items: center;
}

.form-logo img {
    max-width: 320px;
    width: 100%;
    height: auto;
    max-height: 120px;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.1));
    transition: transform var(--transition), filter var(--transition);
}

.form-logo img:hover {
    transform: scale(1.02);
    filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.15));
}

@keyframes logoFadeIn {
    0% {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==== CONTENEDOR DEL FORMULARIO ==== */
.form-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-card), var(--shadow-glow);
    position: relative;
    transition: transform var(--transition), box-shadow var(--transition);
    animation: formSlideIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s backwards;
}

@keyframes formSlideIn {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.form-container:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.12),
        0 0 60px rgba(74, 157, 63, 0.12);
}

.form-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* ==== GRUPO DE CAMPO ==== */
.form-group {
    margin-bottom: 24px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-label);
    letter-spacing: 0.3px;
}

/* ==== ESTILO COMÚN PARA INPUTS ==== */
input[type="text"],
input[type="email"],
input[type="tel"] {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 15px;
    transition: all var(--transition);
}

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

input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(74, 157, 63, 0.15), 0 4px 12px rgba(74, 157, 63, 0.08);
    background: #ffffff;
}

/* ==== WRAPPER PARA DROPDOWN DE PAÍS ==== */
.phone-group {
    display: flex;
    gap: 10px;
    align-items: center;
    position: relative;
}

.country-button {
    min-width: 85px;
    height: 48px;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    white-space: nowrap;
    gap: 6px;
}

.country-button:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(74, 157, 63, 0.15);
    background: #ffffff;
}

.country-button:hover {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.2);
}

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

.country-button span.code {
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
}

.country-button::after {
    content: "▼";
    font-size: 8px;
    color: var(--text-muted);
    margin-left: 2px;
}

/* ==== DROPDOWN DE PAÍS PERSONALIZADO ==== */
.country-list {
    position: absolute;
    top: 54px;
    left: 0;
    width: 280px;
    max-height: 240px;
    background: #ffffff;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    animation: dropdownFadeIn 0.2s ease;
}

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

.country-list .country-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    transition: background 0.15s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.country-list .country-item:last-child {
    border-bottom: none;
}

.country-list .country-item:hover,
.country-list .country-item.active {
    background: rgba(74, 157, 63, 0.1);
}

.country-list .country-flag {
    font-size: 20px;
    width: 28px;
    text-align: center;
}

.country-list .country-code {
    width: 55px;
    text-align: left;
    font-weight: 600;
    color: var(--primary-color);
}

.country-list .country-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
}

/* Scrollbar interno */
.country-list::-webkit-scrollbar {
    width: 6px;
}

.country-list::-webkit-scrollbar-track {
    background: transparent;
}

.country-list::-webkit-scrollbar-thumb {
    background: rgba(74, 157, 63, 0.4);
    border-radius: var(--radius-full);
}

.country-list::-webkit-scrollbar-thumb:hover {
    background: rgba(74, 157, 63, 0.6);
}

/* ==== BOTÓN ENVIAR ==== */
button[type="submit"] {
    width: 100%;
    padding: 16px;
    background: var(--primary-gradient);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    margin-top: 8px;
    box-shadow: var(--shadow-btn);
    position: relative;
    overflow: hidden;
}

button[type="submit"]::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s;
}

button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(74, 157, 63, 0.4);
}

button[type="submit"]:hover::before {
    opacity: 1;
}

button[type="submit"]:active {
    transform: translateY(0) scale(0.98);
}

/* ==== MODAL DE ÉXITO / ERROR ==== */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: var(--radius-lg);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: modalPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-content.success {
    background: linear-gradient(135deg, #4a9d3f 0%, #68b35a 100%);
    box-shadow: 0 4px 20px rgba(74, 157, 63, 0.4);
}

.modal-content.error {
    background: linear-gradient(135deg, #e53935 0%, #c62828 100%);
    box-shadow: 0 4px 20px rgba(229, 57, 53, 0.4);
}

.modal-content::before {
    content: "";
    width: 36px;
    height: 36px;
    display: block;
}

.modal-content.success::before {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") no-repeat center;
}

.modal-content.error::before {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E") no-repeat center;
}

/* ==== RESPONSIVE ==== */
@media (max-width: 480px) {
    body {
        padding: 16px;
    }
    
    .form-logo img {
        max-width: 260px;
    }
    
    .form-container {
        padding: 32px 24px;
        border-radius: var(--radius-md);
    }
    
    .country-list {
        width: 100%;
        left: 0;
        right: 0;
    }
}

@media (max-width: 360px) {
    .form-logo img {
        max-width: 220px;
    }
    
    .form-container {
        padding: 28px 20px;
    }
    
    .country-button {
        min-width: 75px;
    }
}

/* Large screens */
@media (min-width: 768px) {
    .form-logo img {
        max-width: 380px;
    }
    
    .form-container {
        max-width: 440px;
        padding: 48px 40px;
    }
}

/* ==== ACCESSIBILITY ==== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

::selection {
    background: rgba(74, 157, 63, 0.3);
    color: var(--text-primary);
}