/* ==================== PHASE 4: ANIMATIONS ==================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }

    100% {
        background-position: 1000px 0;
    }
}

/* ==================== ORIGINAL STYLES ==================== */

:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.5);
    --success-color: #10b981;
    --danger-color: #ef4444;
    --glass-border: rgba(255, 255, 255, 0.1);
}

/* Light Mode */
body.light-mode {
    --bg-dark: #f1f5f9;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --glass-border: rgba(0, 0, 0, 0.1);
    --accent-glow: rgba(59, 130, 246, 0.3);
}

/* Smooth transition for theme changes */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

.rotate-slow {
    animation: spin 4s linear infinite;
}


body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 0;
}

h1 {
    font-weight: 700;
    letter-spacing: -0.05em;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

/* Console Log Window */
.log-window {
    background: #000;
    border: 1px solid #333;
    border-radius: 8px;
    height: 150px;
    overflow-y: auto;
    padding: 1rem;
    font-family: 'Consolas', monospace;
    font-size: 0.85rem;
    color: #0f0;
    margin-bottom: 2rem;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.log-entry {
    margin-bottom: 0.25rem;
    border-bottom: 1px solid #111;
    padding-bottom: 0.25rem;
}

.log-level-INFO {
    color: #60a5fa;
}

.log-level-WARNING {
    color: #fbbf24;
}

.log-level-ERROR {
    color: #ef4444;
}

.log-level-SUCCESS {
    color: #34d399;
    font-weight: bold;
}

/* Stats */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.2s;
}

.stat-card:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-title {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#topSource {
    font-size: 1.5rem;
    /* Smaller font for domains */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    display: block;
    padding: 0 0.5rem;
}

/* Buttons */
.btn {
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 0 15px var(--accent-glow);
}

.btn-primary:hover {
    filter: brightness(1.1);
    box-shadow: 0 0 25px var(--accent-glow);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.btn-danger:hover {
    background: var(--danger-color);
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    filter: brightness(1.1);
}

/* Icon size in buttons */
.btn i {
    font-size: 0.9rem;
}


/* Grid */
.course-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* Exactamente 4 columnas */
    gap: 1.5rem;
    padding: 1rem 0;
}

/* Responsive breakpoints */
@media (max-width: 1400px) {
    .course-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 968px) {
    .course-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .course-grid {
        grid-template-columns: 1fr;
    }
}

/* List View */
.course-grid.list-view {
    grid-template-columns: 1fr;
}

.course-grid.list-view .course-card {
    display: grid;
    grid-template-columns: 250px 1fr;
    grid-template-rows: auto;
    gap: 0;
    max-height: none;
}

.course-grid.list-view .course-image {
    grid-row: 1 / -1;
    height: 100%;
    min-height: 180px;
}

.course-grid.list-view .card-header,
.course-grid.list-view .card-body,
.course-grid.list-view .card-footer {
    padding: 1rem 1.5rem;
}

.course-grid.list-view .card-body {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

@media (max-width: 768px) {
    .course-grid.list-view .course-card {
        grid-template-columns: 1fr;
    }

    .course-grid.list-view .course-image {
        grid-row: auto;
        height: 160px;
    }
}

.course-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    /* PHASE 4: Animation */
    animation: fadeInUp 0.4s ease-out;
    animation-fill-mode: both;
}

.course-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 40px rgba(59, 130, 246, 0.2);
    border-color: var(--accent-color);
}

.course-img {
    height: 160px;
    background: #334155;
    background-size: cover;
    background-position: center;
}

.course-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.course-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
    color: var(--text-primary);
}

.course-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.badge {
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* PHASE 1: Technology Badges */
.tech-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    margin: 0.25rem 0.25rem 0 0;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.course-btn {
    margin-top: auto;
    width: 100%;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    padding: 0.75rem;
    border-radius: 8px;
    text-decoration: none;
    transition: 0.2s;
}

.course-btn:hover {
    background: var(--accent-color);
}

/* Spinners & Inputs */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

input,
select {
    background: #0f172a;
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.75rem;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
}

input:focus {
    outline: 2px solid var(--accent-color);
    border-color: transparent;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}