.hidden {
    display: none !important;
}

svg {
    fill: none;
}

body {
    overflow-x: hidden;
}

body.download-active {
    height: calc(100vh - 81px);
    overflow-y: visible;
}

body.selection-active {
    overflow-y: hidden;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-screen.active {
    opacity: 1;
    pointer-events: all;
}

.loading-bar-container {
    width: 300px;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.loading-bar {
    position: absolute;
    height: 100%;
    background: #ff6154;
    border-radius: 2px;
    width: 40%;
    will-change: transform;
    animation: loading 1.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes loading {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(200%); }
    100% { transform: translateX(500%); }
}

.loading-text {
    font-size: 15px;
    color: #666;
    font-weight: 500;
}

/* Container & Upload */
.container {
    background-color: transparent;
    box-sizing: border-box;
    padding: 20px;
    border-radius: 16px;
    max-width: 1400px;
    margin: 0 auto 10px auto;
    overflow: visible;
}

.upload-area {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 12px;
}

.file-input-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ff6154;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 16px 48px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-input-label:hover {
    background: #e5554a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 97, 84, 0.4);
}

.upload-content {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.upload-icon {
    position: absolute;
    width: 24px;
    height: 24px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.upload-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    margin: 0;
    transition: opacity 0.3s ease;
}

.file-input-label:hover .upload-icon {
    opacity: 1;
}

.file-input-label:hover .upload-text {
    opacity: 0;
    visibility: hidden;
}

.file-input {
    display: none;
}

/* ============================================
   Selection Panel - Split View
   ============================================ */
.selection-panel {
    margin-top: 0;
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
    position: fixed;
    top: 81px;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: calc(100vh - 81px);
}

.selection-content {
    display: flex;
    gap: 0;
    align-items: stretch;
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: relative;
}

/* Left side - Preview */
.files-preview-section {
    flex: 1;
    background-color: #f5f6f8;
    background-image: radial-gradient(circle, #e0e2e6 1px, transparent 1px);
    background-size: 20px 20px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    overflow-y: auto;
    margin-right: 420px;
    box-sizing: border-box;
    position: relative;
}

.files-preview-section.full-preview-mode {
    justify-content: flex-start;
    padding-top: 56px;
}

/* Preview Mode Toggle */
.preview-mode-toggle {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 6px 12px;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    z-index: 10;
}

.preview-mode-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #6b7280;
    white-space: nowrap;
}

.preview-canvas-area {
    max-width: 600px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

/* Full Preview Mode */
.preview-full-container {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.preview-full-container .preview-page-wrapper {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    position: relative;
}

.preview-full-container .preview-page-wrapper canvas {
    width: 100%;
    height: auto;
    display: block;
}

.preview-full-container .watermark-overlay-full {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
}

.preview-page-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 6px 8px;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.page-nav-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: #6b7280;
}

.page-nav-btn:hover:not(:disabled) {
    background: #f3f4f6;
    color: #ff6154;
}

.page-nav-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.page-nav-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.page-indicator {
    font-size: 0.85rem;
    color: #6b7280;
    font-weight: 600;
    min-width: 100px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.preview-canvas-wrapper {
    position: relative;
    display: inline-block;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    line-height: 0;
}

#previewCanvas {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 240px);
}

.watermark-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.watermark-preview-text {
    font-weight: 700;
    white-space: nowrap;
    user-select: none;
    pointer-events: none;
}

.watermark-preview-image {
    user-select: none;
    pointer-events: none;
    object-fit: contain;
}


/* ============================================
   Right side - Controls Panel
   ============================================ */
.controls-panel {
    position: fixed;
    right: 0;
    top: 81px;
    width: 420px;
    box-sizing: border-box;
    padding: 0;
    height: calc(100vh - 81px);
    background: white;
    border-left: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.controls-panel-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px 16px 28px;
    min-height: 0;
}

/* Dividers between major sections */
.controls-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 20px 0;
}

/* ============================================
   Accordion Sections
   ============================================ */
.accordion-section {
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: visible;
    transition: border-color 0.2s;
}

.accordion-section.active {
    border-color: #ff6154;
}

.accordion-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    border-radius: 11px;
}

.accordion-header:hover {
    background: #f9fafb;
}

.accordion-title {
    flex: 1;
    font-size: 0.92rem;
    font-weight: 700;
    color: #1f2937;
}

.accordion-chevron {
    color: #9ca3af;
    transition: transform 0.25s ease;
    flex-shrink: 0;
    transform: rotate(0deg);
}

.accordion-section.active .accordion-chevron {
    transform: rotate(90deg);
    color: #ff6154;
}

.accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 16px;
}

.accordion-section.active .accordion-body {
    max-height: 800px;
    padding: 4px 16px 16px 16px;
}

/* ============================================
   Inline Control Rows
   ============================================ */
.control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 40px;
    margin-bottom: 10px;
}

