:root {
    --bg-dark: #050505;
    --bg-panel: #111111;
    --primary: #193ef3;
    /* Roxo */
    --accent: #06b6d4;
    /* Ciano */
    --success: #10b981;
    /* Verde */
    --danger: #ef4444;
    /* Vermelho */
    --warning: #f59e0b;
    /* Laranja */
    --text-main: #e4e4e7;
    --text-muted: #71717a;
    --border: #27272a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* --- LOGIN SCREEN --- */
#login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #050505;
    background-image:
        linear-gradient(rgba(139, 92, 246, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139, 92, 246, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    animation: bgMove 20s linear infinite;
}

#login-screen::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 40%, #050505 100%);
    pointer-events: none;
}

@keyframes bgMove {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 50px 50px;
    }
}

.logo-container {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 20px;
    z-index: 2;
    text-shadow: 0 0 30px rgba(139, 92, 246, 0.6);
    animation: pulse 3s infinite ease-in-out;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.8;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

.login-box {
    width: 380px;
    padding: 50px 40px;
    border-radius: 16px;
    background: rgba(15, 15, 20, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(139, 92, 246, 0.05);
    text-align: center;
    z-index: 2;
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-title {
    margin-bottom: 30px;
    font-family: 'Fira Code';
    font-weight: 700;
    letter-spacing: 2px;
    color: white;
    text-transform: uppercase;
    font-size: 1.2rem;
    border-bottom: 2px solid var(--primary);
    display: inline-block;
    padding-bottom: 5px;
}

.input-group-login {
    position: relative;
    margin-bottom: 25px;
    text-align: left;
}

.login-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid #444;
    padding: 10px 5px;
    color: white;
    font-family: 'Fira Code';
    font-size: 1rem;
    transition: 0.3s;
}

.login-input:focus {
    outline: none;
    border-bottom-color: var(--accent);
}

.login-input::placeholder {
    color: #555;
    font-size: 0.9rem;
}

.input-highlight {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 1px;
    width: 0;
    background: var(--accent);
    transition: 0.4s;
    box-shadow: 0 0 10px var(--accent);
}

.login-input:focus+.input-highlight {
    width: 100%;
}

.btn-login {
    width: 100%;
    padding: 15px;
    margin-top: 10px;
    background: linear-gradient(90deg, var(--primary), #6d28d9);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-family: 'Inter';
    letter-spacing: 1px;
    transition: 0.3s;
    box-shadow: 0 5px 15px rgba(109, 40, 217, 0.3);
    text-transform: uppercase;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.5);
    background: linear-gradient(90deg, #6d28d9, var(--primary));
}

#login-error {
    margin-top: 15px;
    color: var(--danger);
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(239, 68, 68, 0.1);
    padding: 8px;
    border-radius: 4px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* --- APP LAYOUT --- */
#app-container {
    display: none;
    flex: 1;
    height: 100%;
    display: flex;
}

.sidebar {
    width: 260px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.nav-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 10px;
}

.nav-item {
    padding: 12px;
    margin-bottom: 5px;
    cursor: pointer;
    border-radius: 6px;
    color: var(--text-muted);
    transition: 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-item.active {
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.btn-new-materia {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 1px dashed var(--border);
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 20px;
    font-size: 0.9rem;
    transition: 0.2s;
}

.btn-new-materia:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(139, 92, 246, 0.05);
}

/* BARRA DE PESQUISA (NOVA) */
.search-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 15px;
}

.search-wrapper:focus-within {
    border-color: var(--primary);
}

.search-wrapper i {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.search-wrapper input {
    background: transparent;
    border: none;
    color: white;
    margin-left: 10px;
    width: 100%;
    outline: none;
    font-family: 'Inter';
    font-size: 0.9rem;
}

.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    position: relative;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 15px;
}

.title-input {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.8rem;
    font-weight: 800;
    font-family: 'Inter';
    width: 100%;
    text-transform: uppercase;
}

.title-input:focus {
    outline: none;
    border-bottom: 1px solid var(--primary);
}

.title-input:hover {
    opacity: 0.8;
}

.btn-delete-materia {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    margin-left: 15px;
}

.btn-delete-materia:hover {
    background: var(--danger);
    color: white;
}

.header-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    padding: 20px;
    border-radius: 8px;
}

.stat-val {
    font-family: 'Fira Code';
    font-size: 1.8rem;
    font-weight: 700;
}

/* --- GRID DE SEMANAS (DASHBOARD) --- */
.weeks-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
}

