/* ============================================
   WEATHERAPP - ESTILOS COMPLETOS
   Desarrollado por: Jorge Sandoval
   ============================================ */

/* ========== VARIABLES CSS ========== */
:root {
    /* Colores principales */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    
    /* Fondos */
    --body-bg: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --weather-detail-bg: #f8f9fa;
    
    /* Texto */
    --text-color: #2c3e50;
    --text-muted: #6c757d;
    
    /* Footer */
    --footer-bg: #1a1a2e;
    
    /* Sombras */
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 5px 15px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.2);
    
    /* Transiciones */
    --transition-fast: 0.3s ease;
    --transition-smooth: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Bordes */
    --border-radius: 15px;
    --border-radius-sm: 10px;
}

/* ========== ESTILOS BASE ========== */
* {
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

body {
    background: var(--body-bg);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========== NAVBAR ========== */
.navbar {
    background: var(--primary-gradient) !important;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
}

.navbar.sticky-top {
    z-index: 1030;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: -0.5px;
}

.navbar-brand:hover {
    transform: scale(1.05);
    transition: transform var(--transition-fast);
}

.navbar .nav-link {
    border-radius: 8px;
    padding: 0.5rem 1rem;
    transition: all var(--transition-fast);
}

.navbar .nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.navbar .btn-outline-light {
    border-radius: 20px;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
}

.navbar .btn-outline-light:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Select en navbar */
#navCitySelect {
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
}

#navCitySelect:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.3);
}

/* Dropdown del navbar */
.dropdown-menu {
    border: none;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-md);
    animation: dropdownFade 0.3s ease;
}

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

.dropdown-item {
    padding: 0.6rem 1.2rem;
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--primary-gradient);
    color: white;
    padding-left: 1.5rem;
}

/* IP en navbar */
#navbarIP {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 0.3rem 0.8rem;
}

/* ========== CONTENEDOR PRINCIPAL ========== */
main {
    flex: 1;
    padding-top: 2rem;
    padding-bottom: 2rem;
}

/* ========== ALERTA IP ========== */
.alert-info {
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: var(--border-radius);
    color: var(--primary-color);
    font-weight: 500;
}

/* ========== TARJETAS ========== */
.card {
    border: none;
    border-radius: var(--border-radius);
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-smooth);
    overflow: hidden;
}

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

.card-header {
    border-bottom: none;
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
    padding: 1.2rem 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(0, 0, 0, 0.02);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* ========== TARJETA DEL CLIMA ========== */
.weather-card {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* Icono del clima */
.weather-icon {
    font-size: 5rem;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.1));
    transition: all var(--transition-smooth);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.weather-icon:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.2));
}

/* Temperatura */
.temperature {
    font-size: 4rem;
    font-weight: 800;
    color: var(--text-color);
    line-height: 1;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Detalles del clima */
.weather-detail {
    padding: 12px 10px;
    border-radius: var(--border-radius-sm);
    background: var(--weather-detail-bg);
    transition: all var(--transition-smooth);
    border: 1px solid transparent;
    cursor: default;
}

.weather-detail:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: rgba(102, 126, 234, 0.2);
    background: white;
}

.weather-detail .icon-wrapper {
    transition: all var(--transition-fast);
}

.weather-detail:hover .icon-wrapper {
    transform: scale(1.2);
}

/* ========== SELECT Y BOTONES ========== */
.form-select {
    border-radius: var(--border-radius-sm);
    border: 2px solid #e0e0e0;
    padding: 0.6rem 1rem;
    font-size: 1rem;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.form-select:hover {
    border-color: var(--primary-color);
}

.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.btn {
    border-radius: var(--border-radius-sm);
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    transition: all var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--primary-gradient);
    border: none;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

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

.btn-primary:disabled {
    background: #ccc;
    box-shadow: none;
    cursor: not-allowed;
}

/* ========== LOADING SPINNER ========== */
.loading-spinner {
    display: inline-block;
    width: 60px;
    height: 60px;
    border: 4px solid rgba(102, 126, 234, 0.1);
    border-radius: 50%;
    border-top-color: #667eea;
    border-right-color: #764ba2;
    animation: spin 0.8s ease-in-out infinite;
}

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

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--border-radius-sm);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========== ALERTAS ========== */
.alert {
    border: none;
    border-radius: var(--border-radius);
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.alert-danger {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
}

.alert-danger .text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* ========== MODAL ========== */
.modal-content {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    border-bottom: none;
}

/* ========== FOOTER ========== */
.footer {
    background: var(--footer-bg);
    color: #ffffff;
    position: relative;
    margin-top: auto;
}

.footer-wave {
    position: relative;
    top: -2px;
    line-height: 0;
}

.footer-wave svg {
    width: 100%;
    height: auto;
}

.footer-content {
    background: var(--footer-bg);
    padding-top: 0;
}

.footer-brand {
    display: flex;
    align-items: center;
}

.footer-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    display: inline-block;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: #cccccc;
    text-decoration: none;
    transition: all var(--transition-fast);
    font-size: 0.9rem;
    display: inline-block;
}

.footer-links a:hover {
    color: #ffffff;
    padding-left: 5px;
    text-decoration: none;
}