.control-row-full {
    margin-bottom: 8px;
}

/* Config Row - 2-column grid (matching add-page-numbers) */
.config-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
    overflow: visible;
}

.config-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.config-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.config-field .custom-dropdown {
    width: 100%;
}

.config-field .custom-dropdown-trigger {
    height: 38px;
    padding: 0 10px 0 12px;
    border-radius: 8px;
    background: white;
}

.config-field .custom-dropdown-trigger:hover {
    border-color: #ffc9c3;
    background: #fff5f4;
}

.config-field .custom-dropdown-menu {
    left: 0;
    right: auto;
    min-width: 165px;
    z-index: 600;
}

.config-field .modal-trigger {
    width: 100%;
    height: 38px;
    border-radius: 8px;
}

.config-field .modal-trigger:hover {
    border-color: #ffc9c3;
    background: #fff5f4;
}

.wm-text-selector {
    margin-bottom: 4px;
}

.wm-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #9ca3af;
    margin: 0 0 6px 2px;
}

#wmPresetsSection {
    margin-top: 12px;
}

.wm-text-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}


.wm-chip {
    position: relative;
    padding: 0 14px;
    height: 30px;
    border: none;
    border-radius: 20px;
    background: #f3f4f6;
    font-size: 0.78rem;
    font-weight: 600;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.wm-chip:hover {
    background: #e5e7eb;
    color: #1f2937;
}

.wm-chip.active {
    background: #1f2937;
    color: white;
}

.wm-chip-custom {
    gap: 4px;
    background: transparent;
    border: 1.5px dashed #d1d5db;
    color: #9ca3af;
    padding: 0 12px;
}

.wm-chip-custom:hover {
    border-color: #ff6154;
    color: #ff6154;
    background: #fff5f4;
}

.wm-chip-custom.active {
    border-style: solid;
    border-color: #ff6154;
    background: #ff6154;
    color: white;
}

.wm-chip-custom.active svg {
    display: none;
}

.wm-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0;
    margin-right: 0;
    width: 0;
    height: 16px;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    opacity: 0;
    overflow: hidden;
    transition: width 0.2s ease, opacity 0.2s ease, margin-left 0.2s ease, margin-right 0.2s ease;
}

.wm-chip:hover .wm-chip-remove {
    width: 16px;
    opacity: 0.5;
    margin-left: 4px;
    margin-right: -4px;
}

.wm-chip:hover .wm-chip-remove:hover {
    opacity: 1;
}

.wm-custom-input {
    margin-top: 10px;
    animation: wmInputSlide 0.2s ease;
}

.wm-custom-input.hidden {
    display: none;
}

.wm-custom-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: #d1d5db;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
}

.toggle-switch.active {
    background: #ff6154;
}

.toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.toggle-switch.active .toggle-slider {
    transform: translateX(20px);
}

@keyframes wmInputSlide {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.wm-custom-text-input {
    flex: 1;
    height: 36px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    background: #f9fafb;
    outline: none;
    font-family: inherit;
    transition: all 0.2s;
}

.wm-custom-text-input:focus {
    border-color: #ff6154;
    background: white;
    box-shadow: 0 0 0 3px rgba(255, 97, 84, 0.08);
}

.wm-custom-add-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: #ff6154;
    color: white;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wm-custom-add-btn:hover {
    background: #e5554a;
}

.control-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #6b7280;
    white-space: nowrap;
    min-width: 64px;
    flex-shrink: 0;
}

