/**
 * WPP Designer Responsive Styles
 */

/* Tablet */
@media (max-width: 992px) {
    :root {
        --wpp-sidebar-width: 280px;
    }

    .wpp-product-name {
        font-size: 16px;
    }

    .wpp-price {
        font-size: 18px;
    }

    .wpp-canvas-container {
        padding: 15px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    :root {
        --wpp-header-height: 56px;
        --wpp-footer-height: 80px;
    }

    .wpp-main {
        flex-direction: column;
    }

    /* Header mobile */
    .wpp-header {
        padding: 0 16px;
    }

    .wpp-header-left {
        flex: 0;
    }

    .wpp-back-btn span {
        display: none;
    }

    .wpp-product-name {
        font-size: 14px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Sidebar as bottom sheet */
    .wpp-sidebar {
        position: fixed;
        bottom: var(--wpp-footer-height);
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        max-height: 55vh;
        border-right: none;
        border-top: 1px solid var(--wpp-gray-300);
        border-radius: 20px 20px 0 0;
        z-index: 100;
        transform: translateY(calc(100% - 56px));
        transition: transform 0.3s ease;
    }

    .wpp-sidebar.expanded {
        transform: translateY(0);
    }

    .wpp-sidebar-handle {
        display: block;
        width: 40px;
        height: 5px;
        background: var(--wpp-gray-300);
        border-radius: 3px;
        margin: 10px auto;
        cursor: pointer;
    }

    .wpp-tabs {
        padding: 0 10px;
    }

    .wpp-tab {
        padding: 12px;
        font-size: 13px;
    }

    .wpp-tab-content {
        padding: 15px;
    }

    .wpp-uploaded-images {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }

    .wpp-upload-area {
        padding: 20px 15px;
    }

    .wpp-upload-icon {
        font-size: 36px;
    }

    .wpp-instructions {
        display: none;
    }

    /* Canvas area */
    .wpp-canvas-container {
        flex: 1;
        padding: 10px;
        padding-bottom: 70px;
    }

    .wpp-canvas-controls {
        flex-wrap: wrap;
        gap: 8px;
    }

    .wpp-control-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    #wpp-zoom-level {
        font-size: 12px;
        min-width: 40px;
    }

    .wpp-canvas-wrapper {
        border-radius: 4px;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: auto;
        padding: 10px;
    }

    /* Footer mobile */
    .wpp-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 99;
        padding: 12px 16px;
        flex-direction: column;
        gap: 10px;
        height: auto;
    }

    .wpp-footer-left {
        display: none;
    }

    .wpp-footer-right {
        width: 100%;
        justify-content: space-between;
    }

    .wpp-price-display {
        gap: 4px;
    }

    .wpp-price-label {
        font-size: 12px;
    }

    .wpp-price-amount {
        font-size: 18px;
    }

    .wpp-btn-large {
        padding: 14px 24px;
        font-size: 15px;
    }

    /* Modal mobile */
    .wpp-modal-content {
        margin: 0 16px;
        padding: 24px;
    }

    .wpp-modal-icon {
        font-size: 40px;
    }

    .wpp-modal-content h3 {
        font-size: 18px;
    }
}

/* Small mobile */
@media (max-width: 375px) {
    .wpp-uploaded-images {
        grid-template-columns: repeat(3, 1fr);
    }

    .wpp-price-amount {
        font-size: 16px;
    }

    .wpp-btn-large {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* Touch device optimizations */
@media (hover: none) {
    .wpp-control-btn:active {
        transform: scale(0.95);
    }

    .wpp-image-thumb .wpp-remove-image {
        display: block;
    }

    .wpp-btn-primary:active {
        transform: translateY(0);
    }

    /* Larger tap targets on mobile */
    .wpp-image-thumb {
        min-height: 60px;
        min-width: 60px;
    }

    #wpp-upload-area {
        min-height: 100px;
    }

    .wpp-tab {
        min-height: 44px;
    }
}

/* Touch action properties to prevent browser interference */
.wpp-canvas-wrapper {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.wpp-editable-text {
    touch-action: manipulation;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

#wpp-upload-area,
#wpp-browse-files,
.wpp-image-thumb,
.wpp-open-designer,
#wpp-add-to-cart {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* Ensure file input is accessible but invisible */
#wpp-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Landscape mode on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    :root {
        --wpp-header-height: 48px;
        --wpp-footer-height: 60px;
    }

    .wpp-sidebar {
        max-height: 70vh;
    }

    .wpp-product-name {
        font-size: 13px;
    }
}

/* Print styles - hide interactive elements */
@media print {

    .wpp-header,
    .wpp-sidebar,
    .wpp-footer,
    .wpp-canvas-controls {
        display: none !important;
    }

    .wpp-canvas-container {
        padding: 0;
    }

    .wpp-canvas-wrapper {
        box-shadow: none;
    }
}