/* Variables CSS para temas */
:root {
    /* Tema Claro (por defecto) */
    --bg-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-secondary: #ffffff;
    --bg-tertiary: #f8f9ff;
    --bg-quaternary: #f0f0f0;
    
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --text-white: #ffffff;
    
    --accent-primary: #667eea;
    --accent-secondary: #764ba2;
    --accent-success: #4caf50;
    --accent-warning: #ff9800;
    --accent-error: #f44336;
    
    --border-color: #e1e1e1;
    --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 10px 30px rgba(0, 0, 0, 0.15);
    --shadow-heavy: 0 20px 40px rgba(0, 0, 0, 0.2);
    
    --border-radius: 12px;
    --border-radius-large: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tema Oscuro */
:root[data-theme="dark"] {
    --bg-primary: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --bg-secondary: #2d2d44;
    --bg-tertiary: #3a3a5c;
    --bg-quaternary: #4a4a6a;
    
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --text-muted: #a0a0a0;
    --text-white: #ffffff;
    
    --accent-primary: #8b9dc3;
    --accent-secondary: #9f7aea;
    
    --border-color: #4a4a6a;
    --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.3);
    --shadow-medium: 0 10px 30px rgba(0, 0, 0, 0.4);
    --shadow-heavy: 0 20px 40px rgba(0, 0, 0, 0.5);
}

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

html {
    width: 100%;
    overflow-x: hidden; 
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-primary);
    transition: var(--transition);
    line-height: 1.6;
    width: 100%;
    overflow-x: hidden; 
    position: relative;
}

/* Header */
.header {
    background: var(--bg-secondary);
    box-shadow: var(--shadow-light);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.developer-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar {
    font-size: 3rem;
    color: var(--accent-primary);
    transition: var(--transition);
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    box-shadow: var(--shadow-light);
}

.avatar:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-medium);
}

.profile-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    transition: var(--transition);
}

.profile-image:hover {
    transform: scale(1.05);
}

.dev-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.dev-title {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Redes Sociales */
.social-links {
    display: flex;
    gap: 0.5rem;
}

.social-link {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-white);
    font-size: 1.2rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.social-link:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    transform: scale(0);
    transition: var(--transition);
    z-index: -1;
}

.social-link.linkedin {
    background: linear-gradient(45deg, #0077b5, #00a0dc);
}

.social-link.github {
    background: linear-gradient(45deg, #333, #666);
}

.social-link.telegram {
    background: linear-gradient(45deg, #0088cc, #00aaff);
}

.social-link.whatsapp {
    background: linear-gradient(45deg, #25d366, #128c7e);
}

.social-link:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: var(--shadow-medium);
}


.theme-toggle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-light);
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-medium);
}


.theme-toggle .sun-icon,
.theme-toggle .moon-icon {
    position: absolute;
    transition: all 0.3s ease;
}

:root .theme-toggle .sun-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

:root .theme-toggle .moon-icon {
    opacity: 0;
    transform: rotate(-90deg) scale(0.8);
}

/* Modo oscuro: mostrar luna, ocultar sol */
:root[data-theme="dark"] .theme-toggle .sun-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0.8);
}

:root[data-theme="dark"] .theme-toggle .moon-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Contenedor principal */
.main-container {
    padding: 2rem;
    min-height: calc(100vh - 120px);
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.container {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-large);
    box-shadow: var(--shadow-heavy);
    padding: 3rem;
    max-width: 600px;
    width: 100%;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    margin: 0 auto; 
    box-sizing: border-box; 
}

.app-header {
    text-align: center;
    margin-bottom: 2rem;
}

.title {
    color: var(--text-primary);
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 400;
}

/* Sección de entrada */
.input-section {
    margin-bottom: 2rem;
}

.input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.input-wrapper {
    flex: 1;
    position: relative;
    min-width: 250px;
}

#nameInput {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: var(--transition);
}

#nameInput:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: var(--transition);
}

#nameInput:focus + .input-icon {
    color: var(--accent-primary);
}

/* Botones */
.btn {
    padding: 1rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    white-space: nowrap;
}

