/* ===== RESPONSIVE ADAPTATIONS ===== */
/* Только для основного контента, не трогаем хедер, футер и хлебные крошки */

/* ===== Планшеты и телефоны (до 1024px) ===== */
@media (max-width: 1024px) {
    /* Основной контейнер */
    .calculator-wrapper {
        padding: 16px 0 40px;
    }
    
    /* Заголовок */
    .calc-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
        margin-bottom: 20px;
    }
    
    .calc-header h1 {
        font-size: 1.5rem;
    }
    
    .calc-header p {
        font-size: 1rem;
    }
    
    .calc-icon {
        width: 52px;
        height: 52px;
    }
    
    .calc-icon svg {
        width: 26px;
        height: 26px;
    }
    
    /* ===== ИЗМЕНЕНИЕ ПОРЯДКА: Preview сверху, настройки снизу ===== */
    .calc-grid {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
    
    /* Форма (настройки) — теперь снизу */
    .calc-form {
        position: static !important;
        padding: 16px;
        border-radius: var(--radius);
        order: 2;
        width: 100%;
    }
    
    /* Результаты (preview) — теперь сверху */
    .calc-results {
        order: 1;
        gap: 12px;
        width: 100%;
    }
    
    /* ===== СКРЫВАЕМ Meme information и Quick tips на телефонах и планшетах ===== */
    .qr-info,
    .examples-container {
        display: none !important;
    }
    
    /* ===== Preview ===== */
    .qr-container {
        padding: 16px;
        min-height: 200px;
        border-radius: var(--radius);
        width: 100%;
    }
    
    .qr-container h4 {
        font-size: 0.85rem !important;
        margin-bottom: 10px !important;
    }
    
    .meme-preview {
        min-height: 180px;
        border-radius: 8px;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--bg);
    }
    
    .meme-preview canvas {
        max-height: 380px;
        border-radius: 8px;
        width: 100%;
        height: auto;
    }
    
    .preview-placeholder {
        padding: 32px 18px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--text-muted);
    }
    
    .preview-placeholder svg {
        width: 48px;
        height: 48px;
        margin-bottom: 10px;
    }
    
    .preview-placeholder span {
        font-size: 0.95rem;
    }
    
    /* ===== Форма (настройки) ===== */
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-group label {
        font-size: 0.9rem;
        font-weight: 600;
    }
    
    .form-group input[type="text"],
    .form-group select {
        padding: 10px 14px;
        font-size: 1rem;
        border-radius: 8px;
    }
    
    /* File Upload */
    .file-upload-area {
        padding: 16px 14px;
    }
    
    .file-upload-area .upload-icon svg {
        width: 30px;
        height: 30px;
    }
    
    .file-upload-area .upload-text {
        font-size: 0.9rem;
    }
    
    .file-upload-area .upload-hint {
        font-size: 0.8rem;
    }
    
    .file-name-badge {
        font-size: 0.8rem;
        padding: 4px 12px;
    }
    
    /* Settings Group */
    .settings-group {
        padding: 12px 14px;
        margin: 10px 0;
    }
    
    .settings-group h4 {
        font-size: 0.8rem;
        margin-bottom: 10px;
    }
    
    .settings-row {
        margin-bottom: 10px;
    }
    
    .settings-row label {
        font-size: 0.85rem;
    }
    
    .settings-row select {
        padding: 8px 12px;
        font-size: 0.95rem;
    }
    
    .settings-row input[type="range"] {
        height: 5px;
    }
    
    .settings-row input[type="range"]::-webkit-slider-thumb {
        width: 18px;
        height: 18px;
    }
    
    .settings-row.color-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .settings-row.color-row input[type="color"] {
        height: 38px;
    }
    
    .checkbox-label {
        font-size: 0.85rem;
    }
    
    /* Buttons */
    .calc-btn {
        padding: 12px;
        font-size: 1rem;
        border-radius: 10px;
    }
}