.control-row-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: flex-end;
}

/* ============================================
   Custom Dropdown
   ============================================ */
.custom-dropdown {
    position: relative;
    flex-shrink: 0;
}

.custom-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 10px 0 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 9px;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.custom-dropdown-trigger:hover {
    border-color: #d1d5db;
    background: white;
}

.custom-dropdown.open .custom-dropdown-trigger {
    border-color: #ff6154;
    background: white;
    box-shadow: 0 0 0 3px rgba(255, 97, 84, 0.08);
}

.custom-dropdown-text {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    flex: 1;
    text-align: left;
}

.custom-dropdown-arrow {
    stroke: #9ca3af;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.custom-dropdown.open .custom-dropdown-arrow {
    transform: rotate(180deg);
    stroke: #ff6154;
}

.custom-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 100%;
    background: white;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    z-index: 500;
    padding: 4px;
    max-height: 220px;
    overflow-y: auto;
    /* Clip scrollbar inside border-radius */
    clip-path: inset(0 round 10px);
}

.custom-dropdown.open .custom-dropdown-menu {
    display: block;
}

.custom-dropdown-option {
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.12s;
    white-space: nowrap;
}

.custom-dropdown-option:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.custom-dropdown-option.selected {
    background: #fff0ee;
    color: #ff6154;
    font-weight: 600;
}

/* ============================================
   Modal Trigger Button
   ============================================ */
.modal-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 10px 0 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 9px;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    font-family: inherit;
}

.modal-trigger:hover {
    border-color: #d1d5db;
    background: white;
}

.modal-trigger-text {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    flex: 1;
    text-align: left;
}

.modal-trigger-arrow {
    width: 16px;
    height: 16px;
    stroke: #9ca3af;
    flex-shrink: 0;
    transition: stroke 0.15s;
}

.modal-trigger:hover .modal-trigger-arrow {
    stroke: #ff6154;
}

/* ============================================
   Size Slider + Input
   ============================================ */
.size-slider-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.size-slider {
    flex: 1;
    min-width: 0;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #e5e7eb;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ff6154;
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 0.15s;
    margin-top: -6px;
}

.size-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.size-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ff6154;
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    cursor: pointer;
}

.size-slider::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 2px;
}

.size-slider::-moz-range-track {
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    border: none;
}

.size-input-wrap {
    display: flex;
    align-items: center;
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    padding: 0 8px 0 0;
    min-width: 64px;
    flex-shrink: 0;
}

.size-input {
    width: 38px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    text-align: center;
    padding: 6px 2px 6px 8px;
    outline: none;
    font-family: inherit;
    -moz-appearance: textfield;
}

.size-input::-webkit-outer-spin-button,
.size-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.size-input-unit {
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
}

/* ============================================
   Popup Modal
   ============================================ */
.popup-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.15s ease;
}

