/* Widget Configurator - Widget Preview Styles (Golden Master) */

/* ===== WIDGET CONTAINER ===== */
#image-link-wrapper {
    width: 85%;
    max-width: 400px;
    /* Default max-width */
    display: block;
    cursor: default;
    position: relative;
    font-family: 'Inter', sans-serif;
    box-sizing: border-box;
    /* Overflow Protection */
}

#image-link-wrapper * {
    box-sizing: border-box;
}

/* Safety for all children */

#image-link-wrapper.mobile-mode {
    width: 90%;
    max-width: 380px;
    margin: 1rem auto;
}

@media (max-width: 768px) {
    #image-link-wrapper {
        width: 95vw;
        max-width: 400px;
        margin: 0 auto;
    }
}

/* ===== IMAGE CONTAINER ===== */
#image-container {
    padding-top: 100%;
    position: relative;
    background-size: cover;
    background-position: center;
    border-radius: var(--border-radius, 0.75rem);
    box-shadow: var(--box-shadow, 0 4px 12px 0 rgba(0, 0, 0, 0.2));
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out,
        background-image 0.5s ease, padding-top 0.4s ease, height 0.4s ease, border-radius 0.2s ease;
    background-image: var(--bg-default);
    z-index: 0;
    overflow: hidden;
}

#image-container.expanded-container {
    padding-top: 1.5rem;
    height: auto;
    min-height: 400px;
    padding-bottom: 2rem;
}

/* Background overlays */
#image-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-image: var(--bg-active);
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 1;
    pointer-events: none;
    border-radius: inherit;
}

#image-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay-bg, rgba(0, 0, 0, 0.8));
    opacity: 0;
    border-radius: inherit;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 10;
}

/* ===== OVERLAY CONTENT ===== */
#overlay-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1.5rem;
    /* FIXED PADDING */
    display: flex;
    flex-direction: column;
    z-index: 20;
    pointer-events: none;
}

#image-container.expanded-container #overlay-content {
    position: relative;
    height: auto;
}

/* Sections visibility */
#project-id,
#project-description-container,
#bottom-container {
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

#project-id {
    color: white;
    font-weight: 800;
    font-size: 1.125rem;
    text-align: left;
    margin-bottom: 1rem;
}

#project-description-container {
    width: 100%;
    margin-top: 0;
    padding-right: 0;
    padding-bottom: 3.5rem;
}

#project-description {
    color: white;
    font-size: 1rem;
    line-height: 1.5;
    text-align: left;
    display: -webkit-box;
    -webkit-line-clamp: var(--max-lines, 5);
    line-clamp: var(--max-lines, 5);
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: pre-line;
    font-weight: 400;
}

#project-description.expanded {
    display: block;
    -webkit-line-clamp: unset;
    line-clamp: unset;
}

/* ===== FOOTER CONTROLS (Always Absolute) ===== */
#bottom-container {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    z-index: 25;
    pointer-events: auto;
}

#read-more-btn {
    color: white;
    background: transparent;
    border: none;
    padding: 0;
    font-size: 0.875rem;
    cursor: pointer;
    display: none;
    font-weight: 500;
    text-decoration: underline;
    margin-bottom: 0.25rem;
    line-height: 1;
}

#project-date {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
}

/* ===== INFO ICON (Always Absolute) ===== */
#info-icon {
    position: absolute;
    bottom: 1.5rem;
    left: 1.5rem;
    color: white;
    z-index: 30;
    padding: 0.5rem;
    border-radius: 9999px;
    background: rgba(0, 0, 0, 0.4);
    transition: opacity 0.3s ease, transform 0.2s ease, background 0.2s ease;
    pointer-events: auto;
    flex-shrink: 0;
    line-height: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    /* Hidden by default */
}

/* ===== INTERACTIONS ===== */

/* Hover: Show Image Swap & Icon ONLY */
#image-link-wrapper:hover #image-container {
    transform: scale(1.02);
    box-shadow: 0 6px 15px 0 rgba(0, 0, 0, 0.3);
}

#image-link-wrapper:hover #image-container::after {
    opacity: 1;
}

#image-link-wrapper:hover #info-icon {
    opacity: 1;
    cursor: pointer;
}

/* Active: Show Everything */
#image-link-wrapper.active #image-container::before {
    opacity: 1;
}

#image-link-wrapper.active #project-id,
#image-link-wrapper.active #project-description-container,
#image-link-wrapper.active #bottom-container {
    opacity: 1;
    pointer-events: auto;
}

#image-link-wrapper.active #info-icon {
    opacity: 1;
    background: #ffffff;
}

#image-link-wrapper.active #info-icon svg {
    stroke: #1f2937;
}

#image-link-wrapper.active #project-description {
    font-weight: 400;
}

/* Mobile Scrolled In */
#image-link-wrapper.mobile-visible #image-container::after {
    opacity: 1;
}

#image-link-wrapper.mobile-visible #info-icon {
    opacity: 1;
}

/* ===== NEW UI STYLES ===== */

/* Dial Slider */
.dial-slider-container {
    position: relative;
    padding: 10px 0;
    width: 100%;
}

.dial-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.dial-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #4f46e5;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s;
}

.dial-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

/* Color Preview Button */
.color-preview-btn {
    width: 100%;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-family: monospace;
    font-weight: 500;
    transition: all 0.2s;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.color-preview-btn:hover {
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Gallery Grid */
.preset-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #f3f4f6;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
}

.preset-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-color: #e5e7eb;
}

.preset-preview {
    height: 200px;
    background-color: #f9fafb;
    background-size: cover;
    background-position: center;
    position: relative;
}

.preset-info {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.preset-title {
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.25rem;
}

.preset-desc {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.4;
}

.preset-footer {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f3f4f6;
    text-align: right;
}

.preset-btn {
    display: inline-flex;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4f46e5;
}

.preset-btn:hover {
    text-decoration: underline;
}

/* Category Tabs */
.category-tab {
    position: relative;
    transition: color 0.2s;
}

.category-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #4f46e5;
}

/* ===== DARK MODE OVERRIDES ===== */
.dark .preset-card {
    background: #1f2937;
    /* gray-800 */
    border-color: #374151;
    /* gray-700 */
}

.dark .preset-card:hover {
    border-color: #4b5563;
    /* gray-600 */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

.dark .preset-title {
    color: #f3f4f6;
    /* gray-100 */
}

.dark .preset-desc {
    color: #9ca3af;
    /* gray-400 */
}

.dark .preset-footer {
    border-color: #374151;
    /* gray-700 */
}

.dark .preset-btn {
    color: #818cf8;
    /* indigo-400 */
}

.dark .preset-preview {
    background-color: #374151;
    /* gray-700 */
}

/* Dark Mode Toggle Button Active State */
.dark .platform-toggle-btn.active {
    color: #818cf8;
    /* indigo-400 */
    background-color: #1f2937;
    /* gray-800 */
    border-color: #4b5563;
    /* gray-600 */
}

.dark .platform-toggle-btn:hover {
    color: #a5b4fc;
    /* indigo-300 */
    background-color: #1f2937;
    /* gray-800 */
}