@import url('https://fonts.cdnfonts.com/css/google-sans');

/* Dynamic Art Collage CSS */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #ffffff;
    font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
    font-size: 11px;
    color: #111111;
    -webkit-font-smoothing: antialiased;
}

/* The main canvas with 3D perspective */
#artboard {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    perspective: 1200px;
    perspective-origin: 50% 50%;
    transform-style: preserve-3d;
    overflow: hidden;
    background-color: #ffffff;
}

.collage-item {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-style: preserve-3d;
    pointer-events: none; /* Let clicks pass through to artboard double-click */
    will-change: transform;
}

.collage-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background-color: #f7f7f7;
    /* Clean, raw appearance: no heavy shadows, no borders */
}

/* Startup instructions hint in the center */
#intro-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #888888;
    font-size: 12px;
    font-family: 'Google Sans', sans-serif;
    line-height: 1.6;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
    z-index: 1000;
}

#intro-hint.fade-out {
    opacity: 0;
    transform: translate(-50%, -45%);
}

#intro-hint .mobile-hint {
    font-size: 11px;
    color: #bbbbbb;
    display: block;
    margin-top: 4px;
}

/* Settings panel - modernized, clean horizontal UI on desktop */
#settings-panel {
    position: fixed;
    bottom: 24px;
    left: 50%;
    width: max-content;
    max-width: 95vw;
    background-color: rgba(255, 255, 255, 0.481);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.04);
    border-radius: 16px;
    padding: 10px 20px;
    z-index: 10000;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap; /* wraps items instead of overflowing */
    justify-content: center;
    align-items: center;
    gap: 16px;
    font-family: 'Google Sans', sans-serif;
    font-size: 11px;
    color: #222222;
    transition: opacity 0.2s ease, transform 0.2s ease;
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
    pointer-events: all;
}

#settings-panel.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(10px) scale(0.98);
    pointer-events: none;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.parameters-group {
    flex-direction: row !important;
    gap: 14px;
}

.parameter-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Thin vertical separator lines between settings columns on desktop */
.settings-section:not(:last-child) {
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    padding-right: 14px;
}

.settings-section.actions,
.settings-section.footer {
    border-right: none !important;
    padding-right: 0 !important;
}

.settings-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #444444;
    text-transform: uppercase;
}

label,
.settings-label {
    font-weight: 500;
    color: #444444;
}

.upload-btn {
    display: inline-block;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    padding: 6px 10px;
    color: #222222;
    transition: all 0.2s ease;
    width: 110px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

.upload-btn:hover {
    background-color: rgba(255, 255, 255, 0.85);
    border-color: rgba(0, 0, 0, 0.15);
}

/* Modern inputs */
select, 
input[type="file"],
button {
    font-family: inherit;
    font-size: inherit;
    color: #222222;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    padding: 6px 10px;
    outline: none;
    transition: all 0.2s ease;
}

select {
    width: 170px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23444' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px;
    padding-right: 30px;
}

select:hover, select:focus {
    border-color: rgba(0, 0, 0, 0.15);
    background-color: rgba(255, 255, 255, 0.85);
}

input[type="file"] {
    width: 120px;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 10px;
}

button {
    width: auto;
    cursor: pointer;
    font-weight: 600;
}

#control-clear {
    background-color: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(0, 0, 0, 0.06);
    color: #666666;
}

#control-clear:hover {
    background-color: rgba(255, 240, 240, 0.7);
    border-color: rgba(255, 0, 0, 0.15);
    color: #cc0000;
}

#control-reset {
    background-color: rgba(17, 17, 17, 0.9);
    border: 1px solid rgba(17, 17, 17, 0.9);
    color: #ffffff;
}

#control-reset:hover {
    background-color: rgba(17, 17, 17, 1.0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Custom range inputs */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: #eaeaea;
    border: none;
    border-radius: 2px;
    padding: 0;
    outline: none;
    width: 70px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #111111;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #111111;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 0.1s ease;
}

input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.15);
}

.url-input-group {
    display: flex;
    gap: 8px;
    width: 180px;
}

.url-input-group input {
    flex: 1;
    font-family: inherit;
    font-size: inherit;
    color: #222222;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    padding: 6px 8px;
    outline: none;
    transition: all 0.2s ease;
    min-width: 0;
}

.url-input-group input:hover,
.url-input-group input:focus {
    border-color: rgba(0, 0, 0, 0.15);
    background-color: rgba(255, 255, 255, 0.85);
}

.url-input-group button {
    width: auto;
    white-space: nowrap;
    padding: 6px 10px;
}

