/* Reset and base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #1a1a2e;
    background: #f8f9fa;
}

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

a {
    color: #4361ee;
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: #3a0ca3;
}

/* Header */
.site-header {
    background: linear-gradient(135deg, #4361ee, #3a0ca3);
    color: white;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
}

.logo:hover {
    color: #f0f0ff;
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 25px;
}

.main-nav a {
    color: rgba(255,255,255,0.9);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 5px 0;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.main-nav a:hover {
    color: white;
    border-bottom-color: white;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Main */
.site-main {
    min-height: calc(100vh - 200px);
}

/* Hero */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    padding: 80px 20px;
    margin-bottom: 40px;
}

.hero h1 {
    font-size: 2.8rem;
    margin-bottom: 15px;
    font-weight: 700;
}

.hero-sub {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 30px;
}

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

.btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: white;
    color: #4361ee;
}

.btn-primary:hover {
    background: #f0f0ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.btn-secondary {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.5);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

.btn-danger {
    background: #e63946;
    color: white;
}

.btn-danger:hover {
    background: #c1121f;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
}

/* Features */
.features {
    padding: 40px 0;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.feature-card {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    transition: all 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

.feature-card-wide {
    grid-column: 1 / -1;
    text-align: center;
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.feature-card h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: #1a1a2e;
}

.feature-card p {
    color: #6c757d;
    margin-bottom: 15px;
}

.feature-link {
    color: #4361ee;
    font-weight: 600;
}

/* Page content */
.page-content {
    padding: 40px 20px;
}

.page-content h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: #1a1a2e;
}

.page-desc {
    color: #6c757d;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.empty {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-style: italic;
}

.error {
    color: #e63946;
    padding: 10px;
    background: #fff5f5;
    border-radius: 8px;
    margin-bottom: 15px;
}

/* Flashcard */
.flashcard-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.flashcard {
    perspective: 1000px;
    height: 220px;
    cursor: pointer;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.flashcard-front {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.flashcard-front h3 {
    font-size: 1.4rem;
    margin-bottom: 10px;
}

.flashcard-back {
    background: white;
    transform: rotateY(180deg);
    color: #1a1a2e;
    font-size: 1.2rem;
}

/* Grammar */
.grammar-list {
    display: grid;
    gap: 20px;
}

.grammar-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
}

.grammar-card h3 {
    color: #4361ee;
    margin-bottom: 10px;
}

.grammar-answer {
    margin-top: 15px;
    padding: 10px;
    background: #e8f5e9;
    border-radius: 8px;
}

.grammar-explanation {
    margin-top: 10px;
    padding: 10px;
    background: #fff3e0;
    border-radius: 8px;
}

/* Reading */
.reading-list {
    display: grid;
    gap: 25px;
}

.reading-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    position: relative;
}

.reading-level {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #4361ee;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.reading-card h3 {
    margin-bottom: 10px;
    color: #1a1a2e;
    padding-right: 60px;
}

.reading-question, .reading-explanation {
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
}

.reading-question {
    background: #e3f2fd;
}

.reading-explanation {
    background: #fce4ec;
}

/* Writing */
.writing-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.writing-input textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 15px;
    transition: border-color 0.3s;
}

.writing-input textarea:focus {
    outline: none;
    border-color: #4361ee;
}

.writing-feedback {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
}

.feedback-placeholder {
    color: #6c757d;
    font-style: italic;
}

.feedback-list {
    list-style: none;
}

.feedback-list li {
    padding: 5px 0;
}

.writing-samples {
    margin-top: 30px;
}

.writing-sample {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.04);
}

.writing-sample-feedback {
    margin-top: 10px;
    padding: 10px;
    background: #f3e5f5;
    border-radius: 8px;
}

/* Progress */
.progress-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.progress-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    transition: transform 0.3s;
}

.progress-card:hover {
    transform: translateY(-3px);
}

.progress-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #4361ee;
    margin: 10px 0;
}

.progress-detail {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
}

.progress-item {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.progress-item:last-child {
    border-bottom: none;
}

/* Listening */
.listening-area {
    display: grid;
    gap: 25px;
}

.listening-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
}

.listening-card h3 {
    color: #1a1a2e;
    margin-bottom: 10px;
}

.listening-content {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    font-style: italic;
}

.listen-btn {
    margin: 10px 0;
}

.listening-question, .listening-explanation {
    margin-top: 10px;
    padding: 10px;
    border-radius: 8px;
}

.listening-question {
    background: #e8f5e9;
}

.listening-explanation {
    background: #fff3e0;
}

/* Speaking */
.speaking-area {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    margin-bottom: 40px;
}

.speaking-chat {
    height: 350px;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 15px;
}

.chat-message {
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 8px;
}

.chat-message.bot {
    background: #e3f2fd;
}

.chat-message.user {
    background: #f3e5f5;
    text-align: right;
}

.speaking-input {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.speaking-input input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.speaking-input input:focus {
    outline: none;
    border-color: #4361ee;
}

.speaking-scenarios {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.speaking-examples {
    margin-top: 30px;
}

.speaking-example {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.04);
}

.speaking-example-response {
    margin-top: 10px;
    padding: 10px;
    background: #e8f5e9;
    border-radius: 8px;
}

/* Admin */
.admin-container {
    padding: 40px 20px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.admin-header h2 {
    font-size: 1.8rem;
    color: #1a1a2e;
}

.admin-links {
    display: flex;
    gap: 10px;
}

.admin-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
}

.admin-section h3, .admin-section h4 {
    margin-bottom: 15px;
    color: #1a1a2e;
}

.admin-form .form-group {
    margin-bottom: 15px;
}

.admin-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.admin-form input[type="text"],
.admin-form input[type="password"],
.admin-form select,
.admin-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.3s;
}

.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
    outline: none;
    border-color: #4361ee;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.table-responsive {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
}

.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.admin-table tr:hover td {
    background: #f8f9fa;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 35px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.close {
    float: right;
    font-size: 1.8rem;
    cursor: pointer;
    color: #6c757d;
    transition: color 0.3s;
}

.close:hover {
    color: #1a1a2e;
}

/* Footer */
.site-footer {
    background: #1a1a2e;
    color: rgba(255,255,255,0.8);
    text-align: center;
    padding: 30px 20px;
    margin-top: 60px;
}

.footer-content p {
    margin: 5px 0;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .mobile-toggle {
        display: block;
    }

    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: #3a0ca3;
        padding: 20px;
    }

    .main-nav.active {
        display: block;
    }

    .main-nav ul {
        flex-direction: column;
        gap: 10px;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .writing-area {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
    }
}