@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

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

:root {
    --bg-color: #080b13;
    --card-bg: rgba(17, 24, 39, 0.6);
    --card-border: rgba(255, 255, 255, 0.07);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-purple: #f97316;
    --accent-cyan: #06b6d4;
    --transition-speed: 0.3s;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    padding: 30px 15px;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Ajustes para móviles */
@media (max-width: 768px) {
    body {
        padding: 20px 10px;
    }
}

/* Luces de fondo tenues con colores vivos */
body::before, body::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
    filter: blur(120px);
}

body::before {
    top: 5%;
    left: 10%;
    background: radial-gradient(circle, rgba(249, 115, 22, 0.15) 0%, rgba(249, 115, 22, 0) 70%);
}

body::after {
    bottom: 10%;
    right: 10%;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.15) 0%, rgba(6, 182, 212, 0) 70%);
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff7ed 0%, #fb923c 50%, #22d3ee 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
    letter-spacing: -0.025em;
    filter: drop-shadow(0 2px 15px rgba(249, 115, 22, 0.2));
}

header p {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* Ajustes para móviles */
@media (max-width: 768px) {
    header {
        margin-bottom: 30px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    header p {
        font-size: 0.9rem;
    }
}

main {
    max-width: 1000px;
    margin: auto;
}

.search-box {
    margin-bottom: 40px;
    display: flex;
    justify-content: center;
    gap: 16px;
    align-items: center;
}

/* Ajustes para móviles */
@media (max-width: 768px) {
    .search-box {
        margin-bottom: 30px;
        flex-direction: column;
        gap: 12px;
    }
    
    .search-box #searchInput {
        max-width: 100%;
    }
    
    .search-box .btn-primary {
        width: 100%;
        max-width: 400px;
    }
}

/* Buscador Estilo Glassmorphism */
#searchInput {
    width: 100%;
    max-width: 400px;
    padding: 16px 24px;
    background: rgba(17, 24, 39, 0.7);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    font-size: 16px;
    color: var(--text-primary);
    font-family: inherit;
    transition: all var(--transition-speed) ease;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Ajustes para móviles */
@media (max-width: 768px) {
    #searchInput {
        padding: 14px 20px;
        font-size: 16px; /* Previene el zoom en iOS */
    }
}

#searchInput:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.35), inset 0 0 8px rgba(6, 182, 212, 0.1);
}

#searchInput::placeholder {
    color: #64748b;
}

/* Botón Añadir Prueba */
.btn-primary {
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-cyan) 100%);
    border: none;
    border-radius: 16px;
    color: white;
    font-family: inherit;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    box-shadow: 0 4px 15px rgba(234, 88, 12, 0.3);
    white-space: nowrap;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.45);
}

/* Ajustes para móviles */
@media (max-width: 768px) {
    .btn-primary {
        padding: 14px 20px;
        font-size: 15px;
    }
}

section {
    margin-bottom: 50px;
}

h2 {
    margin-bottom: 25px;
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #f1f5f9;
}

/* Ajustes para móviles */
@media (max-width: 768px) {
    h2 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
}

.container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

/* Ajustes para móviles */
@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Tarjeta Glassmorphic con iluminación al hover */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 28px;
    border-radius: 20px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

/* Efecto de brillo lineal en el borde superior del card */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-cyan));
    opacity: 0.4;
    transition: opacity var(--transition-speed) ease;
}

.card:hover {
    transform: translateY(-6px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), 
                0 0 25px rgba(249, 115, 22, 0.15);
}

.card:hover::before {
    opacity: 1;
}

/* Estado de tarjeta estudiada */
.card.estudiado {
    opacity: 0.65;
    border-color: rgba(16, 185, 129, 0.2);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.card.estudiado:hover {
    opacity: 0.95;
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3), 0 0 20px rgba(16, 185, 129, 0.15);
}

.card h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 12px;
    margin-top: 10px;
    color: var(--text-primary);
}

