/* ============================================
   MARQUEE WIDGET FOR NOTION
   ============================================ */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* ============================================
   SETTINGS BUTTON
   ============================================ */

.settings-btn {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.08),
        0 1px 2px rgba(0, 0, 0, 0.04);
}

body:hover .settings-btn {
    opacity: 1;
}

.settings-btn:hover {
    background: #ffffff;
    color: #374151;
    transform: rotate(45deg);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.12),
        0 2px 4px rgba(0, 0, 0, 0.08);
}

.settings-btn:active {
    transform: rotate(45deg) scale(0.95);
}

.settings-btn svg {
    width: 22px;
    height: 22px;
}

/* ============================================
   MARQUEE STYLES
   ============================================ */

#marquee {
    width: 100%;
    overflow: hidden;
    background: var(--marquee-bg, #ffffff);
    border-radius: var(--border-radius, 20px);
}

#marquee-content {
    display: flex;
    align-items: center;
    gap: var(--gap, 40px);
    width: max-content;
    padding: 12px 0;
    font-family: var(--font-family, 'Roboto'), sans-serif;
    font-size: var(--font-size, 40px);
    color: var(--font-color, #000000);
    user-select: none;
    animation: scroll var(--animation-duration, 10s) linear infinite;
    animation-direction: var(--animation-direction, normal);
}

#marquee-content span {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 0 20px;
}

#marquee-content.paused {
    animation-play-state: paused;
}

#marquee.slow-on-hover:hover #marquee-content {
    animation-duration: calc(var(--animation-duration) * 4);
}

@keyframes scroll {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%);
    }
}

/* ============================================
   MODAL STYLES
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 20px;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: #ffffff;
    border-radius: 20px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 10px 30px rgba(0, 0, 0, 0.2);
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.show .modal-container {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(to bottom, #fafbfc 0%, #ffffff 100%);
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    letter-spacing: -0.02em;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #6b7280;
}

.modal-close:hover {
    background: #e5e7eb;
    transform: rotate(90deg);
    color: #1f2937;
}

.modal-body {
    padding: 28px;
    overflow-y: auto;
    max-height: calc(90vh - 84px);
}

/* ============================================
   CONFIG SECTIONS
   ============================================ */

.config-section {
    margin-bottom: 28px;
    padding-bottom: 28px;
    border-bottom: 1px solid #e5e7eb;
}

.config-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.config-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-description {
    font-size: 13px;
    color: #6b7280;
    margin-top: -8px;
    margin-bottom: 16px;
}

.config-item {
    margin-bottom: 18px;
}

.config-item:last-child {
    margin-bottom: 0;
}

.config-item label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 10px;
}

/* Text Input */
.text-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    color: #1f2937;
    background: #ffffff;
    transition: all 0.2s ease;
}

.text-input:hover {
    border-color: #d1d5db;
}

.text-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Font Select */
.font-select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    color: #1f2937;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' 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;
    background-size: 18px;
    padding-right: 44px;
}

.font-select:hover {
    border-color: #d1d5db;
}

.font-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Range Inputs */
input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #e5e7eb 0%, #e5e7eb 100%);
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    cursor: pointer;
    box-shadow:
        0 2px 8px rgba(99, 102, 241, 0.4),
        0 1px 3px rgba(0, 0, 0, 0.1);
    border: 3px solid #ffffff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow:
        0 4px 12px rgba(99, 102, 241, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.15);
}

input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    cursor: pointer;
    border: 3px solid #ffffff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

/* Color Inputs */
.color-input-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

input[type="color"] {
    width: 54px;
    height: 48px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    padding: 4px;
    background: #ffffff;
    transition: border-color 0.2s ease;
}

input[type="color"]:hover {
    border-color: #d1d5db;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 8px;
}

.color-text {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    color: #1f2937;
    background: #ffffff;
    transition: all 0.2s ease;
}

.color-text:hover {
    border-color: #d1d5db;
}

.color-text:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Checkbox Toggle */
.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    transition: all 0.2s ease;
}

.checkbox-label:hover {
    border-color: #d1d5db;
    background: #f9fafb;
}

.checkbox-label:has(input:checked) {
    border-color: #6366f1;
    background: #f0f0ff;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #6366f1;
    border-radius: 4px;
}

.checkbox-label span {
    font-size: 15px;
    font-weight: 500;
    color: #374151;
}

