/* ============================================
   Settings Modal CSS - Common Styles
   ============================================
   User profile settings modal
   Used across all pages (landing, make, viewer, studio)
   ============================================ */

/* Settings Modal Container */
.settings-modal {
    position: relative;
    max-width: 720px !important;
    width: 95%;
    background: #21263C;
}

/* Modal Header with Subtitle */
.settings-modal .modal-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 28px 43px 20px 43px;
    padding-right: calc(43px + 40px); /* Add space for X button */
    background: #21263C;
}

/* Close Button (X) - Positioned at top-right corner */
.settings-modal .modal-close {
    position: absolute;
    top: 27px;
    right: 27px;
    background: none;
    border: none;
    font-size: 40px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all var(--duration-fast) ease;
    z-index: 10;
    line-height: 1;
}

.settings-modal .modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.settings-modal .modal-title {
    font-size: 32px;
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: 8px;
}

.modal-subtitle {
    font-size: 20px;
    color: #6B7AA1;
    margin: 0;
    font-weight: var(--font-semibold);
}

.settings-modal .modal-body {
    padding: 0 43px;
    padding-top: 20px;
    background: #21263C;
}

.settings-modal .modal-footer {
    display: flex;
    justify-content: center;
    padding: 30px 43px 35px 43px;
    background: #21263C;
    gap: 21px;
}

/* Images Row (Horizontal Layout) */
.images-row {
    display: flex;
    gap: 20px;
    margin-top: 12px;
}

/* Image Upload Box (Clickable + Drag & Drop) */
.image-upload-box {
    position: relative;
    cursor: pointer;
    transition: all var(--duration-fast) ease;
}

.image-upload-box:hover .image-preview {
    border-color: var(--brand-primary);
    background: var(--bg-hover);
}

/* Drag and Drop Highlight */
.image-upload-box.drag-over .image-preview {
    border-color: var(--brand-primary);
    border-style: solid;
    background: var(--bg-hover);
    box-shadow: 0 0 0 4px rgba(79, 172, 254, 0.1);
}

.image-upload-box.drag-over .image-preview-placeholder svg {
    opacity: 0.6;
    transform: scale(1.1);
    transition: all var(--duration-fast) ease;
}

/* Image Preview Containers */
.settings-modal .image-preview {
    position: relative;
    border: 2px dashed var(--border-default);
    border-radius: 12px;
    background: #2D365C;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-fast) ease;
}

/* Profile Preview (Small Square) */
.settings-modal .profile-preview {
    width: 155px;
    height: 148px;
    border-radius: 12px;
}

/* Background Preview (Wide Rectangle) */
.settings-modal .background-preview {
    width: 460px;
    height: 109px;
    border-radius: 12px;
}

.background-box {
    flex: 1;
}

/* Preview Image */
.settings-modal .image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Preview Placeholder (Upload Icon) */
.settings-modal .image-preview-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    width: 100%;
    height: 100%;
}

.settings-modal .image-preview-placeholder svg {
    opacity: 0.3;
    stroke-width: 1.5;
}

/* Form Groups */
.settings-modal .form-group {
    margin-bottom: 24px;
}

.settings-modal .form-group:last-child {
    margin-bottom: 0;
}

.settings-modal .form-group label {
    display: block;
    margin-bottom: 12px;
    font-size: 20px;
    font-weight: var(--font-semibold);
    color: var(--text-primary);
}

.settings-modal .form-group input,
.settings-modal .form-group textarea {
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-radius: 13px;
    background: #2C3768;
    color: var(--text-primary);
    font-size: 20px;
    font-family: var(--font-sans);
    transition: border-color var(--duration-fast) ease;
}

.settings-modal .form-group input {
    height: 50px;
    padding: 0 20px;
}

.settings-modal .form-group input::placeholder,
.settings-modal .form-group textarea::placeholder {
    color: #ADC3E3;
    font-weight: var(--font-medium);
}

.settings-modal .form-group input:focus,
.settings-modal .form-group textarea:focus {
    outline: none;
    border-color: var(--brand-primary);
}

.settings-modal .form-group textarea {
    resize: vertical;
    min-height: 166px;
}

/* Buttons */
.settings-modal .btn {
    height: 65px;
    padding: 0 24px;
    border-radius: 8px;
    font-size: 20px;
    font-weight: var(--font-bold);
    cursor: pointer;
    transition: all var(--duration-fast) ease;
    border: none;
    flex: 1;
}