.popup-modal-overlay.hidden {
    display: none !important;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.popup-modal {
    background: white;
    border-radius: 16px;
    padding: 20px;
    min-width: 280px;
    max-width: 340px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(0, 0, 0, 0.08);
    animation: modalSlideIn 0.2s ease;
}

@keyframes modalSlideIn {
    from { transform: scale(0.95) translateY(8px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.popup-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.popup-modal-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1f2937;
}

.popup-modal-close {
    width: 28px;
    height: 28px;
    border: none;
    background: #f3f4f6;
    border-radius: 8px;
    font-size: 18px;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    line-height: 1;
}

.popup-modal-close:hover {
    background: #e5e7eb;
    color: #1f2937;
}

.popup-modal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.popup-modal-list {
    grid-template-columns: 1fr;
}

.popup-modal-option {
    padding: 10px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    background: white;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    font-family: inherit;
}

.popup-modal-option:hover {
    border-color: #ff6154;
    background: #fff5f4;
    color: #ff6154;
}

.popup-modal-option.selected {
    background: #ff6154;
    color: white;
    border-color: #ff6154;
}

/* ============================================
   Unified Color Picker
   ============================================ */
.color-picker-unified {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.color-recent-swatches {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-right: 6px;
    margin-right: 2px;
    border-right: 1.5px solid #e5e7eb;
}

.color-recent-swatches.hidden {
    display: none;
}

.color-swatch {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
    outline: none;
    flex-shrink: 0;
}

.color-swatch:hover {
    transform: scale(1.15);
}

.color-swatch.active {
    border-color: #ff6154;
    box-shadow: 0 0 0 2px white, 0 0 0 3.5px #ff6154;
}

.color-swatch-custom {
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #9ca3af;
}

.color-swatch-custom:hover {
    border-color: #6b7280;
    background: #d1d5db;
}

.color-swatch-custom svg {
    stroke: #6b7280;
    pointer-events: none;
    flex-shrink: 0;
}

/* Color Modal */
/* Color Modal Card */
.color-modal-card {
    background: #f5f6f8;
    border-radius: 24px;
    padding: 24px;
    width: 320px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.04);
    animation: modalSlideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.color-modal-top {
    background: white;
    border-radius: 18px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.color-modal-preview-lg {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    flex-shrink: 0;
    transition: background-color 0.2s;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.color-modal-top-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.color-modal-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.color-modal-hex-display {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.color-modal-canvas-wrap {
    position: relative;
    background: white;
    border-radius: 18px;
    padding: 14px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    cursor: crosshair;
}

.color-modal-gradient {
    display: block;
    width: 100%;
    height: 160px;
    border-radius: 12px;
}

.color-modal-gradient-cursor {
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    transform: translate(-50%, -50%);
    top: 14px;
    left: 14px;
}

.color-modal-hue-wrap {
    position: relative;
    background: white;
    border-radius: 18px;
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    cursor: pointer;
}

.color-modal-hue-bar {
    display: block;
    width: 100%;
    height: 16px;
    border-radius: 8px;
}

.color-modal-hue-cursor {
    position: absolute;
    width: 10px;
    height: 24px;
    border-radius: 5px;
    border: 3px solid white;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    transform: translate(-50%, -50%);
    top: 50%;
    left: 14px;
}

.color-modal-controls {
    background: white;
    border-radius: 18px;
    padding: 14px;
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.color-modal-input-row {
    display: flex;
    align-items: center;
    background: #f3f4f6;
    border-radius: 12px;
    overflow: hidden;
    flex: 1;
}

.color-modal-hash {
    padding: 0 0 0 12px;
    font-size: 14px;
    font-weight: 700;
    color: #9ca3af;
}

.color-modal-hex-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 11px 12px 11px 4px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    color: #1f2937;
    outline: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    width: 0;
}


.color-modal-actions {
    display: flex;
    gap: 8px;
}

.color-modal-cancel {
    flex: 1;
    padding: 13px;
    border: none;
    border-radius: 14px;
    background: white;
    color: #6b7280;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.color-modal-cancel:hover {
    background: #f9fafb;
    color: #374151;
}

.color-modal-apply {
    flex: 1;
    padding: 13px;
    border: none;
    border-radius: 14px;
    background: #1f2937;
    color: white;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}

.color-modal-apply:hover {
    background: #374151;
}

/* Previous Settings Notice */
.previous-settings-notice {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #fffbeb;
    border: none;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 0.875rem;
    color: #1f2937;
}

.previous-settings-notice svg {
    flex-shrink: 0;
    color: #f59e0b;
}

.previous-settings-notice a {
    color: #f7b33e;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.previous-settings-notice a:hover {
    text-decoration: underline;
}


.font-style-toggles {
    display: flex;
    gap: 4px;
}

.font-style-btn {
    width: 38px;
    height: 38px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #6b7280;
    transition: all 0.2s;
}

.font-style-btn:hover {
    border-color: #d1d5db;
    color: #374151;
}

.font-style-btn.active {
    background: #1f2937;
    color: white;
    border-color: #1f2937;
}


/* Controls */
.control-input {
    width: 100%;
    height: 40px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 0 14px;
    font-size: 14px;
    color: #1a1a1a;
    outline: none;
    transition: all 0.2s;
    background: #f9fafb;
}

.control-input:focus {
    border-color: #ff6154;
    background: white;
    box-shadow: 0 0 0 3px rgba(255, 97, 84, 0.08);
}

.control-input::placeholder {
    color: #9ca3af;
}



/* Image Upload Area */
.image-upload-area {
    border: 1.5px dashed #d1d5db;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.2s;
    background: #f9fafb;
}

.image-upload-area:hover {
    border-color: #ff6154;
    background: rgba(255, 97, 84, 0.02);
}

.image-upload-area.dragover {
    border-color: #ff6154;
    background: rgba(255, 97, 84, 0.05);
}

.image-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px 20px;
    cursor: pointer;
    color: #9ca3af;
}

.image-upload-placeholder svg {
    width: 28px;
    height: 28px;
    stroke: #d1d5db;
}

.image-upload-placeholder span {
    font-size: 13px;
    font-weight: 500;
}

.image-upload-preview {
    position: relative;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-upload-preview img {
    max-width: 100%;
    max-height: 100px;
    object-fit: contain;
    border-radius: 8px;
}

.remove-image-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: none;
    background: #1a1a1a;
    color: white;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.remove-image-btn:hover {
    background: #ff6154;
}


/* Apply Button (pinned bottom) - matches compress-pdf style */
.apply-section {
    padding: 16px 28px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
    background: white;
}

.btn-apply {
    width: 100%;
    padding: 16px 20px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
    background-color: #ff6154;
    color: white;
}

.btn-apply:hover:not(:disabled) {
    background: #e5554a;
    box-shadow: 0 6px 16px rgba(255, 97, 84, 0.4);
    transform: translateY(-2px);
}

.btn-apply:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-spinner {
    width: 0;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.2s ease, width 0.2s ease, margin 0.2s ease;
    margin-right: -16px;
}

.btn-apply.btn-loading .btn-spinner {
    width: 20px;
    opacity: 1;
    margin-right: 0;
    animation: spinner 0.6s linear infinite;
}

.btn-apply.btn-loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn-apply-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.btn-apply-title {
    font-size: 1rem;
    font-weight: 700;
}

.btn-apply-desc {
    font-size: 0.8rem;
    opacity: 0.8;
    font-weight: 400;
}

.btn-apply-arrow {
    width: 24px;
    height: 24px;
    stroke: white;
    flex-shrink: 0;
    margin-left: auto;
    transition: transform 0.2s ease;
}

.btn-apply:hover .btn-apply-arrow {
    transform: translateX(4px);
}

.btn-apply.btn-loading .btn-apply-arrow {
    display: none;
}

@keyframes spinner {
    to { transform: rotate(360deg); }
}

/* ============================================
   Download Screen
   ============================================ */
.download-screen {
    display: none;
    padding: 0;
    max-width: 100%;
    margin: 0;
    min-height: calc(100vh - 81px);
    background: #f5f6f8;
}

.download-screen.active {
    display: block;
}

.download-content {
    display: flex;
    width: 100%;
    min-height: calc(100vh - 81px);
}

.pdf-preview-section {
    flex: 1;
    background: #f5f6f8;
    padding: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    margin-right: 420px;
    height: calc(100vh - 81px);
    box-sizing: border-box;
}

.preview-canvas-container {
    width: 100%;
    max-width: 700px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.preview-page-wrapper {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    position: relative;
}

.preview-page-wrapper canvas {
    width: 100%;
    height: auto;
    display: block;
}

.page-number-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 10;
}

/* Download Actions Sidebar */
.download-actions-section {
    position: fixed;
    right: 0;
    top: 81px;
    width: 420px;
    height: calc(100vh - 81px);
    background: white;
    border-left: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    padding: 40px;
    overflow-y: auto;
    box-sizing: border-box;
}

.back-button {
    background: transparent;
    color: #6b7280;
    border: none;
    padding: 12px 20px;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    font-weight: 500;
    position: absolute;
    margin-top: -10px;
    left: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-button:hover {
    background: none;
    color: #ff6154;
    box-shadow: none;
    transform: translateX(-2px);
}

.back-button svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

#download-files-list {
    margin-top: 50px;
    margin-bottom: 24px;
}

.single-file-card {
    background: none;
    border: none;
    border-radius: 12px;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.single-file-thumb {
    width: 68px;
    height: 82px;
    background: white;
    border-radius: 6px;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.single-file-thumb canvas {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.single-file-details {
    flex: 1;
    text-align: left;
    min-width: 0;
}

.single-file-name {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    background: #f9f9f9;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.single-file-name:hover {
    background: #f0f1f3;
}

.single-file-name-base {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.single-file-name-ext {
    white-space: nowrap;
    flex-shrink: 0;
    color: #9ca3af;
    margin-left: auto;
}

.single-file-info {
    font-size: 0.7rem;
    color: #9ca3af;
}

.single-file-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.file-more-btn {
    background: #f9f9f9;
    border: none;
    border-radius: 8px;
    padding: 8px 6px;
    cursor: pointer;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.file-more-btn:hover {
    background: #f3f4f6;
    color: #6b7280;
}

.file-more-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
    animation: modalFadeIn 0.15s ease;
}

.file-more-overlay.hidden {
    display: none !important;
}

.file-more-sheet {
    width: 100%;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: sheetSlideUp 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes sheetSlideUp {
    from { opacity: 0; transform: translateY(100%); }
    to { opacity: 1; transform: translateY(0); }
}

.file-more-group {
    background: white;
    border-radius: 16px;
    overflow: hidden;
}

.file-more-action {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background 0.15s;
}

.file-more-action:hover {
    background: #f9fafb;
}

.file-more-action-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.file-more-action-icon svg {
    color: #374151;
}

.file-more-action-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.file-more-action-label {
    font-size: 0.92rem;
    font-weight: 600;
    color: #1f2937;
}

.file-more-action-desc {
    font-size: 0.75rem;
    color: #9ca3af;
}

.file-more-divider {
    height: 1px;
    background: #f3f4f6;
    margin: 0 18px;
}

.file-more-cancel {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 16px;
    background: white;
    color: #6b7280;
    font-size: 0.92rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}

.file-more-cancel:hover {
    background: #f9fafb;
    color: #374151;
}

/* Rename Modal */
.rename-modal-card {
    background: #f5f6f8;
    border-radius: 24px;
    padding: 24px;
    width: 320px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.04);
    animation: modalSlideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.rename-modal-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 16px;
}

.rename-modal-input-wrap {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 12px;
    padding: 0;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.rename-modal-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 14px;
    font-size: 0.92rem;
    font-weight: 600;
    font-family: inherit;
    color: #1f2937;
    outline: none;
    min-width: 0;
}

.rename-modal-ext {
    padding: 12px 14px 12px 0;
    font-size: 0.92rem;
    font-weight: 600;
    color: #9ca3af;
    flex-shrink: 0;
}

.rename-modal-actions {
    display: flex;
    gap: 8px;
}

.rename-modal-cancel {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 14px;
    background: white;
    color: #6b7280;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.rename-modal-cancel:hover {
    background: #f9fafb;
    color: #374151;
}

.rename-modal-save {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 14px;
    background: #1f2937;
    color: white;
    font-size: 0.88rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}

.rename-modal-save:hover {
    background: #374151;
}

.done-button {
    background: #10b981;
    color: white;
    padding: 2px 7px;
    border-radius: 8px;
    font-size: 0.6rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-bottom: 3px;
}

.done-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: white;
}

.download-primary {
    width: 100%;
    padding: 18px 32px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background-color: #ff6154;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
}

.download-primary:hover {
    background: #e5554a;
    box-shadow: 0 4px 12px rgba(255, 97, 84, 0.35);
    transform: translateY(-1px);
}

.download-primary svg {
    width: 20px;
    height: 20px;
    stroke: white;
    fill: none;
}


.extract-another-btn {
    width: 100%;
    padding: 13px 32px;
    margin-top: 12px;
    background: transparent;
    color: #ff6154;
    border: 1.5px solid #ff6154;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.another-btn-text,
.another-btn-arrow {
    transition: opacity 0.25s ease;
}

.another-btn-arrow {
    position: absolute;
    opacity: 0;
}

.extract-another-btn:hover {
    background: #fff5f4;
    box-shadow: 0 4px 12px rgba(255, 97, 84, 0.2);
}

.extract-another-btn:hover .another-btn-text {
    opacity: 0;
}

.extract-another-btn:hover .another-btn-arrow {
    opacity: 1;
}

/* Hide elements when showing download screen */
.content-hidden {
    display: none !important;
}

/* Scrollbar */
.controls-panel::-webkit-scrollbar,
.controls-panel-scroll::-webkit-scrollbar,
.files-preview-section::-webkit-scrollbar,
.pdf-preview-section::-webkit-scrollbar,
.download-actions-section::-webkit-scrollbar,
*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: #f3f4f6;
}

*::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}

*::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1200px) {
    .controls-panel {
        width: 380px;
    }
    .files-preview-section {
        margin-right: 380px;
    }
    .download-actions-section {
        width: 380px;
    }
    .pdf-preview-section {
        margin-right: 380px;
    }
}

@media (max-width: 968px) {
    body.selection-active {
        overflow-y: auto;
    }

    .selection-panel {
        position: relative;
        height: auto;
        min-height: calc(100vh - 81px);
    }

    .selection-content {
        flex-direction: column;
        height: auto;
    }

    .controls-panel {
        position: relative;
        width: 100%;
        height: auto;
        top: 0;
        border-left: none;
        border-bottom: 1px solid #e5e7eb;
        order: 1;
    }

    .controls-panel-scroll {
        overflow-y: visible;
    }

    .files-preview-section {
        margin-right: 0;
        height: auto;
        order: 2;
        padding: 32px 24px;
        overflow-y: visible;
    }

    .download-screen {
        position: relative;
        height: auto;
        min-height: calc(100vh - 81px);
    }

    .download-content {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 81px);
    }

    .download-actions-section {
        position: relative;
        width: 100%;
        height: auto;
        border-left: none;
        border-top: 1px solid #e5e7eb;
    }

    .pdf-preview-section {
        margin-right: 0;
        padding: 100px 20px 20px 20px;
        height: auto;
        min-height: 50vh;
    }

    .back-button {
        top: 20px;
        left: 20px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 16px;
    }

    .files-preview-section {
        padding: 24px 16px 40px 16px;
        min-height: auto;
    }

    .controls-panel {
        padding: 0;
    }

    .controls-panel-scroll {
        padding: 20px 16px 12px 16px;
    }

    .apply-section {
        padding: 12px 16px;
    }

    .pdf-preview-section {
        padding: 80px 16px 24px 16px;
    }

    .download-actions-section {
        padding: 24px 16px;
    }

    .back-button {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    .wm-text-chips {
        gap: 4px;
    }

    .wm-chip {
        font-size: 0.7rem;
        padding: 5px 10px;
    }

    .font-style-btn {
        width: 34px;
        height: 34px;
    }

    .custom-dropdown-trigger {
        height: 34px;
        padding: 0 8px 0 10px;
    }

    .custom-dropdown-text {
        font-size: 12px;
    }

    .control-label {
        font-size: 0.78rem;
        min-width: 56px;
    }

    .accordion-header {
        padding: 12px 14px;
    }

    .accordion-title {
        font-size: 0.88rem;
    }

    .color-swatch {
        width: 24px;
        height: 24px;
    }

}
