/* ============================================
   tools-new.css — All tool styles (replaces tools.css)
   ============================================ */

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

/* --- Visibility utilities (used by JS instead of inline styles) --- */
.is-hidden {
    display: none !important;
}

.is-visible {
    display: block !important;
}

.is-visible-flex {
    display: flex !important;
}

/* --- Animations --- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

/* ========================
   Loading Overlay
   ======================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, .92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity .3s ease;
}

.loading-overlay.visible {
    opacity: 1;
}

.loading-overlay__content {
    text-align: center;
    padding: 40px;
}

.loading-overlay__spinner {
    width: 56px;
    height: 56px;
    margin: 0 auto 20px;
    color: #7B68EE;
}

.loading-overlay__svg {
    width: 100%;
    height: 100%;
    animation: lo-rotate 1.4s linear infinite;
}

.loading-overlay__circle {
    stroke-dasharray: 80, 200;
    stroke-dashoffset: 0;
    animation: lo-dash 1.4s ease-in-out infinite;
}

.loading-overlay__text {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.loading-overlay__subtext {
    font-size: 14px;
    color: #888;
}

.loading-overlay__dots::after {
    content: '...';
}

@keyframes lo-rotate {
    100% { transform: rotate(360deg); }
}

@keyframes lo-dash {
    0%   { stroke-dasharray: 1, 200;  stroke-dashoffset: 0;    }
    50%  { stroke-dasharray: 80, 200; stroke-dashoffset: -35;  }
    100% { stroke-dasharray: 80, 200; stroke-dashoffset: -125; }
}

/* ========================
   Upload Zone
   ======================== */
.wrapper {}

.upload {
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 78px 20px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    background-color: #f8f7fc;
    text-align: center;
    max-width: 500px;
}

.upload:hover {
    border-color: #7B68EE;
    background: #f5f0ff;
}

.upload.dragover {
    border-color: #7B68EE;
    background: #f5f0ff;
    transform: scale(1.02);
}

.upload input[type="file"] {
    display: none;
}

input[type="file"] {
    margin: 15px 0;
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.upload__label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #555;
    cursor: pointer;
}

.upload__file-text {
    margin-bottom: 4px;
    font-size: 18px;
    line-height: 28px;
    color: #333;
    margin-bottom: 0 !important;
}

.bold {
    font-weight: 600;
}

.browse {
    color: #7B68EE;
    text-decoration: underline;
    cursor: pointer;
}

.upload__file-subtext {
    font-size: 12px;
    line-height: 20px;
    color: rgba(60, 60, 66, 0.6);
    margin: 0;
}

/* ========================
   Preview
   ======================== */
.preview {
    display: none;
    padding: 16px;
    border-radius: 12px;
    position: relative;
    animation: fadeIn 0.3s ease;
}

.preview__inner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8f5ff;
    border-radius: 12px;
    padding: 26px 29px;
}

.preview__wrap .preview__name {
    font-weight: 600;
    color: #333;
    text-align: left;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
    display: block;
}

.preview__wrap .preview__size {
    color: #777;
    font-size: 13px;
    margin-top: 2px;
    text-align: left;
    display: block;
}

.preview__info {
    font-size: 16px;
    line-height: 28px;
    font-weight: 600;
    color: #3C3C42;
    margin: 28px 0;
    text-align: center;
    justify-content: center;
}

