/* ========================================
   RESET & BASE STYLES
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #ffffff;
    color: #222;
    overflow-x: hidden;
    padding-bottom: 65px;
    line-height: 1.5;
}

/* ========================================
   APP CONTAINER
   ======================================== */
.app-container {
    position: relative;
    width: 100%;
    min-height: calc(100vh - 65px);
    touch-action: pan-y;
}

/* ========================================
   STEP PAGES
   ======================================== */
.step-page {
    display: none;
    padding: 12px;
    max-width: 800px;
    margin: 0 auto;
    animation: fadeIn 0.2s ease;
}

.step-page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========================================
   GOAL SECTION (Collapsible - Starts Collapsed)
   ======================================== */
.goal-section {
    margin-bottom: 15px;
}

.goal-toggle {
    width: 100%;
    background-color: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.goal-toggle:hover {
    background-color: #e8e8e8;
}

.goal-toggle .toggle-icon {
    transition: transform 0.2s;
    font-size: 10px;
    color: #666;
}

.goal-toggle:not(.collapsed) .toggle-icon {
    transform: rotate(-180deg);
}

.goal-content {
    padding: 12px;
    background-color: #fafafa;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 6px 6px;
    margin-top: -1px;
}

.goal-content p {
    margin-bottom: 8px;
    font-size: 14px;
    color: #555;
}

.goal-img {
    width: 100%;
    max-width: 180px;
    height: auto;
    border-radius: 4px;
}

/* ========================================
   WORKOUT SECTION
   ======================================== */
.workout-section {
    background-color: #fff;
}

.workout-title {
    font-size: 18px;
    font-weight: 700;
    color: #222;
    margin-bottom: 12px;
    border-bottom: 2px solid #333;
    padding-bottom: 6px;
}

.workout-text {
    font-size: 14px;
    color: #444;
    margin-bottom: 12px;
}

/* ========================================
   FORMULA GROUP
   ======================================== */
.formula-group {
    margin-bottom: 20px;
    padding: 12px;
    background-color: #fafafa;
    border-radius: 6px;
    border-left: 3px solid #333;
}

.formula-label {
    font-size: 14px;
    font-weight: 600;
    color: #222;
    margin-bottom: 10px;
}

/* ========================================
   FORMULA IMAGES
   ======================================== */
.formula-images {
    margin-bottom: 12px;
    text-align: center;
}

.formula-images img {
    width: 100%;
    max-width: 280px;
    height: auto;
    border-radius: 4px;
    margin: 4px;
}

.formula-images.double {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.formula-images.double img {
    max-width: calc(50% - 8px);
    min-width: 140px;
}

@media (max-width: 500px) {
    .formula-images.double {
        flex-direction: column;
        align-items: center;
    }
    .formula-images.double img {
        max-width: 100%;
    }
}

/* ========================================
   FORMULA DISPLAY - COMPACT VERSION
   ======================================== */
.formula {
    background-color: white;
    padding: 10px 12px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.formula-title {
    display: inline;
    font-size: 13px;
    font-weight: 700;
    color: #222;
    margin-right: 8px;
}

.formula-moves {
    display: inline;
    white-space: nowrap;
    overflow-x: auto;
    font-size: 15px;
    font-weight: 600;
}

/* Individual Move - Just Letters with Colors */
.move {
    display: inline-block;
    margin: 0 3px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 700;
    font-size: 15px;
    position: relative;
}

/* Color Borders - Subtle */
.move.voorzijde {
    color: #1976D2;
    background-color: rgba(33, 150, 243, 0.1);
}

.move.achterzijde {
    color: #388E3C;
    background-color: rgba(76, 175, 80, 0.1);
}

.move.linkerzijde {
    color: #F57C00;
    background-color: rgba(255, 152, 0, 0.1);
}

.move.rechterzijde {
    color: #D32F2F;
    background-color: rgba(244, 67, 54, 0.1);
}

.move.bovenzijde {
    color: #F57F17;
    background-color: rgba(255, 235, 59, 0.2);
}

.move.onderzijde {
    color: #616161;
    background-color: rgba(158, 158, 158, 0.1);
}

/* Inverse Indicator - Small Icon */
.move.inverse::after {
    content: "↺";
    font-size: 10px;
    position: absolute;
    top: -2px;
    right: 0px;
    opacity: 0.7;
}

.rotate-icon {
    display: none; /* Hide the rotate icons from HTML */
}

/* Bracket Groups - Subtle */
.bracket-group {
    display: inline;
    padding: 2px 4px;
    background-color: rgba(0, 0, 0, 0.03);
    border: 1px dashed #ccc;
    border-radius: 4px;
    margin: 0 2px;
}

.repeat-indicator {
    display: inline-block;
    padding: 2px 6px;
    background-color: #333;
    color: white;
    border-radius: 3px;
    font-weight: 600;
    font-size: 12px;
    margin-left: 4px;
}

.formula-note {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* ========================================
   INFO SECTION (Tab 8)
   ======================================== */
.info-section {
    margin-bottom: 20px;
}

.info-section h4 {
    font-size: 16px;
    font-weight: 700;
    color: #222;
    margin-bottom: 8px;
    border-bottom: 2px solid #333;
    padding-bottom: 4px;
}

.info-section p {
    font-size: 14px;
    line-height: 1.6;
    color: #444;
    margin-bottom: 10px;
}

.notation-list {
    list-style: none;
    padding-left: 0;
}

.notation-list li {
    margin-bottom: 8px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.source-link {
    margin-top: 25px;
    padding-top: 12px;
    border-top: 1px solid #ddd;
    text-align: center;
}

.source-link a {
    color: #1976D2;
    text-decoration: none;
    font-weight: 600;
}

.source-link a:hover {
    text-decoration: underline;
}

/* ========================================
   STEP NAVIGATION - SUBTLE
   ======================================== */
.step-navigation {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 20px;
    padding-top: 12px;
    border-top: 1px solid #e8e8e8;
}

.nav-btn {
    padding: 6px 12px;
    border: none;
    background-color: transparent;
    color: #666;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
    text-decoration: underline;
}

.nav-btn:hover:not(:disabled) {
    color: #222;
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    text-decoration: none;
}

/* ========================================
   BOTTOM APPBAR - RESPONSIVE
   ======================================== */
.bottom-appbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #ffffff;
    border-top: 1px solid #ddd;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    z-index: 1000;
    min-height: 58px;
}

.appbar-group {
    display: flex;
    gap: 4px;
    padding: 4px 6px;
    border-radius: 6px;
}

/* Layer grouping - subtle backgrounds */
.appbar-group.laag1 {
    background-color: rgba(33, 150, 243, 0.08);
}

.appbar-group.laag2 {
    background-color: rgba(76, 175, 80, 0.08);
}

.appbar-group.laag3 {
    background-color: rgba(255, 235, 59, 0.12);
}

.appbar-group.info {
    background-color: rgba(0, 0, 0, 0.04);
}

.appbar-separator {
    width: 1px;
    height: 35px;
    background-color: #d0d0d0;
    margin: 0 4px;
}

.step-btn {
    min-width: 38px;
    min-height: 38px;
    max-width: 42px;
    max-height: 42px;
    border: 1px solid #ccc;
    background-color: white;
    color: #555;
    font-size: 14px;
    font-weight: 600;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.step-btn:hover {
    border-color: #888;
    color: #222;
}

.step-btn.active {
    background-color: #222;
    color: white;
    border-color: #222;
    font-weight: 700;
}

.info-icon {
    font-size: 16px;
}

/* ========================================
   RESPONSIVE - MOBILE FIRST
   ======================================== */

/* Very small phones */
@media (max-width: 340px) {
    .step-btn {
        min-width: 34px;
        min-height: 34px;
        max-width: 38px;
        max-height: 38px;
        font-size: 12px;
    }

    .appbar-group {
        gap: 3px;
        padding: 3px 4px;
    }

    .appbar-separator {
        margin: 0 2px;
    }

    .move {
        font-size: 14px;
        padding: 2px 4px;
        margin: 0 2px;
    }
}

/* Small phones */
@media (max-width: 380px) {
    .bottom-appbar {
        padding: 5px 2px;
    }
}

/* Tablets and up */
@media (min-width: 768px) {
    .step-page {
        padding: 20px;
    }

    .workout-title {
        font-size: 20px;
    }

    .workout-text {
        font-size: 15px;
    }

    .formula-images img {
        max-width: 320px;
    }

    .move {
        font-size: 16px;
        padding: 3px 7px;
    }

    .bottom-appbar {
        padding: 8px 10px;
        min-height: 62px;
    }

    .step-btn {
        min-width: 44px;
        min-height: 44px;
        max-width: 48px;
        max-height: 48px;
        font-size: 16px;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .formula-images img {
        max-width: 350px;
    }
}

/* ========================================
   TOUCH OPTIMIZATION
   ======================================== */
@media (hover: none) and (pointer: coarse) {
    .goal-toggle,
    .nav-btn,
    .step-btn {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
    }
}
