/* assets/css/responsive.css */
/* تایبەتمەندی تەواوی ڕیسپۆنسیڤ بۆ مۆبایل، ئایپاد و دیسکتۆپ */

/* -------------------------------------------------------------
   1. ئایپاد و تابلێتەکان (Tablets & iPads - Max 1024px)
   ------------------------------------------------------------- */
@media (max-width: 1024px) {
    .map-container {
        padding: 0 16px 40px;
    }

    .stages-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 16px;
    }

    .stage-node {
        width: 100px;
        height: 125px;
    }

    .stage-circle {
        width: 78px;
        height: 78px;
        font-size: 34px;
    }

    .target-words-container {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 14px;
        justify-content: center;
    }

    .target-words-container.words-count-1 {
        grid-template-columns: minmax(0, 380px);
    }

    .target-words-container.words-count-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .target-words-container.words-count-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .target-words-container.words-count-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .word-card {
        padding: 16px 10px;
        min-height: 300px;
    }

    .word-stem-text, .word-completed-text {
        font-size: 32px;
    }

    .letter-dropzone {
        min-width: 42px;
        height: 48px;
        font-size: 32px;
        border: none;
        border-bottom: 3.5px solid var(--primary);
        background: transparent;
        border-radius: 0;
    }

    .word-image-wrapper {
        max-width: 160px;
        height: 130px;
    }
}

/* -------------------------------------------------------------
   2. تابلێتی بچووک و شاشە مامناوەندەکان (Max 768px)
   ------------------------------------------------------------- */
@media (max-width: 768px) {
    .app-header {
        padding: 8px 14px;
        gap: 8px;
    }

    .brand-container {
        gap: 8px;
    }

    .brand-title {
        font-size: 18px;
    }

    .brand-logo {
        width: 38px;
        height: 38px;
        font-size: 20px;
        border-radius: 12px;
    }

    .header-stage-badge {
        font-size: 13px;
        padding: 5px 12px;
    }

    .stage-badge-full {
        display: none;
    }

    .stage-badge-mobile {
        display: inline;
    }

    .header-actions {
        gap: 6px;
    }

    .header-user-badge,
    .btn-logout-desktop {
        display: none !important;
    }

    .header-points-pill {
        padding: 5px 11px;
        font-size: 13px;
        gap: 5px;
        border-radius: 999px;
    }

    .btn-sound-toggle {
        width: 38px;
        height: 38px;
        font-size: 17px;
    }

    .btn-header-action {
        padding: 6px 12px;
        font-size: 13px;
        border-radius: 10px;
        white-space: nowrap;
    }

    .btn-map-text-desktop {
        display: none;
    }

    .btn-map-text-mobile {
        display: inline;
    }

    .user-name-text {
        font-size: 13px;
    }

    .map-hero-card {
        flex-direction: column;
        text-align: center;
        gap: 16px;
        padding: 24px 20px;
    }

    .stages-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 14px;
    }

    /* پیتەکانی ڕاکێشان لە مۆبایل */
    .source-letters-bar {
        gap: 12px;
        padding: 8px 14px;
        margin-bottom: 8px;
    }

    .draggable-letter {
        width: 56px;
        height: 56px;
        font-size: 32px;
        border-radius: 14px;
    }

    /* لەسەر مۆبایل سڵایدەری وشەکان چالاک دەبێت بۆ ئەوەی بەبێ سکرۆڵ لەبەردەم چاوی منداڵ بێت */
    .words-slider-nav {
        display: flex;
    }

    .target-words-container {
        display: block;
        margin-bottom: 8px;
    }

    .word-card {
        display: none;
        max-width: 360px;
        margin: 0 auto;
        padding: 12px 14px;
        min-height: auto;
    }

    .word-card.active-slide {
        display: flex;
        animation: slideCardFade 0.25s ease-out;
    }

    @keyframes slideCardFade {
        from {
            opacity: 0;
            transform: scale(0.97);
        }
        to {
            opacity: 1;
            transform: scale(1);
        }
    }

    .word-slot-wrapper {
        margin: 4px 0 6px;
        min-height: 52px;
    }

    .word-stem-text, .word-completed-text {
        font-size: 34px;
    }

    .letter-dropzone {
        min-width: 50px;
        height: 50px;
        font-size: 26px;
    }

    .word-image-wrapper {
        max-width: 175px;
        height: 130px;
        margin: 4px 0 6px;
    }

    .word-audio-btn {
        padding: 5px 16px;
        font-size: 13px;
        margin-top: 2px;
    }

    .game-instructions-banner {
        padding: 6px 12px;
        font-size: 12px;
        margin-bottom: 8px;
        gap: 8px;
    }

    .btn-restart-game-top {
        padding: 4px 8px;
        font-size: 11px;
    }

    .btn-restart-game {
        padding: 10px 18px;
        font-size: 13px;
    }

    .drag-game-card {
        padding: 12px 8px;
        border-radius: 18px;
    }

    .learn-container {
        padding: 6px 10px 16px;
    }

    .learn-steps-nav {
        gap: 8px;
    }

    .step-indicator {
        padding: 8px 14px;
        font-size: 13px;
    }

    .step-badge {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }

    .tracer-wrapper {
        padding: 18px 14px;
        border-radius: 20px;
    }

    .tracer-rounds-nav {
        gap: 8px;
        margin-bottom: 16px;
    }

    .round-card-btn {
        padding: 8px 10px;
        border-radius: 14px;
    }

    .round-badge {
        width: 28px;
        height: 28px;
        font-size: 13px;
    }

    .round-name {
        font-size: 12px;
    }

    .round-state {
        font-size: 10px;
    }

    .canvas-container {
        height: 280px;
        border-radius: 18px;
    }

    .canvas-toolbar {
        max-width: 100%;
        gap: 10px;
    }

    /* دوگمەکانی هەنگاوی ڤیدیۆ بۆ تابلێت و مۆبایل */
    .video-step-actions {
        flex-direction: column-reverse;
        gap: 12px !important;
        width: 100%;
        margin-top: 22px;
    }

    .video-step-actions .btn-video-next,
    .video-step-actions .btn-video-prev {
        width: 100% !important;
        min-height: 52px;
        box-sizing: border-box;
        border-radius: 16px !important;
        font-size: 15.5px !important;
        font-weight: 800;
        white-space: nowrap !important;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        padding: 13px 20px !important;
    }

    .video-step-actions .btn-video-next {
        box-shadow: 0 6px 18px rgba(41, 97, 112, 0.25);
    }

    .video-step-actions .btn-video-prev {
        font-size: 14.5px !important;
        padding: 12px 20px !important;
        background: #F8FAFC !important;
        color: #475569 !important;
        border: 2px solid #CBD5E1 !important;
        border-bottom: 4px solid #94A3B8 !important;
    }
}

