/* =========================================
   Smart Math Tutor - Main Styles
   ========================================= */

:root {
    --smt-primary: #3498db;
    --smt-primary-dark: #2980b9;
    --smt-success: #2ecc71;
    --smt-error: #e74c3c;
    --smt-text: #2c3e50;
    --smt-text-light: #7f8c8d;
    --smt-bg: #f8f9fa;
    --smt-card-bg: #ffffff;
    --smt-border-radius: 12px;
    --smt-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

/* Hlavní kontejner aplikace */
#smt-app-root {
    max-width: 800px;
    margin: 40px auto;
    padding: 40px;
    background: var(--smt-card-bg);
    border-radius: var(--smt-border-radius);
    box-shadow: var(--smt-shadow);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    text-align: center;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Aby se dashboard neroztahoval */
    position: relative;
}

/* Loading & Error stavy */
.smt-loading, .smt-error {
    font-size: 1.2rem;
    color: var(--smt-text-light);
    padding: 20px;
    margin: auto; /* Vycentrování */
}
.smt-error {
    color: var(--smt-error);
}

/* =========================================
   DASHBOARD
   ========================================= */

.smt-dashboard-header {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.smt-wallet-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.smt-wallet-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.smt-wallet-amount {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--smt-primary);
    line-height: 1;
}

.smt-wallet-label {
    font-size: 1rem;
    color: var(--smt-text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 5px;
}

.smt-section-title {
    font-size: 1.5rem;
    color: var(--smt-text);
    margin-bottom: 20px;
    text-align: left;
}

/* Grid Skillů */
.smt-skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.smt-skill-card {
    background: #fff;
    border: 2px solid #eee;
    border-radius: 10px;
    padding: 20px;
    text-align: left;
    transition: transform 0.2s, box-shadow 0.2s;
}

.smt-skill-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    border-color: var(--smt-primary);
}

.smt-skill-card.locked {
    opacity: 0.6;
    pointer-events: none;
    background: #f9f9f9;
}

.smt-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.smt-card-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--smt-text);
}

/* Progress Bar */
.smt-progress-container {
    margin-bottom: 15px;
}

.smt-progress-bar {
    height: 8px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.smt-progress-fill {
    height: 100%;
    background: var(--smt-primary);
    transition: width 0.5s ease-out;
}
.smt-progress-fill.low { background: #f1c40f; }
.smt-progress-fill.medium { background: #3498db; }
.smt-progress-fill.high { background: #2ecc71; }

.smt-progress-text {
    font-size: 0.85rem;
    color: var(--smt-text-light);
}

.smt-btn-play {
    width: 100%;
    padding: 10px;
    background: var(--smt-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}
.smt-btn-play:hover {
    background: var(--smt-primary-dark);
}

/* =========================================
   GAMEPLAY - LINEAR LAYOUT (1 + 1 = ?)
   ========================================= */

.smt-problem-wrapper {
    margin: 40px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.layout-linear-expression {
    flex-wrap: wrap;
    gap: 15px;
    font-size: 3rem;
    font-weight: bold;
    color: var(--smt-text);
}

.smt-text.operator {
    color: var(--smt-primary);
    margin: 0 5px;
}

/* =========================================
   GAMEPLAY - VERTICAL LAYOUT (Písemné)
   ========================================= */

.smt-vertical-grid {
    display: grid;
    grid-template-columns: auto auto; /* Znaménko + Číslo */
    font-size: 3rem;
    font-weight: bold;
    text-align: right;
    line-height: 1.2;
    gap: 0 10px; /* Mezera mezi znaménkem a číslem */
}

/* Prvky Gridu */
.row-top {
    grid-column: 2;
    grid-row: 1;
}
.row-bottom {
    grid-column: 2;
    grid-row: 2;
}
.operator-sign {
    grid-column: 1;
    grid-row: 2;
    color: var(--smt-text-light);
    align-self: center;
}
.divider-line {
    grid-column: 1 / span 2;
    grid-row: 3;
    height: 4px;
    background: var(--smt-text);
    margin: 5px 0 15px 0;
    border-radius: 2px;
}
.smt-input {
    /* Input je ve vertikálním layoutu dole */
    grid-column: 2;
    grid-row: 4;
}

/* Společné styly pro Inputy */
.smt-input {
    width: 120px;
    height: 80px;
    font-size: 2.5rem;
    text-align: center;
    border: 3px solid #dfe6e9;
    border-radius: 10px;
    background: #fff;
    color: var(--smt-text);
    transition: all 0.2s ease;
    outline: none;
}

.smt-input:focus {
    border-color: var(--smt-primary);
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.1);
}

/* Validace */
.smt-input.smt-correct {
    border-color: var(--smt-success);
    background-color: #f0fdf4;
    color: var(--smt-success);
}

.smt-input.smt-incorrect {
    border-color: var(--smt-error);
    background-color: #fef2f2;
    color: var(--smt-error);
    animation: smt-shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

/* =========================================
   TLAČÍTKA
   ========================================= */
.smt-btn-submit {
    background-color: var(--smt-primary);
    color: #fff;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.1s, background-color 0.2s;
    box-shadow: 0 4px 6px rgba(52, 152, 219, 0.2);
}

.smt-btn-submit:hover {
    background-color: var(--smt-primary-dark);
    transform: translateY(-2px);
}

.smt-btn-submit.smt-btn-success {
    background-color: var(--smt-success);
    box-shadow: 0 4px 6px rgba(46, 204, 113, 0.2);
}
.smt-btn-submit.smt-btn-success:hover {
    background-color: #27ae60;
}

.smt-btn-secondary {
    background: transparent;
    border: 2px solid #bdc3c7;
    color: var(--smt-text-light);
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
}
.smt-btn-secondary:hover {
    border-color: var(--smt-text);
    color: var(--smt-text);
}

.smt-btn-small {
    font-size: 0.9rem;
    padding: 5px 15px;
}

/* =========================================
   TEACHER / PARENT ZONE (LMS)
   ========================================= */
.smt-teacher-dashboard {
    text-align: left;
}

.smt-group-card {
    /* Styly v JS jsou inline pro rychlost, ale zde je můžeme zpřehlednit/přepsat */
    transition: transform 0.2s;
}

.smt-group-card:hover {
    transform: translateY(-2px);
}

.smt-students-table th {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--smt-text-light);
    letter-spacing: 0.5px;
}

.smt-student-row:hover {
    background-color: #f9f9f9;
}

.smt-actions-cell {
    text-align: right;
}

.add-student-btn {
    padding: 5px 15px;
    font-size: 0.9rem;
}

.copy-link-btn {
    border-color: #e0e0e0;
}
.copy-link-btn:hover {
    background-color: #f0f0f0;
}

/* =========================================
   ANIMACE
   ========================================= */
@keyframes smt-shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

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

.animate-fade-in {
    animation: fadeIn 0.4s ease-out;
}

/* =========================================
   RESPONSIVITA
   ========================================= */
@media (max-width: 600px) {
    #smt-app-root {
        padding: 20px;
        margin: 10px;
    }

    .layout-linear-expression {
        font-size: 2rem;
    }

    .smt-vertical-grid {
        font-size: 2.5rem;
    }

    .smt-input {
        width: 80px;
        height: 60px;
        font-size: 1.8rem;
    }

    .smt-wallet-amount {
        font-size: 2.5rem;
    }

    /* Teacher Responsivity */
    .smt-group-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .smt-group-header button {
        align-self: flex-start;
    }
}