.week-square-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.week-square-card:hover {
    border-color: var(--primary);
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.15);
    background: linear-gradient(145deg, #151515, #111);
}

.week-number {
    font-family: 'Fira Code';
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-muted);
    opacity: 0.3;
    transition: 0.3s;
}

.week-square-card:hover .week-number {
    color: var(--primary);
    opacity: 1;
}

.week-info {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.status-dot {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #333;
}

.status-dot.active {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

/* --- WEEK DETAIL (FOCUSED) --- */
.week-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.btn-back {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-back:hover {
    background: white;
    color: black;
    transform: translateX(-3px);
}

/* --- GRID DE TAREFAS (GIGANTE) --- */
.task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    /* Card largo */
    gap: 20px;
}

.task-card {
    background: #000;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 25px;
    /* Mais espaço interno */
    cursor: pointer;
    transition: 0.2s;
    position: relative;
    min-height: 180px;
    /* Card mais alto */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.type-video {
    border-left: 4px solid var(--accent);
}

.type-exercicio {
    border-left: 4px solid var(--success);
}

.type-extra {
    border-left: 4px solid var(--warning);
}

.type-avaliativa {
    border-left: 4px solid var(--danger);
}

.task-card:hover {
    transform: translateY(-5px);
    border-color: #555;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

/* Status Concluído (Verde, sem riscar) */
.task-card.done {
    opacity: 1;
    border: 1px solid var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.task-card.done .task-title {
    text-decoration: none;
    color: var(--success);
    font-weight: 700;
}

.type-badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 10px;
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
}

.task-title {
    font-size: 1.2rem;
    /* Título maior */
    font-weight: 600;
    margin-bottom: 15px;
    word-break: break-word;
    line-height: 1.4;
}

/* Objetivo no card */
.task-objective {
    font-size: 0.9rem;
    color: #aaa;
    margin-top: 10px;
    margin-bottom: 10px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.btn-add-card {
    width: 100%;
    padding: 15px;
    border: 1px dashed var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    margin-top: 10px;
    transition: 0.2s;
    font-size: 1rem;
}

.btn-add-card:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* --- CALENDÁRIO VISUAL --- */
.calendar-header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: bold;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.calendar-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    height: calc(100% - 100px);
    /* Ocupa o resto da tela */
    grid-auto-rows: minmax(100px, 1fr);
    /* Células grandes */
}

.calendar-day {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px;
    position: relative;
    cursor: pointer;
    transition: 0.2s;
    min-height: 100px;
}

.calendar-day:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: #444;
}

.calendar-day.empty {
    background: transparent;
    border: none;
    pointer-events: none;
}

.calendar-day.today {
    border: 1px solid var(--accent);
    background: rgba(6, 182, 212, 0.05);
}

.day-number {
    font-weight: bold;
    font-size: 1.1rem;
    position: absolute;
    top: 10px;
    right: 10px;
}

.calendar-day.today .day-number {
    color: var(--accent);
}

/* Eventos no Calendário */
.calendar-event-chip {
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.event-item-list {
    background: #222;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* --- MODAL AJUSTADO (MENOS GIGANTE) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-window {
    background: #111;
    width: 800px;
    max-width: 95vw;
    padding: 45px;
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.9);
    max-height: 90vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #333 #111;
}

.modal-title-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 3px solid var(--primary);
    font-size: 2.2rem;
    color: white;
    margin-bottom: 40px;
    padding-bottom: 10px;
    font-weight: 800;
}

.modal-title-input:focus {
    outline: none;
    border-bottom-color: var(--accent);
}

.form-group {
    margin-bottom: 30px;
}

.form-label {
    display: block;
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.modal-input,
select,
textarea {
    width: 100%;
    background: #050505;
    border: 1px solid #333;
    color: white;
    padding: 15px;
    border-radius: 10px;
    font-family: 'Inter';
    font-size: 1rem;
    transition: 0.2s;
}

.modal-input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    outline: none;
    background: #000;
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 50px;
}

.btn {
    padding: 15px 30px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 700;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
    background: #7c3aed;
    transform: scale(1.05);
}

.modal-actions label {
    font-size: 1.2rem;
}

.modal-actions input[type="checkbox"] {
    transform: scale(1.5);
    margin-right: 10px;
}

/* Botão Sair Fantasma */
.btn-ghost {
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 10px;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-ghost:hover {
    background: transparent;
    transform: scale(1.2);
    color: var(--danger);
}

.btn-ghost:focus {
    outline: none;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}