/* ============================================================================
   STYLE.CSS - Thiết kế chung cho toàn hệ thống
   Phần Mềm Dễ Dùng - phanmemdedung.vn/hoctap
   ============================================================================ */

/* Font tiếng Việt đẹp */
@import url('https://fonts.googleapis.com/css2?family=Lora:wght@400;500;600;700&family=Source+Sans+3:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --accent: #0099e6;
    --success: #27500A;
    --success-bg: #EAF3DE;
    --danger: #791F1F;
    --danger-bg: #FCEBEB;
    --warning: #854F0B;
    --warning-bg: #FAEEDA;
    --info: #0C447C;
    --info-bg: #E6F1FB;
    --text: #1a2b49;
    --text-muted: #6b7c93;
    --border: #e5e7eb;
    --bg-gray: #f8f9fa;
    --font-sans: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-serif: 'Lora', Georgia, serif;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--bg-gray);
    line-height: 1.6;
    font-size: 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-dark); }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-serif);
    color: var(--text);
    line-height: 1.3;
    margin-bottom: 12px;
    font-weight: 600;
}
h1 { font-size: 32px; }
h2 { font-size: 26px; }
h3 { font-size: 22px; }
h4 { font-size: 18px; }

/* ============================================================================
   HEADER / NAVIGATION
   ============================================================================ */

.site-header {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.site-header .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 20px;
    color: var(--text);
}

.site-logo img { width: 40px; height: 40px; }

.site-logo small {
    font-family: var(--font-sans);
    font-weight: 400;
    color: var(--text-muted);
    font-size: 13px;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.main-nav a {
    padding: 8px 14px;
    border-radius: var(--radius);
    color: var(--text);
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
}

.main-nav a:hover {
    background: var(--info-bg);
    color: var(--primary);
}

.main-nav a.active {
    background: var(--primary);
    color: white;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: 20px;
    background: var(--info-bg);
    color: var(--info);
    font-size: 14px;
    font-weight: 500;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
}

/* ============================================================================
   CONTAINER / LAYOUT
   ============================================================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
}

.container-narrow {
    max-width: 520px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ============================================================================
   CARDS
   ============================================================================ */

.card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.card-header {
    padding-bottom: 16px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 4px;
}

.card-subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

/* ============================================================================
   FORMS
   ============================================================================ */

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--text);
}

.form-label .required { color: var(--danger); }

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 15px;
    color: var(--text);
    transition: all 0.2s;
    background: white;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder { color: #a0aec0; }

.form-help {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-error {
    color: var(--danger);
    font-size: 13px;
    margin-top: 4px;
    font-weight: 500;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.form-check input { cursor: pointer; }

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: white;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.btn-outline {
    background: white;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-outline:hover {
    background: var(--info-bg);
}

.btn-secondary {
    background: var(--bg-gray);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-block {
    width: 100%;
}

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 17px; }

/* ============================================================================
   ALERTS / FLASH MESSAGES
   ============================================================================ */

.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
    border-left: 4px solid;
}

.alert-success { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.alert-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }
.alert-info { background: var(--info-bg); color: var(--info); border-color: var(--info); }

/* ============================================================================
   DIVIDERS / LINKS
   ============================================================================ */

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    margin: 20px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.divider span {
    padding: 0 16px;
}

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 13px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

/* ============================================================================
   AUTH PAGE (dang-ky, dang-nhap)
   ============================================================================ */

.auth-wrapper {
    min-height: calc(100vh - 70px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #e6f1fb 0%, #f8f9fa 100%);
}

.auth-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 40px;
    max-width: 440px;
    width: 100%;
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-header h1 {
    font-size: 26px;
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 14px;
}

.auth-tabs {
    display: flex;
    background: var(--bg-gray);
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 24px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s;
    background: transparent;
    border: none;
    font-family: inherit;
}

.auth-tab.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.social-buttons {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text);
    font-family: inherit;
}

.btn-social:hover {
    background: var(--bg-gray);
    border-color: var(--text-muted);
}

.btn-social img { width: 20px; height: 20px; }

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-muted);
}

.auth-footer a { font-weight: 500; }

/* ============================================================================
   FOOTER
   ============================================================================ */

.site-footer {
    background: white;
    border-top: 1px solid var(--border);
    padding: 24px 20px;
    margin-top: 40px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.site-footer a { color: var(--primary); }

.footer-links {
    margin-bottom: 10px;
}

.footer-links a {
    margin: 0 10px;
}

/* ============================================================================
   HOMEPAGE HERO
   ============================================================================ */

.hero {
    padding: 60px 20px;
    text-align: center;
    background: linear-gradient(135deg, #e6f1fb 0%, #ffffff 100%);
    border-radius: var(--radius-lg);
    margin-bottom: 32px;
}

.hero h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 18px;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 24px;
}

.hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================================================
   SUBJECTS GRID
   ============================================================================ */

.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.subject-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
    transition: all 0.3s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

.subject-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.subject-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.subject-name {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
}

.subject-desc {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 12px;
}

.subject-stats {
    display: flex;
    gap: 12px;
    color: var(--text-muted);
    font-size: 12px;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .site-header .container {
        flex-direction: column;
        gap: 10px;
    }
    
    .main-nav {
        justify-content: center;
    }
    
    .main-nav a {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .hero {
        padding: 40px 20px;
    }
    
    .hero h1 { font-size: 28px; }
    .hero p { font-size: 16px; }
    
    .auth-card {
        padding: 28px 20px;
    }
    
    h1 { font-size: 26px; }
    h2 { font-size: 22px; }
    h3 { font-size: 19px; }
}

/* ============================================================================
   LOADING / UTILITIES
   ============================================================================ */

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.hidden { display: none !important; }
