@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Secular+One&display=swap');

:root {
    --primary: #0f172a;
    --primary-hover: #1e293b;
    --emerald: #10b981;
    --blue: #3b82f6;
    --bg-color: #fcfcfd;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #f1f5f9;
    --card-bg: #ffffff;
    --danger: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100dvh;
    overscroll-behavior-y: auto;
}

.font-alef {
    font-family: 'Secular One', sans-serif;
}

/* Tela de Login */
.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.login-card {
    background: var(--card-bg);
    border-radius: 2.5rem;
    padding: 2.5rem 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    max-height: 95dvh;
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    background: var(--primary);
    color: #fff;
    border-radius: 1.25rem;
    font-size: 2.5rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 10px 20px -5px rgba(15, 23, 42, 0.3);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.075em;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
    padding-left: 0.5rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    width: 100%;
    padding: 1.125rem 1.5rem;
    border: 1.5px solid var(--border-color);
    border-radius: 1.25rem;
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: all 0.25s ease;
    background: #f8fafc;
    color: var(--text-main);
}

.input-wrapper input:focus {
    border-color: var(--emerald);
    background: #fff;
    box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.08);
}

.btn-primary {
    width: 100%;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 1.125rem;
    border-radius: 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 56px;
}

/* Layout Principal */
.app-shell {
    display: flex;
    height: 100dvh;
    width: 100%;
    background: #fff;
    overflow: hidden;
}

.app-content {
    flex: 1;
    overflow-y: auto;
    scroll-behavior: smooth;
    padding: 2rem;
}

.app-content::-webkit-scrollbar { display: none; }

/* Navegação */
.bottom-nav {
    display: flex;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    z-index: 1000;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.nav-item.active {
    color: var(--primary);
}

/* Componentes */
.header-app {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.profile-mini {
    display: flex;
    align-items: center; gap: 12px;
}

.avatar-mini {
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: #fff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.progress-card {
    background: var(--primary);
    border-radius: 2rem;
    padding: 2rem;
    color: #fff;
    margin-bottom: 2rem;
}

.progress-bar-bg {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin: 1rem 0;
}

.progress-bar-fill {
    height: 100%;
    background: var(--emerald);
    border-radius: 10px;
}

.subject-list {
    display: grid;
    gap: 1rem;
}

.subject-item {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    cursor: pointer;
}

.subject-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

/* MODAL DE PROCESSAMENTO IA - ESTILO CARD REFINADO */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(12px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal-content {
    background: white;
    padding: 3.5rem 2.5rem;
    border-radius: 3rem;
    text-align: center;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.loader-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border-radius: 2.5rem;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid #edf2f7;
}

.loader-ai {
    width: 90px;
    height: 90px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid var(--emerald);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.loader-logo {
    font-size: 3rem;
    color: var(--primary);
    animation: pulse-logo 1.5s ease-in-out infinite;
    z-index: 2;
    line-height: 1;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-logo {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
}

/* Cronômetro */
.timer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
}

.timer-circle-wrapper {
    position: relative;
    width: 280px;
    height: 280px;
    margin: 2rem 0;
}

.timer-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-ring-bg { fill: none; stroke: var(--border-color); stroke-width: 6; }
.timer-ring-progress { fill: none; stroke: var(--emerald); stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }

.timer-display {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.timer-time { font-size: 4rem; font-weight: 800; color: var(--primary); }

/* Responsividade */
@media (min-width: 769px) {
    .app-shell { flex-direction: row; }
    .bottom-nav {
        width: 280px; height: 100dvh;
        flex-direction: column;
        padding: 2rem 0;
        border-right: 1px solid var(--border-color);
    }
    .nav-item {
        width: 100%; padding: 1rem 2rem;
        justify-content: flex-start;
        gap: 12px;
    }
    .timer-container { flex-direction: row; gap: 4rem; }
    .subject-list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}

@media (max-width: 768px) {
    .app-shell { flex-direction: column; }
    .bottom-nav {
        position: fixed; bottom: 0; width: 100%;
        height: 70px; flex-direction: row;
        border-top: 1px solid var(--border-color);
    }
    .nav-item { flex-direction: column; flex: 1; font-size: 0.7rem; }
    .app-content { padding-bottom: 80px; }
}