/* Direction Buttons */
.direction-buttons {
    display: flex;
    gap: 12px;
}

.direction-btn {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    font-size: 15px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
}

.direction-btn:hover {
    border-color: #6366f1;
    background: #f9fafb;
}

.direction-btn.active {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Conditional Options */
.border-options,
.gradient-options {
    display: none;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed #e5e7eb;
}

.border-options.show,
.gradient-options.show {
    display: block;
}

/* ============================================
   THEME PRESET CARDS
   ============================================ */

.preset-cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.preset-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px 8px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-card:hover {
    border-color: #6366f1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.preset-card-preview {
    display: block;
    width: 100%;
    height: 36px;
    border-radius: 8px;
    border: 2px solid transparent;
}

.preset-card-name {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
}

/* ============================================
   BACKGROUND PRESETS
   ============================================ */

.bg-presets {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.bg-preset {
    aspect-ratio: 1;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 4px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bg-preset:hover {
    border-color: #d1d5db;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.bg-preset.active {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.preset-preview {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

.preset-preview.default-gradient {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.preset-preview.transparent-bg {
    background:
        repeating-conic-gradient(#e5e7eb 0% 25%, #ffffff 0% 50%)
        50% / 10px 10px;
}

/* Custom Color Section */
.custom-color-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.custom-color-label {
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 12px;
    display: block;
}

.custom-color-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.custom-color-picker {
    width: 54px;
    height: 48px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    padding: 4px;
    background: #ffffff;
}

.custom-color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.custom-color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 8px;
}

.custom-color-text {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    color: #1f2937;
    background: #ffffff;
    transition: all 0.2s ease;
}

.custom-color-text:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.apply-custom-btn {
    padding: 14px 20px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.apply-custom-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.apply-custom-btn:active {
    transform: translateY(0);
}

/* ============================================
   URL SECTION
   ============================================ */

.url-section {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    margin: 0 -28px -28px;
    padding: 24px 28px !important;
    border-radius: 0 0 20px 20px;
    border-bottom: none !important;
    border-top: 1px solid #e5e7eb;
}

.url-container {
    display: flex;
    gap: 10px;
}

.url-input {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 13px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    color: #374151;
    background: #ffffff;
    transition: all 0.2s ease;
}

.url-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.copy-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.copy-btn svg {
    width: 18px;
    height: 18px;
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.copy-btn:active {
    transform: translateY(0);
}

.copy-feedback {
    margin-top: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.3s ease;
}

.copy-feedback.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ============================================
   INSTRUCTIONS
   ============================================ */

.instructions-section {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    margin: 24px -28px -28px;
    padding: 24px 28px !important;
    border-radius: 0 0 20px 20px;
    border-bottom: none !important;
}

.instructions-section h3 {
    color: #1e40af;
}

.instructions-list {
    padding-left: 24px;
    margin: 0;
}

.instructions-list li {
    font-size: 14px;
    color: #3b82f6;
    margin-bottom: 10px;
    line-height: 1.6;
}

.instructions-list li:last-child {
    margin-bottom: 0;
}

.instructions-list code {
    background: #ffffff;
    padding: 3px 8px;
    border-radius: 6px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    color: #4f46e5;
    border: 1px solid #c7d2fe;
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        max-height: 95vh;
        border-radius: 16px;
    }

    .modal-header {
        padding: 20px;
    }

    .modal-body {
        padding: 20px;
    }

    .url-section {
        margin-left: -20px;
        margin-right: -20px;
        padding: 20px !important;
    }

    .instructions-section {
        margin-left: -20px;
        margin-right: -20px;
        padding: 20px !important;
    }

    .preset-cards {
        grid-template-columns: repeat(5, 1fr);
    }

    .bg-presets {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }

    .direction-buttons {
        gap: 8px;
    }

    .direction-btn {
        padding: 12px 16px;
        font-size: 14px;
    }

    .custom-color-input-group {
        flex-wrap: wrap;
    }

    .custom-color-picker {
        width: 48px;
        height: 44px;
    }

    .custom-color-text {
        flex: 1;
        min-width: 120px;
    }

    .apply-custom-btn {
        width: 100%;
        margin-top: 8px;
    }
}

@media (max-width: 400px) {
    .bg-presets {
        grid-template-columns: repeat(3, 1fr);
    }

    .url-container {
        flex-direction: column;
    }

    .copy-btn {
        justify-content: center;
    }
}
