/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fafafa;
}

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

/* Header Styles */
.header {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo {
    font-family: 'Crimson Text', serif;
    font-size: 2rem;
    font-weight: 600;
    margin: 0;
}

.nav {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.nav-btn {
    background: rgba(255,255,255,0.1);
    color: white;
    border: 2px solid rgba(255,255,255,0.2);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-btn:hover, .nav-btn.active {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.4);
    transform: translateY(-2px);
}

/* Main Content */
.main {
    min-height: calc(100vh - 120px);
    padding: 2rem 0;
}

.section {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Home Section */
.hero {
    text-align: center;
    padding: 3rem 0;
}

.hero h2 {
    font-family: 'Crimson Text', serif;
    font-size: 3rem;
    color: #1e3a8a;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 3rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.feature-card {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.feature-card h3 {
    color: #1e3a8a;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.feature-card p {
    color: #666;
    margin-bottom: 1.5rem;
}

/* Buttons */
.btn-primary, .btn-secondary {
    background: linear-gradient(135deg, #3b82f6 0%, #1e3a8a 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-secondary {
    background: linear-gradient(135deg, #6b7280 0%, #374151 100%);
}

.btn-primary:hover, .btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Grammar Topics */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.topic-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid #3b82f6;
}

.topic-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    border-left-color: #1e3a8a;
}

.topic-card h3 {
    color: #1e3a8a;
    margin-bottom: 0.5rem;
}

.topic-card p {
    color: #666;
    font-size: 0.9rem;
}

/* Topic Detail */
.topic-detail {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    margin-top: 2rem;
}

.topic-detail.hidden {
    display: none;
}

.back-btn {
    background: #f3f4f6;
    color: #374151;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    margin-bottom: 1.5rem;
    transition: background 0.3s ease;
}

.back-btn:hover {
    background: #e5e7eb;
}

/* Exercises */
.exercise-container {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    margin-top: 2rem;
}

.exercise-selector {
    margin-bottom: 2rem;
    text-align: center;
}

.exercise-selector h3 {
    color: #1e3a8a;
    margin-bottom: 1rem;
}

.exercise-btn {
    background: #f3f4f6;
    color: #374151;
    border: 2px solid #e5e7eb;
    padding: 0.75rem 1.5rem;
    margin: 0.5rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.exercise-btn:hover, .exercise-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.exercise-area {
    min-height: 300px;
    padding: 2rem;
    background: #f9fafb;
    border-radius: 10px;
    margin: 1rem 0;
}

.question {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.question h4 {
    color: #1e3a8a;
    margin-bottom: 1rem;
}

.options {
    display: grid;
    gap: 0.5rem;
}

.option {
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option:hover {
    background: #e5e7eb;
}

.option.selected {
    background: #dbeafe;
    border-color: #3b82f6;
}

.option.correct {
    background: #dcfce7;
    border-color: #16a34a;
}

.option.incorrect {
    background: #fecaca;
    border-color: #dc2626;
}

.exercise-results {
    background: #f0f9ff;
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
    margin-top: 1rem;
}

.exercise-results.hidden {
    display: none;
}

.score-display {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1e3a8a;
    margin-bottom: 1rem;
}

/* Reference Section */
.reference-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.reference-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    overflow: hidden;
}

.reference-card h3 {
    background: linear-gradient(135deg, #3b82f6 0%, #1e3a8a 100%);
    color: white;
    padding: 1rem;
    margin: 0;
}

.reference-content {
    padding: 1.5rem;
}

.reference-content table {
    width: 100%;
    border-collapse: collapse;
}

.reference-content th,
.reference-content td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.reference-content th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
}

.reference-content ul {
    list-style: none;
}

.reference-content li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f3f4f6;
}

.reference-content li:last-child {
    border-bottom: none;
}

/* Footer */
.footer {
    background: #374151;
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 3rem;
}

/* Grammar Tables Styles */
.grammar-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.grammar-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.grammar-table td {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
}

.grammar-table tr:nth-child(even) {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.grammar-table tr:hover {
    background: linear-gradient(135deg, #e0f2fe 0%, #e1f5fe 100%);
    transform: translateY(-1px);
    transition: all 0.3s ease;
}

.grammar-table .formula {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    padding: 0.5rem;
    border-radius: 6px;
    font-weight: 600;
    color: #92400e;
}

.grammar-table .example {
    font-style: italic;
    color: #059669;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    padding: 0.5rem;
    border-radius: 6px;
    border-left: 4px solid #10b981;
}

/* Tense Table Specific */
.tense-table th {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

/* Voice Table Specific */
.voice-table th {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

/* Narration Tables Specific */
.narration-table th {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.person-change-table th {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.tense-change-table th {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.adverbial-change-table th {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}

.punctuation-change-table th {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
}

/* Table Container */
.table-container {
    margin: 2rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
}

.table-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
    text-align: center;
    padding: 0.75rem;
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav {
        justify-content: center;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
    }
    
    .topic-grid {
        grid-template-columns: 1fr;
    }
    
    .reference-grid {
        grid-template-columns: 1fr;
    }
    
    .hero h2 {
        font-size: 2rem;
    }
    
    .grammar-table {
        font-size: 0.85rem;
    }
    
    .grammar-table th,
    .grammar-table td {
        padding: 0.75rem 0.5rem;
    }
    
    .table-container {
        padding: 1rem;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