.settings-modal .btn-secondary {
    background: #081021;
    color: var(--text-primary);
    border: none;
}

.settings-modal .btn-secondary:hover {
    background: #0A1428;
}

.settings-modal .btn-primary {
    background: #7657FE;
    color: white;
}

.settings-modal .btn-primary:hover {
    opacity: 0.9;
}

.settings-modal .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================
   Image Selector Modal (Preset Selection)
   ============================================ */

/* Image Selector Modal Container */
.image-selector-modal {
    z-index: 10001; /* Above settings modal */
    background: rgba(0, 0, 0, 0.76); /* Semi-transparent overlay */
}

.image-selector-content {
    position: relative;
    max-width: 600px !important;
    width: 600px;
    height: 750px;
    background: rgba(0, 0, 0, 0.76);
}

/* Modal Body for Image Selector */
.image-selector-modal .modal-body {
    padding: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Preset Grid - Profile (3 Column Fixed Grid) */
.preset-grid {
    display: grid;
    grid-template-columns: repeat(3, 170px);
    grid-template-rows: auto;
    gap: 19px;
    padding: 60px 20px 20px 20px;
    justify-content: center;
}

/* Preset Footer (Select button area inside scroll) */
.preset-footer {
    display: flex;
    justify-content: center;
    padding: 30px 20px 40px 20px;
}

/* Preset Grid - Background (Single Column, Wide) */
.preset-grid.background-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 12px;
    padding: 60px 30px 20px 30px;
}

/* Preset Item - Profile (170px Square) */
.preset-item {
    position: relative;
    width: 170px;
    height: 170px;
    border-radius: 1px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    background: #2D365C;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Preset Item - Background (Wide Rectangle) */
.preset-item.background-item {
    width: 100%;
    height: auto;
    aspect-ratio: 1920/500;
    border-radius: 12px;
}

.preset-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preset-item:hover {
    border-color: var(--brand-primary);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(118, 87, 254, 0.3);
}

.preset-item.selected {
    border: 7px solid #f2edf2;
    box-shadow: none;
}

/* Upload Option (+ button) */
.preset-item.upload-option {
    background: #635e72;
    border: none;
}

.preset-item.upload-option svg {
    width: 68px;
    height: 68px;
    color: #9E97A8;
    opacity: 1;
}

.preset-item.upload-option:hover {
    background: #7568;
    border: none;
}

.preset-item.upload-option:hover svg {
    opacity: 1;
    color: var(--brand-primary);
}

/* Scrollbar for modal body */
.image-selector-modal .modal-body::-webkit-scrollbar {
    width: 11px;
}

.image-selector-modal .modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.image-selector-modal .modal-body::-webkit-scrollbar-thumb {
    background: #3e426e;
    border-radius: 16px;
}

.image-selector-modal .modal-body::-webkit-scrollbar-thumb:hover {
    background: #4e5388;
}

/* X Close Button for Image Selector */
.image-selector-modal .modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 40px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all var(--duration-fast) ease;
    z-index: 10;
    line-height: 1;
}

.image-selector-modal .modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Select button in preset footer */
.preset-footer .btn-primary {
    width: 460px;
    height: 65px;
}

/* Responsive Settings Modal */
@media (max-width: 768px) {
    .settings-modal {
        max-width: 95%;
    }

    .settings-modal .modal-header {
        padding: 20px 24px 16px 24px;
        padding-right: calc(24px + 40px);
    }

    .settings-modal .modal-body {
        padding: 0 24px;
        padding-top: 16px;
    }

    .settings-modal .modal-footer {
        padding: 24px;
    }

    .settings-modal .modal-close {
        top: 20px;
        right: 20px;
    }

    .images-row {
        flex-direction: column;
    }
    .settings-modal .profile-preview,
    .settings-modal .background-preview {
        width: 100%;
        height: 120px;
    }

    .preset-grid {
        grid-template-columns: repeat(2, 140px);
        grid-template-rows: auto;
        gap: 16px;
        padding: 50px 20px 20px 20px;
    }

    .preset-item {
        width: 140px;
        height: 140px;
    }

    .image-selector-content {
        max-width: 95%;
        width: 95%;
        height: 90vh;
    }

    .preset-footer .btn-primary {
        width: 90%;
        max-width: 350px;
    }
}