.preview__action {
    display: none;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

.preview__action button,
.success__buttons button {
    flex: 1;
}

/* ========================
   Loader
   ======================== */
.loader {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #6a5ae0;
    font-size: 16px;
    font-weight: 500;
    margin: 28px 0;
}

.loader::before {
    content: "";
    width: 22px;
    height: 22px;
    border: 3px solid #d9d6fb;
    border-top-color: #6a5ae0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ========================
   Success
   ======================== */
.success {
    display: none;
    text-align: center;
    animation: fadeIn 0.4s ease;
}

.success .icon {
    margin-bottom: 12px;
}

.success h3 {
    margin: 0 0 12px;
    color: #333;
    font-size: 20px;
    line-height: 28px;
    margin-top: 0 !important;
}

.success p {
    margin: 0 0 20px;
    color: #555;
    font-size: 16px;
    line-height: 1.5;
}

.success strong {
    color: #7B68EE;
}

.success__buttons {
    display: none;
    justify-content: center;
    gap: 12px;
}

/* ========================
   Buttons
   ======================== */
button.cancel {
    background: #eee;
    color: #555;
}

button.cancel:hover {
    background: #ddd;
    color: #555;
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.button .btn-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* ========================
   Progress Bar
   ======================== */
.file__progress {
    height: 4px;
    background: #eee;
    border-radius: 2px;
    margin-top: 12px;
    overflow: hidden;
}

.file__progress .bar {
    height: 100%;
    background: #7B68EE;
    width: 0%;
    transition: width 0.3s ease;
}

/* ========================
   Slide Duration Slider (Convert tool)
   ======================== */
#slideDurationGroup {
    margin: 28px 0;
}

#slideDurationGroup.active {
    display: block;
}

.slider-container {
    position: relative;
    height: 40px;
}

[data-tool="quiz"] .slider-container {
    height: 100%;
}

#slideDuration {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #e0e0e0;
    outline: none;
    margin: 16px 0 0;
}

#slideDuration::-webkit-slider-runnable-track {
    height: 8px;
    border-radius: 5px;
    background: #e0e0e0;
}

#slideDuration::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--global-palette-btn-bg);
    cursor: pointer;
    margin-top: -8px;
    box-shadow: 0 2px 6px rgba(123, 104, 238, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#slideDuration::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 10px rgba(123, 104, 238, 0.4);
}

#slideDuration::-moz-range-track {
    height: 8px;
    border-radius: 5px;
    background: #e0e0e0;
    border: none;
}

#slideDuration::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--global-palette-btn-bg);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(123, 104, 238, 0.3);
}

.slider-value {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--global-palette-btn-bg);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.slider-value.show {
    opacity: 1;
}

.slider-value::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--global-palette-btn-bg);
}

/* ========================
   Title Generator
   ======================== */
.tools__wrap {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 0;
    flex-wrap: wrap;
    margin: 0 auto;
}

.tools__wrap .button {
    width: 100%;
}

.tools__inner {
    display: flex;
    flex-direction: column;
    width: calc(50% - 12px);
    gap: 20px;
}

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

.tools__title {
    font-size: 20px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0 !important;
}

.tools__subtitle {
    font-size: 16px;
    color: #9ca3af;
    margin-top: -4px !important;
    margin-bottom: 0 !important;
}

.tools__textarea {
    resize: vertical;
    min-height: 125px;
}

.tools__textarea,
.form-group__select {
    padding: 10px 10px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: #fafafa;
    margin-bottom: 0 !important;
}

.tools__textarea::placeholder {
    opacity: 0.5;
}

.tools__textarea:focus,
.form-group__select:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form-group__select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 44px;
}

/* Tone Buttons */
.tone-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-width: 500px;
    width: 100%;
    height: 100%;
    align-self: flex-end;
}

.tone-btn {
    position: relative;
    padding: 14px 16px;
    border-radius: 16px;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.tone-btn:hover {
    border-color: #c7d2fe;
    background: #f5f3ff;
}

.tone-btn.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #ede9fe 0%, #e0e7ff 100%);
}

.tone-btn input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tone-btn__icon {
    font-size: 20px;
    margin-bottom: 6px;
}

.tone-btn__title {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 2px;
}

.tone-btn__desc {
    font-size: 12px;
    color: #9ca3af;
    line-height: 1.3;
}

.tone-btn.active .tone-btn__title {
    color: #4338ca;
}

.tone-btn.active .tone-btn__desc {
    color: #6366f1;
}