/* ===== Маленькие телефоны (до 480px) ===== */
@media (max-width: 480px) {
    .calculator-wrapper {
        padding: 12px 0 30px;
    }
    
    .calc-header h1 {
        font-size: 1.3rem;
    }
    
    .calc-header p {
        font-size: 0.9rem;
    }
    
    .calc-icon {
        width: 44px;
        height: 44px;
    }
    
    .calc-icon svg {
        width: 22px;
        height: 22px;
    }
    
    .calc-form {
        padding: 12px;
    }
    
    .qr-container {
        padding: 12px;
        min-height: 160px;
    }
    
    .meme-preview {
        min-height: 140px;
    }
    
    .meme-preview canvas {
        max-height: 260px;
    }
    
    .preview-placeholder {
        padding: 20px 12px;
    }
    
    .preview-placeholder svg {
        width: 36px;
        height: 36px;
    }
    
    .preview-placeholder span {
        font-size: 0.85rem;
    }
    
    .file-upload-area {
        padding: 12px 10px;
    }
    
    .file-upload-area .upload-text {
        font-size: 0.85rem;
    }
    
    .file-upload-area .upload-hint {
        font-size: 0.75rem;
    }
    
    .settings-group {
        padding: 10px 12px;
    }
    
    .settings-row label {
        font-size: 0.8rem;
    }
    
    .settings-row select {
        padding: 6px 10px;
        font-size: 0.9rem;
    }
    
    .settings-row input[type="range"] {
        height: 4px;
    }
    
    .settings-row input[type="range"]::-webkit-slider-thumb {
        width: 16px;
        height: 16px;
    }
    
    .settings-row.color-row {
        gap: 10px;
    }
    
    .settings-row.color-row input[type="color"] {
        height: 34px;
    }
    
    .calc-btn {
        padding: 10px;
        font-size: 0.9rem;
    }
    
    .form-group label {
        font-size: 0.85rem;
    }
    
    .form-group input[type="text"] {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}

/* ===== Ландшафтная ориентация на телефонах ===== */
@media (max-width: 768px) and (orientation: landscape) {
    .calc-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .calc-form {
        order: 1;
        padding: 12px;
    }
    
    .calc-results {
        order: 2;
    }
    
    .qr-container {
        min-height: 160px;
        padding: 12px;
    }
    
    .meme-preview canvas {
        max-height: 200px;
    }
    
    .calc-header h1 {
        font-size: 1.1rem;
    }
    
    .calc-header p {
        font-size: 0.85rem;
    }
    
    .settings-group {
        padding: 8px 10px;
        margin: 8px 0;
    }
    
    .settings-row {
        margin-bottom: 6px;
    }
    
    .form-group {
        margin-bottom: 8px;
    }
    
    .file-upload-area {
        padding: 10px 10px;
    }
    
    .calc-btn {
        padding: 8px;
        font-size: 0.85rem;
    }
}

/* ===== Планшеты в портретной ориентации (769-1024px) ===== */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: portrait) {
    .calc-grid {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }
    
    .calc-form {
        position: static !important;
        order: 2;
        width: 100%;
        padding: 20px;
    }
    
    .calc-results {
        order: 1;
        width: 100%;
    }
    
    .qr-container {
        min-height: 280px;
        padding: 20px;
    }
    
    .meme-preview canvas {
        max-height: 400px;
    }
}

/* ===== Планшеты в ландшафтной ориентации (769-1024px) ===== */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) {
    .calc-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
    
    .calc-form {
        position: static !important;
        order: 1;
        padding: 18px;
    }
    
    .calc-results {
        order: 2;
    }
    
    .qr-container {
        min-height: 260px;
        padding: 18px;
    }
    
    .meme-preview canvas {
        max-height: 340px;
    }
}

/* ===== Улучшения для скролла на телефонах ===== */
@media (max-width: 768px) {
    html {
        scroll-behavior: smooth;
    }
    
    .calc-form {
        position: static !important;
        top: auto !important;
    }
}