/* ==========================================================================
   STUDYVERSE - HOMEPAGE STYLES
   Shared styles loaded via <link href="/shared.css"> in index.html
   ========================================================================== */

main {
    animation: fadeIn 0.5s ease;
}

/* --- MAIN CONTENT --- */
.main-content {
    padding-top: 180px;
    width: 100%;
}

.hero {
    text-align: center;
    max-width: 1000px;
    margin: 0 auto 80px;
    padding: 0 5%;
}

/* --- H1 TIÊU ĐỀ --- */
.hero-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    text-align: center;
    margin-top: 60px;
    padding: 0 20px;
}

.white-text {
    color: #ffffff;
    white-space: nowrap;
    display: block;
    font-size: clamp(20px, 8vw, 65px);
    font-weight: 800;
    line-height: 1.1;
}

[data-theme="light"] .white-text,
[data-theme="pink"] .white-text,
[data-theme="cyan"] .white-text {
    color: var(--text-white);
}

.blue-text {
    color: var(--primary-blue);
    white-space: nowrap;
    display: inline-block;
    position: relative;
    font-size: clamp(20px, 8vw, 65px);
    font-weight: 800;
    line-height: 1.1;
}

/* --- NÉT VẼ TAY XANH --- */
.draw-underline {
    position: relative;
    color: var(--primary-blue);
    display: inline-block;
    white-space: nowrap;
    z-index: 1;
}

.draw-underline::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -18px;
    width: 100%;
    height: 12px;
    /* Dùng mask + background-color để nét vẽ đổi màu theo theme
       (URL data ảnh không đọc được var(--primary-blue)). */
    background-color: var(--primary-blue);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='300' height='12' viewBox='0 0 300 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 9C50 4 150 4 297 9' stroke='%23000' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg width='300' height='12' viewBox='0 0 300 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 9C50 4 150 4 297 9' stroke='%23000' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E");
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    z-index: -1;
    animation: drawLine 0.8s cubic-bezier(0.2, 0, 0, 1) forwards;
}

@keyframes drawLine {
    from { width: 0; opacity: 0; }
    to { width: 100%; opacity: 1; }
}

.hero-subtitle {
    color: var(--text-gray);
    font-size: clamp(16px, 2vw, 19px);
    max-width: 700px;
    margin: 60px auto 40px;
    line-height: 1.7;
    position: relative;
}

/* --- BUTTONS --- */
.cta-link {
    display: block;
    text-decoration: none;
}

.btn-main {
    padding: 16px 40px;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.3);
    transition: 0.3s;
}

.btn-main:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(var(--primary-rgb), 0.5);
}

.btn-start {
    background: var(--primary-blue);
    color: white;
    padding: 14px 32px;
    border: 2px solid white;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 15px var(--primary-blue-glow);
    outline: none;
}

.btn-start:hover {
    filter: brightness(1.12);
    transform: scale(1.05);
    box-shadow: 0 0 25px var(--primary-blue-glow);
}

.btn-start:active {
    transform: scale(0.98);
}

.home-entry-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.home-entry-actions button,
.btn-guest {
    min-height: 48px;
    padding: 13px 22px;
    border-radius: 10px;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s ease;
}

.home-entry-actions .btn-start {
    border: 1px solid var(--primary-blue);
    padding: 13px 22px;
}

.btn-entry-secondary {
    background: var(--card-bg);
    color: var(--text-white);
    border: 1px solid var(--border-highlight);
}

.btn-entry-secondary:hover,
.btn-guest:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
    transform: translateY(-2px);
}

.btn-guest {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-gray);
    border: 1px solid var(--border-soft);
}

.guest-hint {
    margin: 12px 0 0;
    color: var(--text-muted);
    font-size: 12px;
}

/* --- AUTH MODAL --- */
.auth-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(3, 5, 9, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.auth-modal-overlay[hidden] {
    display: none;
}

.auth-modal {
    position: relative;
    width: min(100%, 410px);
    padding: 30px 28px 24px;
    border: 1px solid var(--border-highlight);
    border-radius: 22px;
    background: var(--panel-bg);
    color: var(--text-white);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55), 0 0 40px rgba(var(--primary-rgb), 0.1);
    animation: authModalIn 0.22s ease-out;
}

@keyframes authModalIn {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 32px;
    height: 32px;
    border: 1px solid transparent;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 23px;
    line-height: 1;
    cursor: pointer;
}

.auth-modal-close:hover {
    color: var(--text-white);
    border-color: var(--border-soft);
    background: var(--card-hover-bg);
}

.auth-modal-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin: 0 auto 14px;
    border-radius: 50%;
    color: var(--primary-blue);
    background: rgba(var(--primary-rgb), 0.12);
    border: 1px solid rgba(var(--primary-rgb), 0.3);
}

.auth-modal h2 {
    margin: 0;
    text-align: center;
    font-size: 1.35rem;
}

.auth-modal > p:not(.auth-message) {
    margin: 8px 0 22px;
    color: var(--text-gray);
    font-size: 0.88rem;
    text-align: center;
}