.card p {
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.card p strong {
    color: #cbd5e1;
    font-weight: 500;
}

/* Ajustes para móviles */
@media (max-width: 768px) {
    .card {
        padding: 24px;
    }
    
    .card h3 {
        font-size: 1.25rem;
    }
    
    .card p {
        font-size: 0.9rem;
    }
    
    .btn-edit, .btn-delete {
        opacity: 1;
    }
    
    .card-actions {
        flex-direction: column;
    }
    
    .card-actions a, .btn-study {
        padding: 14px 16px;
        font-size: 0.9rem;
    }
    
    .badge {
        position: relative;
        top: 0;
        right: 0;
        display: inline-block;
        margin-bottom: 10px;
        font-size: 0.75rem;
    }
}

/* Badges de cuenta regresiva */
.badge {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.badge-red {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.15);
}

.badge-yellow {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
}

.badge-cyan {
    background: rgba(6, 182, 212, 0.2);
    color: #22d3ee;
    border: 1px solid rgba(6, 182, 212, 0.4);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.15);
}

.badge-gray {
    background: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.4);
}

/* Botón Eliminar Tarjeta */
.btn-delete {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    font-size: 18px;
    font-weight: 500;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    opacity: 0;
    z-index: 10;
}

.card:hover .btn-delete {
    opacity: 1;
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.8);
    color: white;
    border-color: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

/* Contenedor de acciones del card */
.card-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.card-actions a {
    flex: 1;
    margin-top: 0;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--accent-purple) 0%, #ea580c 50%, var(--accent-cyan) 100%);
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 12px;
    transition: all var(--transition-speed) ease;
    box-shadow: 0 4px 15px rgba(234, 88, 12, 0.35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.card-actions a:hover {
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.45);
    transform: scale(1.02);
}

/* Botón marcar como estudiado */
.btn-study {
    flex: 1;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: var(--text-secondary);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.btn-study:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-study.completed {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.1);
}

.btn-study.completed:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.5);
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
    font-style: italic;
    background: rgba(17, 24, 39, 0.3);
    border-radius: 16px;
    border: 1px dashed var(--card-border);
}

/* Modal y Formulario Glassmorphic */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(5, 7, 12, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-speed) ease;
    z-index: 1000;
    padding: 20px;
}

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

.modal-content {
    width: 100%;
    max-width: 460px;
    background: rgba(17, 24, 39, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: translateY(-20px);
    transition: transform var(--transition-speed) cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff7ed 0%, #fb923c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    transition: color var(--transition-speed) ease;
    line-height: 1;
}

.btn-close:hover {
    color: #ef4444;
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #cbd5e1;
}

.form-group input {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all var(--transition-speed) ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-purple);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.2);
}

.form-group input::placeholder {
    color: #475569;
}

/* Ajuste específico para el calendario del input date */
.form-group input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

.btn-submit {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-cyan) 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-family: inherit;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    box-shadow: 0 4px 15px rgba(234, 88, 12, 0.3);
    margin-top: 10px;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.45);
}

/* Botón Editar Tarjeta */
.btn-edit {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-secondary);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    opacity: 0;
    z-index: 10;
}

.card:hover .btn-edit {
    opacity: 1;
}

.btn-edit:hover {
    background: rgba(249, 115, 22, 0.2);
    color: var(--accent-purple);
    border-color: rgba(249, 115, 22, 0.5);
    box-shadow: 0 0 8px rgba(249, 115, 22, 0.3);
}

/* Selector radio button del tipo de resumen */
.radio-group {
    display: flex;
    gap: 16px;
    margin-top: 4px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    color: #94a3b8;
}

.radio-group input[type="radio"] {
    accent-color: var(--accent-purple);
    width: auto;
    margin: 0;
}

.help-text {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 4px;
}

/* Botones de acción del formulario */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.form-actions .btn-submit {
    flex: 1;
    margin-top: 0;
    width: auto;
}

.btn-danger {
    flex: 1;
    padding: 14px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    color: #ef4444;
    font-family: inherit;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.8);
    color: white;
    border-color: #ef4444;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

/* Ajustes para móviles - Modal y formularios */
@media (max-width: 768px) {
    .modal-content {
        padding: 24px;
        border-radius: 20px;
        margin: 10px;
    }
    
    .modal-header h3 {
        font-size: 1.3rem;
    }
    
    .radio-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn-submit, .btn-danger {
        width: 100%;
    }
    
    .no-results {
        padding: 30px 15px;
        font-size: 0.9rem;
    }
}