/* Custom styled select box (glassmorphism dropdown) */
.custom-select {
    position: relative;
    width: 170px;
    font-family: inherit;
    font-size: inherit;
}

.custom-select-trigger {
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    padding: 6px 10px;
    padding-right: 30px;
    cursor: pointer;
    font-weight: 600;
    color: #222222;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23444' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px;
}

.custom-select-trigger:hover {
    border-color: rgba(0, 0, 0, 0.15);
    background-color: rgba(255, 255, 255, 0.85);
}

.custom-select-options {
    position: absolute;
    bottom: calc(100% + 8px); /* Open upwards so it's not cut off by screen boundaries */
    left: 0;
    width: 180px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    transform: translate3d(0, 0, 0); /* Forces GPU compositing layer to fix nested browser backdrop-filter bugs */
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.08);
    z-index: 10005;
    display: none;
    flex-direction: column;
    padding: 4px;
    max-height: 220px;
    overflow-y: auto;
}

/* Custom scrollbar styling inside options list */
.custom-select-options::-webkit-scrollbar {
    width: 4px;
}
.custom-select-options::-webkit-scrollbar-track {
    background: transparent;
}
.custom-select-options::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 2px;
}

.custom-select.open .custom-select-options {
    display: flex;
}

.custom-option {
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    color: #444444;
    transition: all 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

.custom-option:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #111111;
}

.custom-option.selected {
    background: rgba(17, 17, 17, 0.08);
    color: #111111;
    font-weight: 600;
}

.actions {
    flex-direction: row;
    gap: 8px;
    margin-top: 0;
}

.actions button {
    flex: 1;
    white-space: nowrap;
}

.footer {
    border-top: none;
    padding-top: 0;
    color: #888888;
    line-height: 1.5;
    font-size: 11px;
}

.footer p:not(.credit) {
    display: none; /* Hide instructions on desktop toolbar */
}

.credit {
    margin-top: 8px;
    color: #aaaaaa;
    font-size: 10px;
}

/* Drag-and-drop indicator overlay */
#drop-hint {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    border: 2px dashed #111111;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

body.drag-over #drop-hint {
    opacity: 1;
}

/* Mobile responsive bottom sheet layout for settings panel */
@media (max-width: 480px) {
    #settings-panel {
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: auto;
        max-width: calc(100% - 24px);
        border-radius: 16px;
        border: 1px solid rgba(0, 0, 0, 0.06);
        margin: 0;
        padding: 12px 14px;
        gap: 6px;
        font-size: 11px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
        flex-direction: column;
        align-items: stretch;
        transform: scale(1);
    }
    
    #settings-panel .settings-section {
        gap: 3px;
        border-right: none !important;
        padding-right: 0 !important;
    }
    
    #settings-panel .parameters-group {
        flex-direction: column !important;
        gap: 6px;
    }
    
    #settings-panel select,
    #settings-panel .custom-select,
    #settings-panel .upload-btn,
    #settings-panel input[type="range"],
    #settings-panel .url-input-group {
        width: 100% !important;
    }
    
    #settings-panel .custom-select-options {
        width: 100% !important;
        box-sizing: border-box;
    }
    
    #settings-panel .settings-title {
        padding-bottom: 2px;
    }
    
    #settings-panel select,
    #settings-panel .custom-select-trigger,
    #settings-panel .upload-btn,
    #settings-panel input[type="url"],
    #settings-panel button {
        padding: 5px 8px;
        font-size: 11px;
    }
    
    #settings-panel .footer p:not(.credit) {
        display: none;
    }
    
    #settings-panel .footer {
        padding-top: 4px;
        margin-top: 2px;
    }
    
    #settings-panel .credit {
        margin-top: 0;
    }
    
    #settings-panel.hidden {
        opacity: 0;
        transform: translateY(15px) scale(0.98);
    }
}

/* Shape Overlay path outline styling */
#shape-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* Fullscreen Drawing overlay for custom shape */
#drawing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 20000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 30px;
    box-sizing: border-box;
}

.drawing-instruction {
    font-family: 'Google Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #111111;
    text-align: center;
    margin-top: 10px;
    user-select: none;
    pointer-events: none;
    z-index: 20002;
}

#drawing-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    z-index: 20001;
}

#cancel-drawing-btn {
    position: relative;
    z-index: 20005;
    background: #111111;
    color: #ffffff;
    border: 1px solid #111111;
    padding: 8px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
#cancel-drawing-btn:hover {
    background: #333333;
    border-color: #333333;
}