.btn-add {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: var(--text-white);
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.btn-sort {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: var(--text-white);
    width: 100%;
    margin-top: 1.5rem;
    font-size: 1.1rem;
    padding: 1.2rem;
    justify-content: center;
}

.btn-sort:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

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

/* Estadísticas */
.stats {
    display: flex;
    justify-content: space-around;
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.stat {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.stat-icon {
    font-size: 1.5rem;
    color: var(--accent-primary);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Lista de amigos */
.friends-list {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin: 1.5rem 0;
    min-height: 120px;
    border: 2px dashed var(--border-color);
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.list-header h3 {
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
}

.btn-clear {
    background: var(--accent-error);
    color: var(--text-white);
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    opacity: 0;
    visibility: hidden;
}

.btn-clear.visible {
    opacity: 1;
    visibility: visible;
}

.btn-clear:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-light);
}

.friend-item {
    background: var(--bg-secondary);
    padding: 1rem 1.2rem;
    margin: 0.8rem 0;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--accent-primary);
    box-shadow: var(--shadow-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transition: var(--transition);
}

.friend-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-medium);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.friend-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 1rem;
}

.friend-number {
    background: var(--accent-primary);
    color: var(--text-white);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-subtitle {
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Alertas */
.alert {
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    color: var(--accent-error);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
    border-left: 4px solid var(--accent-error);
    display: none;
    font-weight: 500;
}

.alert.show {
    display: block;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Sección de resultados */
.result-section {
    margin-top: 2rem;
    padding: 0;
    background: transparent;
    border-radius: var(--border-radius);
    display: none;
    text-align: center;
}

.result-section.show {
    display: block;
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.result-content {
    background: linear-gradient(135deg, #a8edea, #fed6e3);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
}

.result-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.result-title {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 1rem;
    font-weight: 600;
}

.result-name {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-primary);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
    word-break: break-word;
}

.btn-new-draw {
    background: var(--accent-success);
    color: var(--text-white);
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 auto;
    transition: var(--transition);
}

.btn-new-draw:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-light);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-tech {
    display: flex;
    gap: 0.5rem;
    font-size: 1.5rem;
}

.footer-tech i {
    color: var(--text-muted);
    transition: var(--transition);
}

.footer-tech i:hover {
    transform: scale(1.2);
}

.fa-html5:hover { color: #e34f26; }
.fa-css3-alt:hover { color: #1572b6; }
.fa-js-square:hover { color: #f7df1e; }

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        padding: 1rem;
        text-align: center;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    
    .developer-info {
        flex-direction: column;
        text-align: center;
        align-items: center;
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .avatar {
        margin-bottom: 0.5rem;
    }
    
    .dev-name {
        font-size: 1.3rem;
    }
    
    .header-controls {
        align-items: center;
        justify-content: center;
        width: 100%;
    }
    
    .main-container {
        padding: 1rem;
        align-items: flex-start; 
        min-height: calc(100vh - 140px);
    }
    
    .container {
        padding: 2rem 1.5rem;
        margin: 1rem auto; 
        max-width: 100%;
        width: calc(100vw - 2rem); 
    }
    
    .title {
        font-size: 2rem;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .input-wrapper {
        min-width: auto;
        width: 100%;
    }
    
    .stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .stat {
        flex-direction: row;
        justify-content: center;
    }
    
    .result-name {
        font-size: 2rem;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .header-content {
        padding: 0.8rem;
        gap: 1rem;
    }
    
    .developer-info {
        align-items: center;
        justify-content: center;
        text-align: center;
        width: 100%;
    }
    
    .social-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .header-controls {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
        align-items: center;
        justify-content: center;
    }
    
    .main-container {
        padding: 0.5rem;
    }
    
    .container {
        padding: 1.5rem 1rem;
        margin: 0.5rem auto;
        width: calc(100vw - 1rem);
        border-radius: 15px;
    }
    
    .title {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .app-header {
        margin-bottom: 1.5rem;
    }
}


@media (max-width: 360px) {
    .header-content {
        padding: 0.5rem;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
    
    .developer-info {
        align-items: center;
        justify-content: center;
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .avatar {
        width: 60px;
        height: 60px;
        margin-bottom: 0.5rem;
    }
    
    .dev-name {
        font-size: 1.1rem;
        text-align: center;
    }
    
    .dev-title {
        font-size: 0.8rem;
        text-align: center;
    }
    
    .header-controls {
        width: 100%;
        align-items: center;
        justify-content: center;
    }
    
    .social-links {
        justify-content: center;
        gap: 0.3rem;
    }
    
    .social-link {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .theme-toggle {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .main-container {
        padding: 0.25rem;
        justify-content: center;
        align-items: center;
    }
    
    .container {
        width: calc(100vw - 0.5rem);
        max-width: none;
        margin: 0 auto;
    }
}