.auth-modal form {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.auth-modal label {
    margin-top: 8px;
    color: var(--text-gray);
    font-size: 0.78rem;
    font-weight: 600;
}

.auth-modal input {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    outline: none;
    background: var(--card-hover-bg);
    color: var(--text-white);
    font: inherit;
}

.auth-modal input::placeholder {
    color: var(--text-muted);
}

.auth-modal input:focus {
    border-color: var(--primary-blue);
    background: var(--card-bg);
    box-shadow: 0 0 0 3px var(--primary-blue-glow);
}

.auth-submit {
    margin-top: 16px;
    padding: 12px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-secondary));
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.auth-submit:disabled {
    cursor: wait;
    opacity: 0.65;
}

.auth-message {
    min-height: 20px;
    margin: 12px 0 0;
    color: var(--text-gray);
    font-size: 0.82rem;
    line-height: 1.45;
    text-align: center;
}

.auth-message.is-error {
    color: #ff8179;
}

.auth-message.is-success {
    color: #34c759;
}

.auth-switch {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 7px;
    border: 0;
    background: transparent;
    color: var(--primary-blue);
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
}

/* --- FEATURES --- */
.features {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    padding: 0 5%;
    margin: 0 auto 120px;
    max-width: 1200px;
}

.feature-box {
    flex: 1;
    min-width: 280px;
    max-width: 360px;
    background: var(--card-bg);
    border: 1px solid var(--border-soft);
    padding: 50px 30px;
    border-radius: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: var(--white-glow);
    transition: all 0.5s cubic-bezier(0.2, 0, 0, 1);
}

.feature-box:hover {
    transform: translateY(-15px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 255, 255, 0.05);
}

.icon-wrapper {
    font-size: 45px;
    color: var(--primary-blue);
    margin-bottom: 25px;
}

.feature-box h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.feature-box p {
    font-size: 1rem;
    color: var(--text-gray);
    line-height: 1.7;
}

/* --- BIG ILLUSTRATION --- */
.big-illustration-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 100px;
    padding-bottom: 50px;
}

.img-large {
    width: 100%;
    max-width: 1200px;
    height: auto;
    display: block;
    object-fit: contain;
    mix-blend-mode: screen;
}

/* Ảnh minh họa là artwork nền tối; cần một lớp nền tương phản khi dùng theme Hồng
   để các màn hình và đường viền không bị hòa vào nền #FFD9E8. */
[data-theme="pink"] .big-illustration-container {
    position: relative;
    padding: 22px;
    border: 1px solid rgba(216, 107, 147, 0.28);
    border-radius: 30px;
    background: linear-gradient(135deg, rgba(9, 13, 22, 0.98), rgba(20, 27, 40, 0.98));
    box-shadow: 0 22px 50px rgba(157, 23, 77, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .big-illustration-container {
    position: relative;
    padding: 22px;
    border: 1px solid rgba(37, 99, 235, 0.22);
    border-radius: 30px;
    background: linear-gradient(135deg, rgba(9, 13, 22, 0.98), rgba(20, 27, 40, 0.98));
    box-shadow: 0 22px 50px rgba(31, 41, 55, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

[data-theme="cyan"] .big-illustration-container {
    position: relative;
    padding: 22px;
    border: 1px solid rgba(8, 145, 178, 0.24);
    border-radius: 30px;
    background: linear-gradient(135deg, rgba(9, 13, 22, 0.98), rgba(20, 27, 40, 0.98));
    box-shadow: 0 22px 50px rgba(8, 84, 102, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

[data-theme="pink"] .img-large {
    filter: drop-shadow(0 18px 30px rgba(157, 23, 77, 0.28));
}

[data-theme="light"] .img-large {
    filter: drop-shadow(0 18px 30px rgba(31, 41, 55, 0.28));
}

[data-theme="cyan"] .img-large {
    filter: drop-shadow(0 18px 30px rgba(8, 84, 102, 0.28));
}

/* --- RESPONSIVE (HOMEPAGE) --- */
@media (max-width: 768px) {
    .main-content {
        padding-top: 100px; /* navbar mobile cao 64px */
    }

    .desktop-only {
        display: none;
    }

    .hero-title {
        font-size: 22px !important;
        white-space: nowrap !important;
    }

    .draw-underline::after {
        bottom: -8px;
        height: 8px;
    }

    .feature-box {
        min-width: 100%;
        padding: 40px 25px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 28px;
    }

    .hero-subtitle {
        font-size: 14px;
    }

    .btn-main {
        padding: 12px 28px;
        font-size: 14px;
    }

    .feature-box {
        padding: 30px 20px;
    }

    .icon-wrapper {
        font-size: 35px;
    }

    .home-entry-actions {
        flex-direction: column;
        align-items: stretch;
        padding: 0 12px;
    }

    .home-entry-actions button,
    .btn-guest {
        width: 100%;
    }

    .auth-modal {
        padding: 26px 20px 20px;
    }

    .feature-box h3 {
        font-size: 1.2rem;
    }
}