/* Results List */
.result-item {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    height: 100%;
}

.result-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.result-item__number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: var(--global-palette-btn-bg);
    color: white;
    border-radius: 8px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}

.result-item__text {
    flex: 1;
    font-size: 15px;
    color: #1e293b;
    line-height: 1.5;
}

.result-item__copy {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
}

.result-item__copy:hover {
    background: #e0e7ff;
    color: #667eea;
}

.result-item__copy.copied {
    background: #d1fae5;
    color: #10b981;
}

.results__list {
    max-width: 1200px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    margin: 0 auto;
    gap: 12px;
}

#regenerateBtn {
    display: flex;
    align-items: center;
    justify-content: center;
}

#regenerateBtn svg {
    margin-right: 5px;
}

/* Field validation error */
.field-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.field-error.tone-buttons,
.tone-buttons.field-error {
    border: 2px solid #ef4444;
    border-radius: 12px;
    padding: 8px;
    margin: -8px;
}

/* ========================
   Export Popup (GSlides)
   ======================== */
.export-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.export-popup {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    padding: 24px;
    max-width: 360px;
    width: 90%;
    text-align: center;
    position: relative;
    animation: scaleIn 0.2s ease;
}

.export-popup__icon {
    margin-bottom: 16px;
}

.export-popup__title {
    font-weight: 600;
    font-size: 18px;
    color: #333;
    margin-bottom: 8px;
}

.export-popup__text {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
}

.export-popup__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.export-popup__link:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.export-popup__close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color 0.2s;
}

/* ========================
   Watermark Container
   ======================== */
.watermark-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 50px;
    align-items: start;
}

.watermark-container.has-files {
    grid-template-columns: repeat(2, 1fr);
}

.watermark-container .left-panel {
    display: none;
    flex-direction: column;
    gap: 20px;
}

.watermark-container .left-panel.active {
    display: flex;
}

.watermark-container .right-panel {
    height: fit-content;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.download-all-btn {
    margin-top: auto !important;
    width: 100%;
    padding: 16px 24px;
    background: #7B68EE;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.download-all-btn:hover {
    background: #6a5acd;
}

.panel-title {
    font-size: 20px;
}

.tools__panel-wrap {
    display: flex;
    flex-direction: column;
    gap: 24px;
    justify-content: space-between;
}

/* Preview item for watermark files */
.preview__item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8f5ff;
    border-radius: 12px;
    margin-bottom: 8px;
}

.preview__item:last-child {
    margin-bottom: 0;
}

/* Reset button for watermark files */
.preview__reset-btn {
    margin-left: auto;
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #999;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: 10px;
    top: 10px;
}

.preview__reset-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #e74c3c;
}

/* Auto-download notification */
.auto-download-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 12px;
}

.auto-download-notice__text {
    flex: 1;
    font-size: 14px;
    color: #2e7d32;
    line-height: 1.4;
}

.auto-download-notice__close {
    background: transparent;
    border: none;
    font-size: 20px;
    color: #2e7d32;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.auto-download-notice__close:hover {
    opacity: 1;
}

/* Type tabs */
.tools__tabs {
    display: flex;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 20px;
}