.footer-links i {
    font-size: 0.7rem;
    margin-right: 5px;
}

/* Redes sociales */
.social-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    text-decoration: none;
    transition: all var(--transition-smooth);
    font-size: 1.1rem;
}

.social-icon:hover {
    background: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    color: #ffffff;
}

/* Badges de tecnologías */
.badge.bg-html { background-color: #E34F26 !important; }
.badge.bg-css  { background-color: #1572B6 !important; }
.badge.bg-js   { background-color: #F7DF1E !important; color: #000 !important; }
.badge.bg-bs   { background-color: #7952B3 !important; }
.badge.bg-api  { background-color: #FF6C37 !important; }

.tech-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Estado API */
.api-status .badge {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
}

/* Footer divider */
.footer-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

/* Footer bottom */
.footer-bottom {
    background: rgba(0, 0, 0, 0.2);
    font-size: 0.85rem;
}

/* ========== BADGES DE TEMPERATURA ========== */
.badge-temp-hot {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
}

.badge-temp-cold {
    background: linear-gradient(135deg, #74b9ff, #0984e3);
}

/* ========== BORDE PUNTEADO (Estado vacío) ========== */
.border-dashed {
    border: 2px dashed #dee2e6 !important;
}

/* ========== TOOLTIP PERSONALIZADO ========== */
[title] {
    position: relative;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* ========== SELECCIÓN DE TEXTO ========== */
::selection {
    background: var(--primary-color);
    color: white;
}

/* ============================================
   MODO OSCURO
   ============================================ */
body.dark-mode {
    --body-bg: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --card-bg: rgba(30, 30, 50, 0.95);
    --weather-detail-bg: #2a2a3e;
    --text-color: #e0e0e0;
    --text-muted: #aaaaaa;
    --footer-bg: #0a0a14;
}

body.dark-mode .card {
    background: var(--card-bg);
    color: #e0e0e0;
}

body.dark-mode .weather-detail {
    background: #2a2a3e;
    border-color: rgba(255, 255, 255, 0.05);
}

body.dark-mode .weather-detail:hover {
    background: #3a3a4e;
    border-color: rgba(102, 126, 234, 0.3);
}

body.dark-mode .temperature {
    -webkit-text-fill-color: #ffffff;
}

body.dark-mode .text-muted {
    color: #aaaaaa !important;
}

body.dark-mode .alert-info {
    background: rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.4);
    color: #c0d0ff;
}

body.dark-mode .footer {
    --footer-bg: #0a0a14;
}

body.dark-mode .footer-bottom {
    background: rgba(0, 0, 0, 0.4);
}

body.dark-mode .form-select {
    background-color: #2a2a3e;
    color: #e0e0e0;
    border-color: #3a3a4e;
}

body.dark-mode .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.4);
}

body.dark-mode .dropdown-menu {
    background: #2a2a3e;
    color: #e0e0e0;
}

body.dark-mode .dropdown-item {
    color: #e0e0e0;
}

body.dark-mode .dropdown-item:hover {
    background: var(--primary-gradient);
}

body.dark-mode .modal-content {
    background: #2a2a3e;
    color: #e0e0e0;
}

body.dark-mode .card-footer {
    background: rgba(255, 255, 255, 0.02);
    border-top-color: rgba(255, 255, 255, 0.05);
}

body.dark-mode .border-dashed {
    border-color: #3a3a4e !important;
}

body.dark-mode .skeleton {
    background: linear-gradient(90deg, #2a2a3e 25%, #3a3a4e 50%, #2a2a3e 75%);
    background-size: 200% 100%;
}

body.dark-mode ::-webkit-scrollbar-track {
    background: #1a1a2e;
}

body.dark-mode ::-webkit-scrollbar-thumb {
    background: #3a3a4e;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 992px) {
    .temperature {
        font-size: 3rem;
    }
    
    .weather-icon {
        font-size: 4rem;
    }
    
    .navbar .btn-outline-light span {
        display: none;
    }
}

@media (max-width: 768px) {
    main {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .temperature {
        font-size: 2.5rem;
    }
    
    .weather-icon {
        font-size: 3rem;
    }
    
    .weather-detail {
        padding: 8px;
    }
    
    .footer-content {
        text-align: center;
    }
    
    .social-links {
        justify-content: center;
    }
    
    .footer-title {
        display: block;
        text-align: center;
    }
    
    .footer-links {
        text-align: center;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .temperature {
        font-size: 2rem;
    }
    
    .weather-icon {
        font-size: 2.5rem;
    }
    
    h2.h4 {
        font-size: 1.2rem;
    }
}

/* ============================================
   UTILIDADES EXTRA
   ============================================ */
.cursor-pointer {
    cursor: pointer;
}

.text-gradient {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

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

/* Animación de pulso para actualizaciones */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* Animación de entrada escalonada para detalles */
.weather-detail:nth-child(1) { animation-delay: 0.1s; }
.weather-detail:nth-child(2) { animation-delay: 0.2s; }
.weather-detail:nth-child(3) { animation-delay: 0.3s; }
.weather-detail:nth-child(4) { animation-delay: 0.4s; }
.weather-detail:nth-child(5) { animation-delay: 0.5s; }
.weather-detail:nth-child(6) { animation-delay: 0.6s; }