/* ============================================
   VARIABLES Y RESET
   ============================================ */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #10b981;
    --accent-color: #f59e0b;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    --border-color: #e5e7eb;
    --error-color: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 12px;
}

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

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

/* ============================================
   CONTENEDOR PRINCIPAL
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 40px 20px;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.logo {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: -1px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 300;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    flex: 1;
    padding: 40px 20px;
}

/* ============================================
   SECCIÓN DE BÚSQUEDA
   ============================================ */
.search-section {
    margin-bottom: 40px;
}

.search-box {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.search-input {
    flex: 1;
    padding: 16px 20px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background-color: var(--bg-white);
    transition: all 0.3s ease;
    outline: none;
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-input::placeholder {
    color: var(--text-light);
}

.search-btn {
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

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

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

.btn-icon {
    font-size: 1.2rem;
}

.load-all-btn {
    display: block;
    margin: 0 auto;
    padding: 12px 24px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.load-all-btn:hover {
    background-color: #059669;
    transform: translateY(-2px);
}

/* ============================================
   MENSAJES Y ESTADOS
   ============================================ */
.error-message {
    max-width: 700px;
    margin: 0 auto 30px;
    padding: 16px 20px;
    background-color: #fee2e2;
    border-left: 4px solid var(--error-color);
    border-radius: var(--radius);
    color: #991b1b;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.3s ease;
}

.error-icon {
    font-size: 1.5rem;
}

.loading {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

.hidden {
    display: none !important;
}

.results-count {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.1rem;
    color: var(--text-light);
    font-weight: 500;
}

/* ============================================
   CONTENEDOR DE RESULTADOS
   ============================================ */
.results-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    animation: fadeIn 0.5s ease;
}

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

/* ============================================
   TARJETAS DE UNIVERSIDAD
   ============================================ */
.university-card {
    background-color: var(--bg-white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.university-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.university-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.university-card:hover::before {
    transform: scaleX(1);
}

.card-header {
    margin-bottom: 16px;
}

.university-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    display: inline-block;
}

.university-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
    line-height: 1.3;
}

.card-body {
    margin-bottom: 20px;
}

.info-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.info-icon {
    font-size: 1.2rem;
    min-width: 24px;
}

.info-label {
    font-weight: 600;
    color: var(--text-dark);
    min-width: 80px;
}

.info-value {
    color: var(--text-light);
    flex: 1;
}

.card-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.website-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.website-link:hover {
    background-color: var(--primary-dark);
    transform: translateX(3px);
}

.link-icon {
    font-size: 1rem;
}

/* ============================================
   MENSAJE SIN RESULTADOS
   ============================================ */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--text-dark);
}

.no-results p {
    font-size: 1rem;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background-color: var(--text-dark);
    color: white;
    text-align: center;
    padding: 30px 20px;
    margin-top: auto;
}

.footer p {
    margin-bottom: 5px;
    opacity: 0.9;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    .logo {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .search-box {
        flex-direction: column;
    }

    .search-btn {
        width: 100%;
        justify-content: center;
    }

    .results-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .university-name {
        font-size: 1.15rem;
    }

    .info-label {
        min-width: 70px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 30px 15px;
    }

    .main-content {
        padding: 30px 15px;
    }

    .logo {
        font-size: 1.75rem;
    }

    .search-input {
        padding: 14px 16px;
        font-size: 0.95rem;
    }

    .university-card {
        padding: 20px;
    }
}
