/* styles-mobile.css - Мобільні стилі для головної сторінки WebP конвертера */

/* =================================================================== */
/* ПЛАНШЕТИ */
/* =================================================================== */

@media (min-width: 481px) and (max-width: 768px) {
    .add-image-btn {
        min-width: 100px;
        height: 100px;
    }
    
    .add-btn-text {
        font-size: 11px;
        max-width: 80px;
    }
    
    .carousel-item img {
        background-size: 6px 6px;
        background-position: 0 0, 0 3px, 3px -3px, -3px 0px;
    }
}

/* =================================================================== */
/* МОБІЛЬНІ ПРИСТРОЇ */
/* =================================================================== */

@media (max-width: 768px) {
    /* ПРИХОВУЄМО ERASER TOOL КНОПКУ НА МОБІЛЬНИХ */
    #eraserToolBtn {
        display: none !important;
    }
    
    /* ЗАГОЛОВОК - ДОЗВОЛЯЄМО ПЕРЕНОС СЛІВ */
    h1 {
        font-size: 1.4em !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        margin-bottom: 20px !important;
        padding: 0 10px;
        line-height: 1.3;
    }
    
    .container {
        padding: 15px !important;
    }
    
    .section-title {
        margin: 20px 0 15px 0 !important;
        font-size: 1.4em !important;
    }
    
    .controls-section {
        text-align: center;
        padding: 20px 15px;
    }
    
    .workspace {
        min-height: 300px;
        border-radius: 0;
    }
    
    .workspace.has-image {
        border-radius: 0;
        padding: 0;
    }
    
    .canvas-container {
        width: 100%;
        max-width: 100%;
        overflow: visible;
        margin: 0;
        padding: 0;
    }
    
    #canvas {
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: none;
        margin: 0;
        padding: 0;
        display: block;
    }
    
    /* ✅ ХОВАЄМО ТІЛЬКИ PREVIEW ЗОБРАЖЕННЯ НА МОБІЛЬНИХ */
    .preview-image-container {
        display: none !important;
    }
    
    /* ✅ ХОВАЄМО ТІЛЬКИ ЕЛЕМЕНТИ PREVIEW ЗОБРАЖЕНЬ */
    .preview-image-container img,
    .preview-image-container canvas,
    .preview-image-container .before-after-slider,
    .preview-image-container .preview-image,
    .preview-image-container .original-image,
    .preview-image-container .webp-image,
    .preview-image-container .rendering-indicator,
    .preview-image-container .preview-placeholder {
        display: none !important;
    }
    
    /* ✅ ПОКАЗУЄМО webp-preview-section і preview-container ДЛЯ КНОПОК */
    .webp-preview-section {
        display: block !important;
    }
    
    .preview-container {
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* ✅ ПОКАЗУЄМО КНОПКИ ЗАВАНТАЖЕННЯ */
    .action-buttons {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
        margin-top: 20px !important;
    }
    
    .webp-preview-section h3 {
        display: none;
    }
    
    .controls-row {
        flex-direction: column;
        gap: 20px;
        align-items: center;
        justify-content: center;
    }
    
    .control-group {
        width: 100%;
        max-width: 350px;
        margin: 0 auto;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .section-title {
        text-align: center;
        font-size: 1.6em;
    }
    
    .carousel-title {
        text-align: center;
        width: 100%;
    }

    .upload-area {
        padding: 40px 15px;
    }

    /* ПРИХОВУЄМО ІКОНКУ ЩИТА НА МОБІЛЬНИХ */
    img[src="/img/shield.svg"] {
        display: none !important;
    }
    
    /* Альтернативний селектор */
    p[style*="display: flex"][style*="align-items: center"] img[src="/img/shield.svg"] {
        display: none !important;
    }

    /* МОБІЛЬНЕ CROP МЕНЮ */
    .crop-inline-controls {
        flex-direction: column;
        gap: 20px;
        padding: 20px 15px;
        text-align: center;
        align-items: center;
    }
    
    .crop-toggle-container {
        justify-content: center;
        align-self: center;
        margin-bottom: 15px;
        width: 100%;
    }
    
    .custom-dimensions {
        width: 100%;
        display: flex;
        justify-content: center;
    }
    
    .dimension-inputs {
        flex-direction: row;
        gap: 20px;
        align-items: flex-end;
        justify-content: center;
        width: 100%;
        max-width: 320px;
    }
    
    .dimension-field {
        align-items: center;
        text-align: center;
        flex: 1;
        min-width: 0;
    }
    
    .dimension-field label {
        margin-bottom: 8px;
        font-size: 0.9em;
        font-weight: 600;
        display: block;
    }
    
    .dimension-field input {
        width: 100%;
        max-width: 140px;
        padding: 12px 10px;
        font-size: 1em;
        text-align: center;
        border-radius: 8px;
    }
    
    .aspect-ratios-inline {
        justify-content: center;
        width: 100%;
        max-width: 280px;
        margin: 0 auto;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .aspect-btn {
        flex: 0 0 calc(33.33% - 6px);
        min-width: 70px;
        max-width: 90px;
        padding: 12px 8px;
        font-size: 0.9em;
        text-align: center;
        margin-bottom: 8px;
    }
    
    .btn-crop {
        margin: 20px auto;
        width: 200px;
        padding: 15px 20px;
        font-size: 1.1em;
    }

    .preview-container {
        flex-direction: column;
    }

    .preview-info {
        flex: none;
    }

    .download-info {
        width: 100%;
        max-width: 400px;
    }
    
    /* МОБІЛЬНА КАРУСЕЛЬ ФОТО - МАКСИМУМ 10 ФОТО 2 В РЯДУ */
    .carousel-container {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-auto-rows: 125px !important;
        gap: 15px !important;
        overflow: visible !important;
        padding: 15px 5px !important;
        justify-items: center !important;
        max-width: 380px !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
        min-height: auto !important;
        max-height: none !important;
        overflow-y: visible !important;
    }
    
    /* ПРИХОВУЄМО ФОТО ПІСЛЯ 10-го НА МОБІЛЬНИХ */
    .carousel-item:nth-child(n+11) {
        display: none !important;
    }
    
    .carousel-item {
        width: 125px !important;
        height: 125px !important;
        min-width: auto !important;
        border-radius: 8px;
        overflow: visible;
        cursor: pointer;
        transition: all 0.3s ease;
        border: 2px solid transparent;
        position: relative;
        box-sizing: border-box;
    }
    
    .carousel-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 6px;
        display: block;
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        background-size: 6px 6px;
        background-position: 0 0, 0 3px, 3px -3px, -3px 0px;
    }
    
    /* КНОПКА ДОДАТИ - НА ВСЮ ШИРИНУ ВНИЗУ */
    .add-image-btn {
        width: 100% !important;
        height: 80px !important;
        min-width: auto !important;
        grid-column: 1 / -1 !important;
        order: 999 !important;
        border: 2px dashed #667eea;
        border-radius: 8px;
        background: #f8f9ff;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.3s ease;
        color: #667eea;
        font-weight: bold;
        margin: 10px 0 0 0;
        box-sizing: border-box;
        gap: 5px;
    }
    
    /* ПРИХОВУЄМО КНОПКУ ДОДАТИ ЯКЩО УЖЕ 10 ФОТО */
    .carousel-container:has(.carousel-item:nth-child(10)) .add-image-btn {
        display: none !important;
    }
    
    .add-btn-icon {
        font-size: 28px;
        font-weight: 300;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s ease;
        color: #667eea;
        line-height: 1;
        font-family: Arial, sans-serif;
        flex-shrink: 0;
        margin-top: 0;
    }
    
    .add-btn-text {
        font-size: 11px;
        font-weight: 600;
        text-align: center;
        line-height: 1;
        color: #667eea;
        transition: all 0.3s ease;
        word-wrap: normal;
        hyphens: none;
        max-width: none;
        padding: 0;
    }
    
    .add-image-btn:hover .add-btn-icon {
        color: #2E7D32;
        transform: scale(1.1);
    }
    
    .add-image-btn:hover .add-btn-text {
        color: #2E7D32;
    }
    
    .carousel-item .delete-btn {
        width: 18px;
        height: 18px;
        font-size: 11px;
        top: -4px;
        right: -4px;
    }
    
    /* ПОВІДОМЛЕННЯ ПРО ЛІМІТ НА МОБІЛЬНИХ */
    .carousel-container::after {
        content: "";
        display: none;
    }
    
    /* Показуємо повідомлення коли досягнуто 10 фото */
    .carousel-container:has(.carousel-item:nth-child(10))::after {
        content: "Mobile limit: 10 photos max";
        display: block;
        grid-column: 1 / -1;
        text-align: center;
        color: #666;
        font-size: 12px;
        font-style: italic;
        margin-top: 10px;
        padding: 8px;
        background: #f8f9fa;
        border-radius: 6px;
        border: 1px solid #dee2e6;
        order: 1000;
    }
    
    /* МОБІЛЬНА ВЕРСІЯ CROP MESSAGE */
    .crop-tool-message {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: calc(100% - 40px);
        max-width: none;
        margin: 0 20px;
        padding: 25px 20px;
        text-align: center;
        background: white;
        border-radius: 12px;
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
        border: 2px solid #2E7D32;
        z-index: 30;
    }

    /* ПРИХОВАНА КАРУСЕЛЬ ПОРІВНЯННЯ НА МОБІЛЬНИХ */
    .before-after-slider {
        display: none !important;
    }
}

/* =================================================================== */
/* АДАПТИВНІ СТИЛІ ФУТЕРА ДЛЯ МОБІЛЬНИХ ПРИСТРОЇВ */
/* =================================================================== */

/* ПЛАНШЕТИ: зменшуємо відступи */
@media (max-width: 1024px) {
    .footer-nav {
        gap: 20px;
    }
    
    .footer-link:not(:last-child)::before {
        right: -12px;
    }
}

/* МОБІЛЬНІ: стовпчик замість лінії */
@media (max-width: 768px) {
    .footer {
        padding: 30px 0;
    }
    
    .footer-content {
        gap: 25px;
    }
    
    .footer-text {
        font-size: 0.85em;
        line-height: 1.4;
        padding: 0 10px;
    }
    
    /* СТОВПЧИК НА МОБІЛЬНИХ */
    .footer-nav {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
    
    .footer-link {
        font-size: 0.9em;
        padding: 8px 15px;
        border-radius: 6px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        transition: all 0.3s ease;
        min-width: 140px;
        text-align: center;
    }
    
    .footer-link:hover {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.2);
        transform: translateY(-2px);
    }
    
    /* ПРИХОВУЄМО РОЗДІЛЮВАЧІ НА МОБІЛЬНИХ */
    .footer-link:not(:last-child)::before {
        display: none;
    }
    
    /* ЗМІНЮЄМО UNDERLINE НА МОБІЛЬНИХ */
    .footer-link::after {
        display: none;
    }
}

/* =================================================================== */
/* ДУЖЕ МАЛЕНЬКІ ЕКРАНИ */
/* =================================================================== */

@media (max-width: 480px) {
    h1 {
        font-size: 1.2em !important;
        margin-bottom: 15px !important;
        padding: 0 5px;
        /* Продовжуємо дозволяти перенос слів і на малих екранах */
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }
    
    .footer {
        padding: 25px 0;
    }
    
    .footer-content {
        gap: 20px;
    }
    
    .footer-text {
        font-size: 0.8em;
        padding: 0 15px;
    }
    
    .footer-nav {
        gap: 12px;
        width: 100%;
        padding: 0 15px;
    }
    
    .footer-link {
        font-size: 0.85em;
        padding: 10px 12px;
        min-width: 130px;
    }
    
    .dimension-inputs {
        gap: 15px;
        max-width: 280px;
    }
    
    .dimension-field input {
        max-width: 120px;
        padding: 10px 8px;
        font-size: 0.95em;
    }
    
    .dimension-field label {
        font-size: 0.85em;
        margin-bottom: 6px;
    }
    
    .aspect-btn {
        min-width: 65px;
        padding: 10px 6px;
        font-size: 0.85em;
    }
    
    .aspect-ratios-inline {
        max-width: 260px;
        gap: 6px;
    }
    
    .btn-crop {
        width: 180px;
        padding: 12px 16px;
        font-size: 1em;
    }
    
    .carousel-container {
        max-width: 340px !important;
        gap: 12px !important;
        padding: 12px 5px !important;
        grid-auto-rows: 110px !important;
        min-height: auto !important;
        max-height: none !important;
    }
    
    .carousel-item {
        width: 110px !important;
        height: 110px !important;
    }
    
    .add-image-btn {
        height: 70px !important;
        gap: 8px;
    }
    
    .add-btn-icon {
        font-size: 22px;
        width: 26px;
        height: 26px;
    }
    
    .add-btn-text {
        font-size: 13px;
    }
    
    .carousel-item .delete-btn {
        width: 16px;
        height: 16px;
        font-size: 10px;
    }
    
    .crop-tool-message {
        padding: 20px 15px;
        margin: 0 15px;
        width: calc(100% - 30px);
    }
    
    .crop-message-title {
        font-size: 1.1em;
    }
    
    .crop-message-text {
        font-size: 0.9em;
    }
}