/* =========================================================
   MUSIKMINNE CREATOR
   ========================================================= */

.musikminne-app {
    display: flex;
    gap: 40px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ---- Controls panel ---- */
.mm-controls {
    flex: 0 0 400px;
    max-width: 400px;
}

.mm-page-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 6px;
    color: #111;
}

.mm-page-desc {
    font-size: 14px;
    color: #666;
    margin: 0 0 28px;
}

.mm-section {
    margin-bottom: 24px;
}

.mm-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ---- Inputs ---- */
.mm-input,
.mm-textarea {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-size: 15px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    background: #fff;
    color: #111;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.mm-input:focus,
.mm-textarea:focus {
    border-color: #333;
}

.mm-input-mt {
    margin-top: 8px;
}

.mm-hint {
    display: block;
    font-size: 12px;
    color: #888;
    margin-top: 6px;
}

/* ---- Image upload ---- */
.mm-upload-area {
    border: 2px dashed #d0d0d0;
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
    min-height: 180px;
}

.mm-upload-area:hover,
.mm-upload-area.drag-over {
    border-color: #666;
    background: #fafafa;
}

.mm-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    color: #888;
    font-size: 14px;
}

.mm-upload-preview {
    max-height: 400px;
    overflow: hidden;
}

.mm-upload-preview img {
    display: block;
    width: 100%;
    max-height: 400px;
    object-fit: contain;
}

.mm-crop-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.mm-btn-sm {
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.mm-btn-confirm {
    background: #111;
    color: #fff;
}

.mm-btn-confirm:hover {
    background: #333;
}

.mm-btn-cancel {
    background: #e8e8e8;
    color: #333;
}

.mm-btn-cancel:hover {
    background: #ddd;
}

/* ---- Filters ---- */
.mm-filter-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.mm-filter-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: none;
    cursor: pointer;
    transition: border-color 0.2s;
    width: 70px;
}

.mm-filter-btn:hover {
    border-color: #ccc;
}

.mm-filter-btn.active {
    border-color: #111;
}

.mm-filter-thumb {
    width: 56px;
    height: 56px;
    border-radius: 4px;
    object-fit: cover;
}

.mm-filter-name {
    font-size: 10px;
    color: #555;
    text-align: center;
    line-height: 1.2;
}

.mm-filter-btn.active .mm-filter-name {
    color: #111;
    font-weight: 600;
}

/* ---- Search ---- */
.mm-search-wrap {
    position: relative;
}

.mm-search-results {
    position: absolute;
    z-index: 100;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 360px;
    overflow-y: scroll;
    background: #fff;
    border: 1px solid #d0d0d0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.mm-search-results::-webkit-scrollbar {
    width: 6px;
}

.mm-search-results::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.mm-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.mm-result-item:hover,
.mm-result-item.active {
    background: #f5f5f5;
}

.mm-result-item img {
    width: 44px;
    height: 44px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.mm-result-item div {
    min-width: 0;
}

.mm-result-item strong {
    display: block;
    font-size: 14px;
    color: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mm-result-item span {
    display: block;
    font-size: 12px;
    color: #888;
}

.mm-no-res {
    padding: 14px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

/* ---- Waveform loading ---- */
.mm-waveform-status {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

.mm-waveform-status.loading {
    animation: mm-pulse 1.2s ease-in-out infinite;
}

@keyframes mm-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ---- Colors ---- */
.mm-color-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.mm-color-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #ccc;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, transform 0.15s;
    padding: 0;
}

.mm-color-btn:hover {
    transform: scale(1.1);
}

.mm-color-btn.active {
    border-color: #333;
    border-width: 3px;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.1);
}

.mm-color-dot {
    display: block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* ---- Sizes Dropdown ---- */
.mm-size-grid {
    position: relative;
}

.mm-size-dropdown {
    position: relative;
    width: 100%;
}

.mm-size-selected {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 12px 16px;
    font-size: 14px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    background: #fff;
    color: #333;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    user-select: none;
}

.mm-size-selected:hover { border-color: #999; }

.mm-size-dropdown.open .mm-size-selected {
    border-color: #999;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.mm-dropdown-arrow {
    margin-left: 8px;
    font-size: 10px;
    color: #666;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.mm-size-dropdown.open .mm-dropdown-arrow {
    transform: rotate(180deg);
}

.mm-size-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 100;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.mm-size-dropdown.open .mm-size-options {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #999;
    border-top: none;
}

.mm-size-option {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #f0f0f0;
}

.mm-size-option:last-child { border-bottom: none; }
.mm-size-option:hover { background: #f5f5f5; }
.mm-size-option.active { background: #f0f0f0; }

.mm-size-label {
    font-weight: 600;
    white-space: nowrap;
    color: #111;
    flex-shrink: 0;
}

.mm-size-price {
    font-size: 13px;
    color: #666;
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ---- Price & Cart ---- */
.mm-cart-section {
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.mm-price-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 18px;
}

#mm-price-label {
    font-weight: 600;
    color: #333;
}

#mm-price-value {
    font-weight: 700;
    color: #111;
}

.mm-btn {
    display: block;
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.mm-btn-cart {
    background: #111;
    color: #fff;
    margin-bottom: 10px;
}

.mm-btn-cart:hover {
    background: #333;
}

.mm-btn-cart:disabled {
    background: #999;
    cursor: not-allowed;
}

.mm-btn-download {
    background: #fff;
    color: #333;
    border: 1px solid #d0d0d0;
}

.mm-btn-download:hover {
    background: #f5f5f5;
}

.mm-btn-download:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---- Preview ---- */
.mm-preview-wrap {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: sticky;
    top: 100px;
}

.mm-preview {
    width: 100%;
    max-width: 580px;
    aspect-ratio: 5 / 7;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.08);
    border-radius: 4px;
    overflow: hidden;
}

.mm-preview svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* ---- Cropper.js overrides ---- */
.cropper-view-box,
.cropper-face {
    border-radius: 0;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .musikminne-app {
        flex-direction: column;
        padding: 20px 16px;
        gap: 24px;
    }

    .mm-controls {
        flex: none;
        max-width: 100%;
    }

    .mm-preview-wrap {
        position: static;
        order: -1;
    }

    .mm-preview {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .mm-page-title {
        font-size: 20px;
    }

.mm-filter-btn {
        width: 60px;
    }

    .mm-filter-thumb {
        width: 48px;
        height: 48px;
    }
}
