/* ============================================================
   TeachMate AI – Main Stylesheet
   ============================================================ */

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

:root {
    --bg: #0c0e1a;
    --bg2: #13152a;
    --bg3: #1a1d35;
    --border: rgba(255,255,255,0.09);
    --text: #e4e0f5;
    --text-muted: #8b88a8;
    --text-dim: #5a5872;
    --accent: #7c6af5;
    --accent2: #4fcf8e;
    --accent3: #f76b4f;
    --white: #ffffff;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 8px 40px rgba(0,0,0,0.4);
    --font-body: 'DM Sans', sans-serif;
    --font-display: 'Lora', serif;
    --max-w: 1120px;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }

/* ---- Header ---- */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(12,14,26,0.92);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 18px; font-weight: 700; color: var(--white); }
.logo-icon { font-size: 24px; }
.logo-text { font-family: var(--font-body); }
.logo-text strong { color: var(--accent); }
.main-nav { margin-left: auto; display: flex; align-items: center; gap: 24px; }
.main-nav a { text-decoration: none; color: var(--text-muted); font-size: 14px; font-weight: 500; transition: color .2s; }
.main-nav a:hover { color: var(--white); }
.nav-cta { background: var(--accent); color: var(--white) !important; padding: 8px 18px; border-radius: 8px; font-weight: 600 !important; }
.nav-cta:hover { background: #6a59e4 !important; }
.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 4px; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text-muted); border-radius: 2px; transition: .3s; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--font-body); font-weight: 600; font-size: 15px;
    border: none; border-radius: 10px; cursor: pointer; text-decoration: none;
    transition: all .2s; padding: 10px 22px; line-height: 1;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #6a59e4; transform: translateY(-1px); box-shadow: 0 6px 24px rgba(124,106,245,0.45); }
.btn-outline { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-lg { font-size: 17px; padding: 14px 30px; border-radius: 12px; }
.btn-xl { font-size: 18px; padding: 16px 40px; border-radius: 14px; width: 100%; max-width: 340px; }
.btn-tool { background: rgba(255,255,255,0.06); color: var(--text); border: 1.5px solid var(--border); font-size: 14px; padding: 10px 16px; margin-top: 12px; width: 100%; }
.btn-tool:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); border-color: var(--accent); color: var(--white); }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }

/* ---- Hero ---- */
.hero { padding: 90px 0 80px; position: relative; overflow: hidden; }
.hero::before {
    content: ''; position: absolute; top: -200px; right: -200px;
    width: 600px; height: 600px; border-radius: 50%;
    background: radial-gradient(circle, rgba(124,106,245,0.12) 0%, transparent 70%);
    pointer-events: none;
}
.hero .container { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: center; }
.hero-badge { display: inline-flex; align-items: center; gap: 6px; background: rgba(124,106,245,0.15); border: 1px solid rgba(124,106,245,0.3); color: #b8b0f8; font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: 100px; margin-bottom: 20px; }
.hero h1 { font-family: var(--font-display); font-size: clamp(32px, 4.5vw, 52px); font-weight: 700; line-height: 1.18; color: var(--white); margin-bottom: 20px; }
.hero h1 em { font-style: italic; color: #b8b0f8; }
.hero-sub { font-size: 17px; color: var(--text-muted); max-width: 500px; margin-bottom: 32px; line-height: 1.7; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 36px; }
.hero-stats { display: flex; gap: 28px; }
.stat { text-align: center; }
.stat strong { display: block; font-size: 24px; font-weight: 700; color: var(--white); }
.stat { font-size: 12px; color: var(--text-muted); }
.hero-visual { position: relative; height: 320px; }
.preview-card {
    position: absolute; background: var(--bg2); border: 1px solid var(--border);
    border-radius: 12px; padding: 14px 18px; font-size: 14px; font-weight: 600;
    box-shadow: var(--shadow); animation: float 3s ease-in-out infinite;
}
.pc1 { top: 10%; left: 5%; animation-delay: 0s; }
.pc2 { top: 32%; left: 38%; animation-delay: .6s; border-color: rgba(79,207,142,0.3); color: var(--accent2); }
.pc3 { bottom: 28%; left: 0%; animation-delay: 1.2s; }
.pc4 { bottom: 5%; left: 30%; animation-delay: .3s; border-color: rgba(124,106,245,0.3); color: #b8b0f8; }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }

/* ---- Tools Section ---- */
.tools-section { padding: 80px 0; }
.section-header { text-align: center; margin-bottom: 48px; }
.section-header h2 { font-family: var(--font-display); font-size: clamp(26px, 3.5vw, 40px); color: var(--white); margin-bottom: 10px; }
.section-header p { color: var(--text-muted); font-size: 16px; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.tool-card {
    background: var(--bg2); border: 1.5px solid var(--border); border-radius: var(--radius);
    padding: 28px 26px 24px; position: relative; overflow: hidden;
    transition: transform .2s, border-color .2s, box-shadow .2s; cursor: default;
}
.tool-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 12px 40px rgba(0,0,0,0.3); }
.tool-card::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 6%, transparent), transparent); pointer-events: none; }
.tool-tag { position: absolute; top: 16px; right: 16px; background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 100px; letter-spacing: .5px; }
.tool-icon { font-size: 36px; margin-bottom: 14px; }
.tool-card h3 { font-size: 18px; font-weight: 700; color: var(--white); margin-bottom: 8px; }
.tool-card p { font-size: 14px; color: var(--text-muted); line-height: 1.6; }