/* -------------------------------------------------------------
   3. مۆبایلی بچووک (Phones - Max 480px)
   ------------------------------------------------------------- */
@media (max-width: 480px) {
    .app-header {
        padding: 8px 12px;
        gap: 8px;
    }

    .brand-container {
        gap: 8px;
    }

    .brand-title {
        display: inline-block !important;
        font-size: 17px !important;
        font-weight: 900 !important;
    }

    .brand-logo {
        width: 38px;
        height: 38px;
        font-size: 18px;
        border-radius: 12px;
    }

    .header-stage-badge {
        font-size: 12px;
        padding: 4px 10px;
        letter-spacing: 0;
    }

    .btn-sound-toggle {
        width: 34px;
        height: 34px;
        font-size: 15px;
    }

    .btn-header-action {
        padding: 5px 8px;
        font-size: 12px;
        gap: 4px;
        border-radius: 8px;
    }

    .header-actions {
        gap: 5px;
    }

    .header-points-pill {
        padding: 4px 8px;
        font-size: 12px;
        gap: 3px;
        border-width: 1.5px;
        box-shadow: 0 2px 6px rgba(250, 204, 21, 0.3);
    }

    .header-points-pill .points-label {
        display: none; /* شاردنەوەی دەقی 'خاڵ' لەسەر شاشەی بچووک بۆ ڕێکبوونی هێدەر */
    }

    .modal-points-awarded {
        width: 100% !important;
        box-sizing: border-box !important;
        font-size: 13px !important;
        padding: 8px 12px !important;
        border-radius: 12px !important;
    }

    .stages-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .stage-circle {
        width: 68px;
        height: 68px;
        font-size: 30px;
    }

    .stage-label {
        font-size: 13px;
    }

    .draggable-letter {
        width: 50px;
        height: 50px;
        font-size: 28px;
    }

    .word-stem-text, .word-completed-text {
        font-size: 28px;
    }

    .letter-dropzone {
        min-width: 36px;
        height: 44px;
        font-size: 28px;
        border: none;
        border-bottom: 3px solid var(--primary);
        background: transparent;
        border-radius: 0;
    }

    .word-image-wrapper {
        max-width: 155px;
        height: 120px;
    }

    .slider-tab-btn {
        padding: 6px 12px;
        font-size: 12.5px;
        border-radius: 999px;
    }

    .slider-arrow-btn {
        width: 34px;
        height: 34px;
        font-size: 13px;
    }

    .btn-primary, .btn-secondary, .btn-success, .btn-restart-game {
        padding: 12px 20px;
        font-size: 15px;
        width: 100%;
        justify-content: center;
    }

    .video-step-actions {
        gap: 10px !important;
        margin-top: 20px !important;
    }

    .video-step-actions .btn-video-next,
    .video-step-actions .btn-video-prev {
        min-height: 50px !important;
        border-radius: 14px !important;
        font-size: 14.5px !important;
        padding: 12px 16px !important;
    }

    .video-step-actions .btn-video-prev {
        font-size: 13.5px !important;
    }

    .btn-restart-game-top .btn-restart-text {
        display: none;
    }

    .learn-steps-nav {
        display: flex;
        justify-content: center;
        gap: 6px;
        margin-bottom: 18px;
        width: 100%;
        padding: 0 4px;
    }

    .step-indicator {
        flex: 1;
        min-width: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
        padding: 7px 6px;
        font-size: clamp(10px, 2.7vw, 12px);
        font-weight: 800;
        border-radius: 999px;
        text-align: center;
    }

    .step-indicator span:not(.step-badge) {
        display: inline-block !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .step-badge {
        width: 22px;
        height: 22px;
        font-size: 11px;
        flex-shrink: 0;
    }

    .tracer-wrapper {
        padding: 14px 10px;
        border-radius: 16px;
    }

    .tracer-rounds-nav {
        gap: 4px;
        margin-bottom: 10px;
    }

    .round-card-btn {
        padding: 5px 4px;
        border-radius: 10px;
        gap: 3px;
    }

    .round-badge {
        width: 22px;
        height: 22px;
        font-size: 11px;
    }

    .round-name {
        font-size: 10px;
    }

    .round-state {
        display: none;
    }

    .round-star {
        font-size: 12px;
    }

    .instruction-text {
        font-size: 12px;
    }

    .progress-badge {
        font-size: 11px;
        padding: 4px 10px;
    }

    .canvas-area-card {
        padding: 12px 8px;
        border-radius: 16px;
    }

    .canvas-container {
        height: 260px;
        max-width: 100%;
        border-radius: 18px;
        margin-bottom: 12px;
    }

    .canvas-toolbar {
        flex-direction: column;
        gap: 12px;
        width: 100%;
        align-items: center;
    }

    .color-palette {
        width: auto;
        max-width: 100%;
        justify-content: center;
        gap: 6px;
        padding: 5px 12px;
    }

    .color-dot {
        width: 26px;
        height: 26px;
    }

    .custom-color-picker-wrapper,
    .custom-color-trigger {
        width: 26px;
        height: 26px;
    }

    .brush-size-control {
        width: auto;
        max-width: 100%;
        padding: 5px 12px;
        gap: 6px;
        justify-content: center;
    }

    .brush-size-slider {
        width: 65px;
    }

    .tool-actions {
        width: 100%;
        justify-content: center;
        gap: 10px;
        flex-wrap: nowrap;
    }

    .btn-tool-action {
        flex: 0 1 auto;
        justify-content: center;
        padding: 9px 16px;
        font-size: 13.5px;
        white-space: nowrap !important;
    }

    .btn-next-form {
        padding: 9px 18px !important;
        font-size: 13.5px !important;
    }

    .word-zoom-card {
        padding: 24px 16px 20px;
        width: 95%;
        border-radius: 22px;
    }

    .word-zoom-word {
        font-size: 42px;
    }

    .word-zoom-image-wrapper {
        height: 190px;
        border-radius: 16px;
    }

    .word-zoom-audio-btn {
        width: 100%;
        justify-content: center;
        padding: 11px 18px;
        font-size: 14px;
    }
}

/* -------------------------------------------------------------
   4. کۆمپیوتەر و شاشە گەورەکان (Min 769px) - ٣ وشەکە بەتەنیشت یەکەوە
   ------------------------------------------------------------- */
@media (min-width: 769px) {
    .words-slider-nav {
        display: none !important;
    }

    .target-words-container {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important;
        gap: 20px !important;
        justify-content: center !important;
    }

    .target-words-container.words-count-1 {
        grid-template-columns: minmax(0, 420px) !important;
    }

    .target-words-container.words-count-2 {
        grid-template-columns: repeat(2, minmax(0, 380px)) !important;
    }

    .target-words-container.words-count-3 {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .target-words-container.words-count-4 {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    @media (max-width: 1100px) {
        .target-words-container.words-count-4 {
            grid-template-columns: repeat(2, 1fr) !important;
        }
    }

    .word-card {
        display: flex !important;
    }

    /* هێنانە تەنیشت بۆردی نووسین لە شاشەی کۆمپیوتەر */
    .trace-workspace {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 20px !important;
        width: 100% !important;
        margin-top: 6px !important;
    }

    .canvas-area-card {
        flex: 1 1 auto !important;
        width: auto !important;
        max-width: 660px !important;
        padding: 22px 24px !important;
        border-radius: 28px !important;
        box-shadow: 0 12px 36px rgba(41, 97, 112, 0.08) !important;
    }

    .canvas-container {
        max-width: 620px !important;
        height: 440px !important;
    }

    /* کەرەستەکان بچووکتر و شیکتر تا هەموو سەرنجەکە لەسەر پیتەکە بێت */
    .canvas-toolbar {
        flex: 0 0 215px !important;
        width: 215px !important;
        max-width: 215px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: center !important;
        gap: 10px !important;
        background: #FFFFFF !important;
        padding: 14px 12px !important;
        border-radius: 20px !important;
        border: 2px solid #E2E8F0 !important;
        box-shadow: 0 8px 24px rgba(41, 97, 112, 0.06) !important;
        margin-top: 0 !important;
        box-sizing: border-box !important;
    }

    .color-palette {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 8px !important;
        background: #F8FAFC !important;
        padding: 10px 8px !important;
        border-radius: 14px !important;
        border: 1.5px solid #E2E8F0 !important;
        border-bottom: 2.5px solid #CBD5E1 !important;
        box-shadow: none !important;
        box-sizing: border-box !important;
    }

    .toolbar-label {
        font-size: 12px !important;
        font-weight: 800 !important;
        color: #64748B !important;
        margin: 0 !important;
    }

    .palette-colors-wrap {
        display: grid !important;
        grid-template-columns: repeat(4, 26px) !important;
        gap: 7px !important;
        justify-content: center !important;
        align-items: center !important;
    }

    .color-dot,
    .custom-color-picker-wrapper,
    .custom-color-trigger {
        width: 26px !important;
        height: 26px !important;
    }

    .brush-size-control {
        width: 100% !important;
        max-width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
        background: #F8FAFC !important;
        padding: 10px 8px !important;
        border-radius: 14px !important;
        border: 1.5px solid #E2E8F0 !important;
        border-bottom: 2.5px solid #CBD5E1 !important;
        box-shadow: none !important;
        box-sizing: border-box !important;
    }

    .brush-size-header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
    }

    .brush-size-stepper-wrap {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 10px !important;
        width: 100% !important;
    }

    .brush-slider-wrap {
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        box-sizing: border-box !important;
        padding: 0 !important;
    }

    .brush-size-slider {
        width: 100% !important;
    }

    .btn-brush-pin {
        width: 100% !important;
        justify-content: center !important;
        box-sizing: border-box !important;
        padding: 6px 8px !important;
    }

    .tool-actions {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
    }

    .btn-tool-action {
        width: 100% !important;
        justify-content: center !important;
        padding: 9px 12px !important;
        font-size: 13px !important;
        border-radius: 12px !important;
    }

    .btn-next-form {
        width: 100% !important;
        justify-content: center !important;
        padding: 9px 12px !important;
        font-size: 13.5px !important;
        border-radius: 12px !important;
    }

    .tool-actions .btn-success {
        width: 100% !important;
        justify-content: center !important;
        padding: 9px 12px !important;
        font-size: 13.5px !important;
        border-radius: 12px !important;
    }
}