.tools__tabs-item {
    flex: 1;
    padding: 12px 16px;
    background: white;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.tools__tabs-item:first-child {
    border-right: 1px solid #e0e0e0;
}

.tools__tabs-item.active {
    background: #7b68ee;
    color: white;
}

.tools__tabs-item:hover:not(.active) {
    background: #f5f5f5;
    color: #666;
}

/* ========================
   Slide Preview (Watermark)
   ======================== */
.tools__preview {
    display: flex;
}

.tools__preview-container {
    background: #7b68ee;
    border-radius: 12px;
    padding: 10px;
    position: relative;
    overflow: hidden;
    align-self: center;
    width: 100%;
}

.tools__preview-slide {
    background: #7b68ee;
    border-radius: 8px;
    aspect-ratio: 16/9;
    position: relative;
    overflow: hidden;
}

.preview-slide__content {
    position: relative;
}

.preview-slide__content img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Draggable Watermark */
.watermark-preview {
    position: absolute;
    cursor: move;
    user-select: none;
    transform-origin: center center;
    padding: 8px 16px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: auto;
}

.watermark-preview.dragging {
    opacity: 0.8;
}

.watermark-preview--image {
    padding: 0;
}

.watermark-preview--image img {
    display: block;
}

/* Preview Loading Spinner */
.preview-spinner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.preview-spinner__circle {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ========================
   Watermark Settings
   ======================== */
.setting-group {
    margin-bottom: 16px;
}

.setting-label {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
    display: block;
}

.setting-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.setting-input:focus {
    outline: none;
    border-color: #7B68EE;
}

.setting-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.setting-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.setting-select:focus {
    outline: none;
    border-color: #7B68EE;
}

/* Number input */
.number-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.number-input {
    width: 100%;
    padding: 10px 40px 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    -moz-appearance: textfield;
}

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

.number-input:focus {
    outline: none;
    border-color: #7B68EE;
}

.number-input__controls {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.number-input__btn {
    width: 24px;
    height: 16px;
    padding: 0;
    border: none;
    background: #f5f5f5;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.15s;
}

.number-input__btn:hover {
    background: #e8e8e8;
    color: #333;
}

/* ========================
   Color Picker
   ======================== */
.color-trans-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.color-picker-custom {
    position: relative;
}

.color-picker-custom__trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.color-picker-custom__trigger:hover,
.color-picker-custom__trigger.open,
.color-picker-custom__trigger:focus {
    border-color: #7B68EE;
    background-color: transparent;
}

.color-picker-custom__swatch {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: #ff0000;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1) inset;
    flex-shrink: 0;
}

.color-picker-custom__value {
    font-size: 13px;
    font-weight: 500;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex: 1;
}

.color-picker-custom__arrow {
    color: #888;
    transition: transform 0.2s;
}

.color-picker-custom__trigger.open .color-picker-custom__arrow {
    transform: rotate(180deg);
}

.color-picker-custom__dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 220px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 12px;
    z-index: 100;
    display: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.color-picker-custom__dropdown.open {
    display: block;
}

.cp-saturation {
    position: relative;
    width: 100%;
    height: 120px;
    border-radius: 6px;
    cursor: crosshair;
    margin-bottom: 12px;
    overflow: hidden;
}

.cp-saturation__white {
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, #fff, transparent);
}

.cp-saturation__black {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, #000, transparent);
}

.cp-saturation__cursor {
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.cp-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.cp-preview {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1) inset, 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.cp-hue {
    flex: 1;
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(to right, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
    position: relative;
    cursor: pointer;
}

.cp-hue__cursor {
    position: absolute;
    top: 50%;
    width: 16px;
    height: 16px;
    background: white;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.cp-hex-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.cp-hex-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    font-family: monospace;
    text-transform: uppercase;
    text-align: center;
    max-width: 90% !important;
}

.cp-hex-input:focus {
    outline: none;
    border-color: #7B68EE;
}

.cp-hex-label {
    font-size: 11px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
}

.cp-hex-arrows {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cp-hex-arrow {
    width: 20px;
    height: 14px;
    padding: 0;
    border: 1px solid #e0e0e0;
    background: #f8f8f8;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
}

.cp-hex-arrow:hover {
    background: #f0f0f0;
}

/* ========================
   Sliders (Watermark)
   ======================== */
.trans-slider-wrap,
.rotation-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.trans-slider,
.rotation-slider {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0 !important;
    padding: 0 !important;
}

.trans-slider::-webkit-slider-thumb,
.rotation-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #7B68EE;
    cursor: pointer;
}

.trans-value,
.rotation-value {
    font-size: 13px;
    color: #666;
    min-width: 35px;
    text-align: right;
}

/* ========================
   Image Upload Zone (Watermark)
   ======================== */
.image-upload-zone {
    border: 2px dashed #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    display: none;
    align-items: center;
    justify-content: center;
}

.image-upload-zone label {
    height: 100px;
}

.image-upload-zone svg {
    width: 40px;
    height: 40px;
}

.image-upload-zone.active {
    display: flex;
}

.image-upload-zone:hover {
    border-color: #7B68EE;
    background: #faf8ff;
}

.image-upload-zone__preview {
    display: none;
}

.image-upload-zone__preview.active {
    display: block;
}

.image-upload-zone__preview img {
    max-width: 100%;
    max-height: 80px;
    border-radius: 4px;
}

.image-upload-zone__text {
    font-size: 13px;
    color: #888;
}

.image-upload-zone__text span {
    color: #7B68EE;
    font-weight: 500;
}

/* ========================
   Btn Loader (Watermark action button)
   ======================== */
.btn-loader {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.download-all-btn.loading .btn-loader {
    display: block;
}

.download-all-btn.loading .btn-text {
    display: none;
}

/* Error (Watermark) */
.error-msg {
    color: #dc2626;
    font-size: 13px;
    margin-top: 8px;
    display: none;
}

/* Settings visibility */
.text-settings.hidden {
    display: none;
}

.image-settings {
    display: none;
}

.image-settings.active {
    display: block;
}

/* ========================
   Translator
   ======================== */
.language-section {
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
}

.swap-button {
    cursor: pointer;
}

.swap-button svg {
    width: 24px;
}

.swap-button svg path,
.preview__remove svg path {
    fill: var(--global-palette-btn-bg);
}

.preview__remove {
    position: absolute;
    top: 26px;
    right: 29px;
}

.translate-button {
    width: 100%;
}

.preview.active {
    display: block;
}

.preview.active .language-section {
    display: flex;
}

.language-select {
    border-radius: 10px;
}

.site-header-section-right .site-header-item {
    display: flex;
    justify-content: flex-end;
}

/* ========================
   Quiz
   ======================== */
.quiz-topic-group {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.quiz-topic-group__header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.quiz-topic-group__checkbox {
    width: 18px;
    height: 18px;
    accent-color: #7B68EE;
    cursor: pointer;
}

.quiz-topic-group__title {
    font-weight: 600;
    font-size: 16px;
    color: #374151;
}

.quiz-question-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
}

.quiz-question-item__checkbox {
    width: 16px;
    height: 16px;
    accent-color: #7B68EE;
    cursor: pointer;
    margin-top: 2px;
    flex-shrink: 0;
}

.quiz-question-item__text {
    font-size: 14px;
    color: #4b5563;
    line-height: 1.5;
}

/* Progress Dots */
.quiz-progress-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e5e7eb;
    transition: all 0.2s;
}

.quiz-progress-dot.active {
    background: #7B68EE;
    box-shadow: 0 0 0 3px rgba(123, 104, 238, 0.2);
}

.quiz-progress-dot.correct {
    background: #2BAC76;
}

.quiz-progress-dot.incorrect {
    background: #ef4444;
}

/* Quiz Options */
.quiz-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}

.quiz-option:hover:not(.disabled) {
    border-color: #c7d2fe;
    background: #f5f3ff;
}

.quiz-option.disabled {
    cursor: default;
}

.quiz-option.correct {
    border-color: #2BAC76;
    background: #f0fdf4;
}

.quiz-option.incorrect {
    border-color: #ef4444;
    background: #fef2f2;
}

.quiz-option__letter {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #374151;
}

.quiz-option.correct .quiz-option__letter {
    background: #2BAC76;
    color: white;
}

.quiz-option.incorrect .quiz-option__letter {
    background: #ef4444;
    color: white;
}

.quiz-option__text {
    font-size: 15px;
    color: #374151;
    line-height: 1.5;
}

/* ========================
   Responsive
   ======================== */
@media (max-width: 1280px) {
    .tools__panel-wrap {
        flex-direction: column;
        gap: 10px;
    }

    .right-panel {
        height: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 1024px) {
    .watermark-container {
        grid-template-columns: 1fr;
    }

    .watermark-container .right-panel {
        position: static;
    }

    [data-tool^="watermark"] .upload {
        max-width: 100%;
    }
}

@media (max-width: 767px) {
    .upload {
        max-width: 100%;
    }

    .tools__tabs {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .preview__action,
    .success__buttons {
        flex-direction: column;
    }

    .setting-row,
    .color-trans-row {
        display: flex;
        flex-direction: column;
    }
}

/* ========================
   State & Utility Classes
   ======================== */

/* --- Error message (unified across file-upload tools) --- */
.tool-error {
    color: #dc2626;
    font-size: 13px;
    margin-top: 12px;
    display: none;
    text-align: center;
}

.tool-error.is-active {
    display: block;
}

/* --- Button loading state --- */
.tool-btn--loading {
    pointer-events: none;
    opacity: 0.7;
}

.tool-btn--loading .btn-text {
    display: none;
}

.tool-btn--loading .btn-loader {
    display: block;
}

/* --- Translate button loader --- */
.translate-button .btn-loader {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

.translate-button.tool-btn--loading .btn-loader {
    display: inline-block;
}

.translate-button.tool-btn--loading .btn-text {
    display: none;
}

/* --- GSlides radio button --- */
.gslides-radio {
    flex-shrink: 0;
    position: relative;
    cursor: pointer;
    margin-right: 8px;
}

.gslides-radio input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.gslides-radio__dot {
    display: block;
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.gslides-radio__dot.is-selected {
    border-color: #7B68EE;
    background: #7B68EE;
    box-shadow: inset 0 0 0 3px #fff;
}

/* --- GSlides file item (selected state) --- */
.preview__inner.is-selected {
    box-shadow: inset 0 0 0 2px #7B68EE;
    background: #f5f0ff;
}

/* --- GSlides remove button --- */
.gslides-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    width: auto;
}

.gslides-remove:hover {
    color: #e74c3c;
    background: rgba(0, 0, 0, 0.05);
}

/* --- Merge file items --- */
.preview__inner[data-clone] {
    position: relative;
    cursor: grab;
}

.preview__inner.dragging {
    opacity: 0.4;
}

.preview__inner.drop-indicator-before {
    border-top: 2px solid #7B68EE;
}

.preview__inner.drop-indicator-after {
    border-bottom: 2px solid #7B68EE;
}

/* --- Watermark helpers --- */
.preview-helper-text {
    font-size: 12px;
    color: #888;
    margin-top: 8px;
}

.icon-mb {
    margin-bottom: 8px;
}

.clickable-block {
    cursor: pointer;
    display: block;
}

/* --- GSlides results in success section --- */
.gslides-results {
    max-height: 200px;
    overflow-y: auto;
    margin: 16px 0;
    text-align: left;
}

.gslides-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.gslides-result-item--success {
    background: #f0fdf4;
}

.gslides-result-item--error {
    background: #fef2f2;
}

.gslides-result-item__status--success {
    color: #22c55e;
}

.gslides-result-item__status--error {
    color: #dc2626;
}

.gslides-result-item__content {
    flex: 1;
    min-width: 0;
}

.gslides-result-item__title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gslides-result-item__link {
    font-size: 13px;
    color: #7B68EE;
    text-decoration: none;
}

.gslides-result-item__error-text {
    font-size: 12px;
    color: #dc2626;
}

.gslides-result-item__badge {
    background: #dcfce7;
    color: #166534;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
}

/* --- Spinner for generate button --- */
.spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.button.loading .spinner {
    display: inline-block;
}

.button.loading .btn-text {
    display: none;
}