/* ---- Modal ---- */
.modal-overlay {
    display: none; position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.75); backdrop-filter: blur(6px);
    align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--bg2); border: 1px solid var(--border); border-radius: 20px;
    width: 100%; max-width: 680px; max-height: 90vh; overflow-y: auto;
    position: relative; box-shadow: 0 24px 80px rgba(0,0,0,0.6);
    animation: modalIn .25s ease;
}
@keyframes modalIn { from{opacity:0;transform:scale(.95)} to{opacity:1;transform:scale(1)} }
.modal-close { position: absolute; top: 16px; right: 18px; background: none; border: none; color: var(--text-muted); font-size: 26px; cursor: pointer; line-height: 1; z-index: 2; }
.modal-close:hover { color: var(--white); }

/* Modal inner */
.modal-header { padding: 28px 32px 0; border-bottom: 1px solid var(--border); padding-bottom: 20px; }
.modal-header h2 { font-size: 22px; color: var(--white); }
.modal-body { padding: 24px 32px; }
.modal-footer { padding: 0 32px 28px; display: flex; gap: 12px; flex-wrap: wrap; }

/* Form fields */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .8px; font-weight: 600; margin-bottom: 8px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; background: var(--bg3); border: 1.5px solid var(--border); border-radius: 10px;
    padding: 12px 14px; color: var(--text); font-family: var(--font-body); font-size: 15px;
    outline: none; transition: border-color .2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--accent); }
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-dim); }
.form-group select option { background: var(--bg3); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Result area */
.result-box {
    background: var(--bg3); border: 1px solid var(--border); border-radius: 12px;
    padding: 20px; font-size: 14px; line-height: 1.8; color: var(--text);
    white-space: pre-wrap; max-height: 400px; overflow-y: auto;
    margin-top: 16px;
}
.result-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.result-header h4 { font-size: 14px; color: var(--accent2); font-weight: 600; }

/* Live Quiz Result */
.quiz-result-box { background: var(--bg3); border-radius: 12px; padding: 20px; margin-top: 16px; }
.quiz-result-box h4 { font-size: 16px; color: var(--white); margin-bottom: 16px; }
.link-block { background: var(--bg); border: 1px dashed var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; }
.link-block label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-muted); margin-bottom: 6px; }
.link-block .link-url { font-size: 14px; color: var(--accent); word-break: break-all; }
.link-actions { display: flex; gap: 8px; margin-top: 8px; }

/* Loading spinner */
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.25); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to{transform:rotate(360deg)} }

/* Error msg */
.error-msg { background: rgba(247,107,79,0.12); border: 1px solid rgba(247,107,79,0.3); color: #f76b4f; border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-top: 12px; }

/* ---- How It Works ---- */
.how-section { padding: 80px 0; background: var(--bg2); }
.how-section h2 { font-family: var(--font-display); font-size: clamp(26px,3vw,36px); color: var(--white); text-align: center; margin-bottom: 48px; }
.steps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 24px; }
.step { text-align: center; padding: 30px 20px; }
.step-num { width: 48px; height: 48px; background: var(--accent); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; margin: 0 auto 16px; }
.step h3 { font-size: 17px; color: var(--white); margin-bottom: 8px; }
.step p { font-size: 14px; color: var(--text-muted); }

/* ---- FAQ ---- */
.faq-section { padding: 80px 0; }
.faq-inner { max-width: 720px; }
.faq-section h2 { font-family: var(--font-display); font-size: clamp(24px,3vw,34px); color: var(--white); margin-bottom: 36px; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item summary { padding: 18px 0; font-size: 16px; font-weight: 600; color: var(--white); cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq-item summary::after { content: '+'; font-size: 20px; color: var(--accent); min-width: 20px; text-align: center; transition: transform .2s; }
.faq-item[open] summary::after { content: '−'; }
.faq-item p { padding: 0 0 18px; font-size: 15px; color: var(--text-muted); line-height: 1.7; }

/* ---- Footer ---- */
.site-footer { background: var(--bg2); border-top: 1px solid var(--border); padding: 48px 0 32px; }
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: 20px; text-align: center; }
.footer-logo { font-size: 18px; font-weight: 700; color: var(--white); }
.footer-logo p { font-size: 14px; color: var(--text-muted); margin-top: 4px; font-weight: 400; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--text-muted); text-decoration: none; font-size: 14px; }
.footer-links a:hover { color: var(--white); }
.footer-copy { font-size: 13px; color: var(--text-dim); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .hero .container { grid-template-columns: 1fr; gap: 40px; }
    .hero-visual { display: none; }
    .hero { padding: 60px 0 50px; }
    .main-nav { display: none; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: var(--bg2); border-bottom: 1px solid var(--border); padding: 20px; gap: 16px; }
    .main-nav.open { display: flex; }
    .nav-toggle { display: flex; margin-left: auto; }
    .site-header { position: relative; }
    .form-row { grid-template-columns: 1fr; }
    .modal { border-radius: 14px; }
    .modal-header, .modal-body, .modal-footer { padding-left: 20px; padding-right: 20px; }
    .tools-grid { grid-template-columns: 1fr; }
    .hero-actions { flex-direction: column; }
    .hero-actions .btn { width: 100%; max-width: 360px; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
