/* ==========================================================================
   Stonowany, elegancki i przyjazny dla uczennicy styl graficzny platformy Chemia
   ========================================================================== */

:root {
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-subtle: #f1f5f9;
    --border-subtle: #e2e8f0;
    --border-medium: #cbd5e1;
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --primary: #3b7a57;        /* stonowana szałwiowa zieleń */
    --primary-light: #ecfdf5;
    --primary-dark: #2d5e43;
    
    --accent: #2563eb;         /* stonowany błękit naukowy */
    --accent-light: #eff6ff;
    
    --warning: #d97706;        /* ciepły bursztyn na wskazówki */
    --warning-light: #fffbeb;
    
    --danger: #dc2626;         /* delikatna czerwień na błędy */
    --danger-light: #fef2f2;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.6;
    font-size: 16px;
}

/* Układ kontenera */
.app-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 24px 60px 24px;
}

/* Górny pasek / Nagłówek */
header.app-header {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
}

.brand-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    text-decoration: none;
    letter-spacing: -0.02em;
}

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

/* Główna nawigacja */
nav.main-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

nav.main-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

nav.main-nav a:hover {
    color: var(--text-main);
    background-color: var(--bg-card-subtle);
}

nav.main-nav a.active {
    background-color: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 600;
    border-color: #a7f3d0;
}

/* Karty i sekcje */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.card-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-desc {
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 15px;
}

/* Stylizacje chemiczne */
.chem-formula {
    font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace;
    font-weight: 600;
    letter-spacing: 0.05em;
    font-size: 1.15em;
    color: #1e3a8a;
    background: #f8fafc;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    display: inline-block;
}

.chem-large {
    font-size: 2.2rem;
    padding: 8px 18px;
    letter-spacing: 0.06em;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-md);
    display: inline-block;
    margin: 10px 0;
}

.chem-rule-box {
    background: #fdfbf7;
    border-left: 4px solid var(--warning);
    padding: 16px 20px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin: 16px 0;
    color: #451a03;
    font-size: 15px;
}

.chem-rule-box strong {
    color: #78350f;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-metal { background: #e0f2fe; color: #0369a1; }
.badge-niemetal { background: #fef3c7; color: #b45309; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-fixed { background: #f1f5f9; color: #475569; }
.badge-variable { background: #fee2e2; color: #b91c1c; }

/* Grid zadań na stronie głównej */
.tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 16px;
}

.task-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-decoration: none;
    color: inherit;
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.task-number {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.task-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-main);
}

.task-desc {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 16px;
    flex-grow: 1;
}

.task-cta {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Formularze i pola ćwiczeń */
.exercise-box {
    background: #fafafa;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin: 20px 0;
    text-align: center;
}

.exercise-prompt {
    font-size: 18px;
    margin-bottom: 18px;
    color: var(--text-main);
}

.input-text {
    width: 100%;
    max-width: 420px;
    padding: 12px 18px;
    font-size: 18px;
    border: 2px solid var(--border-medium);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    text-align: center;
    background: #ffffff;
}

.input-text:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 122, 87, 0.15);
}

.coeff-input {
    width: 44px;
    height: 44px;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    border: 2px solid var(--border-medium);
    border-radius: var(--radius-sm);
    margin: 0 4px;
    background: #ffffff;
}

.coeff-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 122, 87, 0.2);
}

/* Przyciski */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg-card-subtle);
    color: var(--text-main);
    border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
    background: #e2e8f0;
}

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

.btn-outline:hover {
    background: var(--primary-light);
}

.btn-group {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* Feedback po sprawdzeniu odpowiedzi */
.feedback-box {
    margin-top: 20px;
    padding: 18px 24px;
    border-radius: var(--radius-md);
    font-size: 15px;
    text-align: left;
    animation: fadeIn 0.3s ease;
}

.feedback-success {
    background: var(--primary-light);
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.feedback-error {
    background: var(--danger-light);
    border: 1px solid #fecaca;
    color: #991b1b;
}

.feedback-title {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.explanation-card {
    background: #ffffff;
    border: 1px dashed var(--border-medium);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-top: 10px;
    font-size: 14px;
    color: var(--text-main);
}

/* Obrazy edukacyjne */
.img-educational {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    margin: 16px 0;
    display: block;
}

.img-caption {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    margin-top: -8px;
    margin-bottom: 16px;
}

/* Tabele chemiczne */
.chem-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 14px;
}

.chem-table th, .chem-table td {
    padding: 10px 14px;
    border: 1px solid var(--border-subtle);
    text-align: left;
}

.chem-table th {
    background: var(--bg-card-subtle);
    color: var(--text-main);
    font-weight: 600;
}

.chem-table tr:nth-child(even) td {
    background: #fafafa;
}

/* Pasek postępu */
.progress-container {
    background: #e2e8f0;
    border-radius: 20px;
    height: 10px;
    width: 100%;
    overflow: hidden;
    margin: 12px 0 20px 0;
}

.progress-bar {
    background: var(--primary);
    height: 100%;
    transition: width 0.3s ease;
}

/* Animacja */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Stopka */
footer.app-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
}

/* Responsywność */
@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        align-items: flex-start;
    }
    nav.main-nav {
        width: 100%;
        justify-content: flex-start;
    }
    .tasks-grid {
        grid-template-columns: 1fr;
    }
    .chem-large {
        font-size: 1.6rem;
    }
}
