/**
 * Creative Scroll to Top Button - Admin Styles
 * Tailwind-inspired design — no framework dependency.
 * Version: 1.2.0
 */

/* =============================================
   Design tokens (Tailwind-inspired)
   ============================================= */
:root {
    --csttb-color-primary:       #8b5cf6; /* violet-500 */
    --csttb-color-primary-hover: #7c3aed; /* violet-600 */
    --csttb-color-success:       #16a34a; /* green-600  */
    --csttb-color-success-hover: #15803d; /* green-700  */
    --csttb-color-warning:       #d97706; /* amber-600  */
    --csttb-color-surface:       #ffffff;
    --csttb-color-bg:            #f8fafc; /* slate-50   */
    --csttb-color-border:        #e2e8f0; /* slate-200  */
    --csttb-color-border-strong: #cbd5e1; /* slate-300  */
    --csttb-color-text:          #0f172a; /* slate-900  */
    --csttb-color-text-muted:    #64748b; /* slate-500  */
    --csttb-color-text-subtle:   #94a3b8; /* slate-400  */

    --csttb-radius-sm:  4px;
    --csttb-radius-md:  8px;
    --csttb-radius-lg:  12px;

    --csttb-shadow-sm:  0 1px 2px 0 rgba(0,0,0,.05);
    --csttb-shadow-md:  0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
}

/* =============================================
   Page heading
   ============================================= */
.wrap h1 sup {
    font-size: .6rem;
    font-weight: 500;
    color: var(--csttb-color-text-muted);
    background: var(--csttb-color-border);
    padding: 2px 6px;
    border-radius: 999px;
    vertical-align: middle;
    letter-spacing: 0;
}

/* =============================================
   Form tables — card style
   ============================================= */
.creative-scroll-to-top-button-settings-main .form-table {
    background: var(--csttb-color-surface);
    border: 1px solid var(--csttb-color-border);
    border-radius: var(--csttb-radius-lg);
    box-shadow: var(--csttb-shadow-md);
    overflow: hidden;
    margin-bottom: 24px;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.creative-scroll-to-top-button-settings-main .form-table th {
    padding: 16px 20px;
    font-size: .875rem;
    font-weight: 600;
    color: var(--csttb-color-text);
    background: var(--csttb-color-bg);
    border-bottom: 1px solid var(--csttb-color-border);
    width: 200px;
    vertical-align: top;
}

.creative-scroll-to-top-button-settings-main .form-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--csttb-color-border);
    vertical-align: top;
}

.creative-scroll-to-top-button-settings-main .form-table tr:last-child th,
.creative-scroll-to-top-button-settings-main .form-table tr:last-child td {
    border-bottom: none;
}

/* Inputs */
.creative-scroll-to-top-button-settings-main input[type="text"],
.creative-scroll-to-top-button-settings-main input[type="url"],
.creative-scroll-to-top-button-settings-main input[type="number"],
.creative-scroll-to-top-button-settings-main select,
.creative-scroll-to-top-button-settings-main textarea {
    border: 1px solid var(--csttb-color-border-strong);
    border-radius: var(--csttb-radius-md);
    padding: 8px 12px;
    font-size: .875rem;
    color: var(--csttb-color-text);
    background: var(--csttb-color-surface);
    box-shadow: var(--csttb-shadow-sm);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}

.creative-scroll-to-top-button-settings-main input[type="text"]:focus,
.creative-scroll-to-top-button-settings-main input[type="url"]:focus,
.creative-scroll-to-top-button-settings-main input[type="number"]:focus,
.creative-scroll-to-top-button-settings-main select:focus,
.creative-scroll-to-top-button-settings-main textarea:focus {
    border-color: var(--csttb-color-primary);
    box-shadow: 0 0 0 3px rgba(139,92,246,.15);
}

.creative-scroll-to-top-button-settings-main select {
    padding-right: 32px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
}

.creative-scroll-to-top-button-settings-main .description {
    font-size: .8125rem;
    color: var(--csttb-color-text-muted);
    margin-top: 6px;
    line-height: 1.5;
    font-style: normal;
}

/* Submit button */
.creative-scroll-to-top-button-settings-main .button-primary {
    background: var(--csttb-color-primary) !important;
    border-color: var(--csttb-color-primary) !important;
    border-radius: var(--csttb-radius-md) !important;
    padding: 8px 20px !important;
    font-size: .875rem !important;
    font-weight: 600 !important;
    box-shadow: var(--csttb-shadow-sm) !important;
    transition: background .15s, box-shadow .15s !important;
    height: auto !important;
    line-height: 1.5 !important;
}

.creative-scroll-to-top-button-settings-main .button-primary:hover {
    background: var(--csttb-color-primary-hover) !important;
    border-color: var(--csttb-color-primary-hover) !important;
    box-shadow: var(--csttb-shadow-md) !important;
}

/* Details/summary (Advanced Settings) */
.creative-scroll-to-top-button-settings-main details summary {
    cursor: pointer;
    font-size: .875rem;
    font-weight: 600;
    color: var(--csttb-color-text);
    padding: 12px 0;
    user-select: none;
}

/* =============================================
   Style Grid
   ============================================= */
.creative-scroll-to-top-button-style-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 10px;
    max-width: 100%;
}

.creative-scroll-to-top-button-style-option {
    border: 2px solid var(--csttb-color-border);
    border-radius: var(--csttb-radius-md);
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--csttb-color-bg);
    position: relative;
}

.creative-scroll-to-top-button-style-option:hover {
    border-color: var(--csttb-color-primary);
    box-shadow: 0 0 0 3px rgba(139,92,246,.1);
}

.creative-scroll-to-top-button-style-option.selected {
    border-color: var(--csttb-color-primary);
    background: #f5f3ff;
    box-shadow: 0 0 0 3px rgba(139,92,246,.15);
}

.creative-scroll-to-top-button-style-option input[type="radio"] {
    margin-bottom: 10px;
    transform: scale(1.2);
}

/* =============================================
   Style Previews
   ============================================= */
.creative-scroll-to-top-button-style-preview {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    position: relative;
    transition: all 0.3s ease;
}

.creative-scroll-to-top-button-preview-classic {
    background: linear-gradient(135deg, #8b5cf6, #f59e0b);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.creative-scroll-to-top-button-preview-progress {
    background: rgba(139, 92, 246, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.2);
    position: relative;
}

.creative-scroll-to-top-button-preview-rocket {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    animation: admin-rocket-float 2s ease-in-out infinite;
}

@keyframes admin-rocket-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.creative-scroll-to-top-button-preview-bubble {
    background: rgba(139, 92, 246, 0.7);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.3);
    animation: admin-bubble-float 3s ease-in-out infinite;
}

@keyframes admin-bubble-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.creative-scroll-to-top-button-preview-minimal {
    background: rgba(139, 92, 246, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
    animation: admin-minimal-glow 2s ease-in-out infinite;
}

@keyframes admin-minimal-glow {
    0%, 100% { box-shadow: 0 0 15px rgba(139, 92, 246, 0.4); }
    50% { box-shadow: 0 0 25px rgba(139, 92, 246, 0.6); }
}

.creative-scroll-to-top-button-preview-cosmic {
    background: linear-gradient(135deg, #8b5cf6, #f59e0b);
    animation: admin-cosmic-pulse 2s ease-in-out infinite;
}

@keyframes admin-cosmic-pulse {
    0%, 100% { box-shadow: 0 0 15px rgba(139, 92, 246, 0.5); }
    50% { box-shadow: 0 0 25px rgba(245, 158, 11, 0.6); }
}

.creative-scroll-to-top-button-preview-holographic {
    background: linear-gradient(45deg, #06b6d4, #8b5cf6, #ec4899);
    animation: admin-holographic-shift 3s ease-in-out infinite;
}

@keyframes admin-holographic-shift {
    0%, 100% { filter: hue-rotate(0deg); }
    33% { filter: hue-rotate(120deg); }
    66% { filter: hue-rotate(240deg); }
}

.creative-scroll-to-top-button-preview-neon {
    background: #0f172a;
    border: 2px solid #06b6d4;
    color: #06b6d4;
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.5), inset 0 0 15px rgba(6, 182, 212, 0.1);
    animation: admin-neon-pulse 2s ease-in-out infinite;
}

@keyframes admin-neon-pulse {
    0%, 100% {
        box-shadow: 0 0 15px rgba(6, 182, 212, 0.5), inset 0 0 15px rgba(6, 182, 212, 0.1);
    }
    50% {
        box-shadow: 0 0 25px rgba(6, 182, 212, 0.8), inset 0 0 25px rgba(6, 182, 212, 0.2);
    }
}

.creative-scroll-to-top-button-preview-magic {
    background: linear-gradient(135deg, #8b5cf6, #ec4899, #f59e0b);
    animation: admin-magic-sparkle 3s ease-in-out infinite;
}

@keyframes admin-magic-sparkle {
    0%, 100% { transform: rotate(0deg); filter: brightness(1); }
    25% { transform: rotate(2deg); filter: brightness(1.2); }
    50% { transform: rotate(-1deg); filter: brightness(1.1); }
    75% { transform: rotate(1deg); filter: brightness(1.15); }
}

.creative-scroll-to-top-button-preview-liquid {
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    animation: admin-liquid-flow 2s ease-in-out infinite;
}

@keyframes admin-liquid-flow {
    0%, 100% { border-radius: 50%; }
    25% { border-radius: 60% 40% 60% 40%; }
    50% { border-radius: 40% 60% 40% 60%; }
    75% { border-radius: 60% 40% 60% 40%; }
}

.creative-scroll-to-top-button-preview-origami {
    background: linear-gradient(135deg, #f7f1e8, #e8dcc6);
    color: #8b4513;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    position: relative;
    overflow: hidden;
}

.creative-scroll-to-top-button-preview-origami::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: admin-origami-fold 3s linear infinite;
}

@keyframes admin-origami-fold {
    0% { left: -100%; }
    100% { left: 100%; }
}

.creative-scroll-to-top-button-preview-quantum {
    background: radial-gradient(circle, #1e1b4b, #312e81);
    border: 2px solid #8b5cf6;
    color: #8b5cf6;
    position: relative;
}

.creative-scroll-to-top-button-preview-quantum::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: #8b5cf6;
    border-radius: 50%;
    box-shadow:
        0 0 0 15px rgba(139, 92, 246, 0.1),
        0 0 0 30px rgba(139, 92, 246, 0.05);
    animation: admin-quantum-pulse 2s ease-in-out infinite;
}

@keyframes admin-quantum-pulse {
    0%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.7; transform: translate(-50%, -50%) scale(1.5); }
}

.creative-scroll-to-top-button-preview-morphing {
    background: linear-gradient(45deg, #ec4899, #8b5cf6);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.creative-scroll-to-top-button-style-option:hover .creative-scroll-to-top-button-preview-morphing {
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
    transform: rotate(45deg);
    background: linear-gradient(45deg, #8b5cf6, #3b82f6);
}

.creative-scroll-to-top-button-preview-flame {
    background: radial-gradient(circle at center, #f97316, #dc2626);
    color: #fef3c7;
    position: relative;
}

.creative-scroll-to-top-button-preview-flame::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background: radial-gradient(circle, rgba(249, 115, 22, 0.3), transparent 70%);
    border-radius: 50%;
    animation: admin-flame-flicker 1.5s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes admin-flame-flicker {
    0% { transform: scale(1) rotate(0deg); opacity: 0.7; }
    100% { transform: scale(1.1) rotate(2deg); opacity: 1; }
}

.creative-scroll-to-top-button-preview-crystal {
    background: linear-gradient(135deg,
        #ef4444,
        #f59e0b,
        #10b981,
        #06b6d4,
        #8b5cf6,
        #ec4899);
    background-size: 400% 400%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    clip-path: polygon(50% 0%, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
    animation: admin-crystal-rainbow 3s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

.creative-scroll-to-top-button-preview-crystal::before {
    content: '';
    position: absolute;
    top: -25%;
    left: -25%;
    width: 150%;
    height: 150%;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.6) 50%, transparent 70%);
    animation: admin-crystal-refraction 2s linear infinite;
}

@keyframes admin-crystal-rainbow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes admin-crystal-refraction {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.creative-scroll-to-top-button-preview-back-to-top {
    background: white;
    color: #e74c3c;
    border: 2px solid #e74c3c;
    border-radius: 25px;
    width: 60px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 10px;
}

.creative-scroll-to-top-button-style-option:hover .creative-scroll-to-top-button-preview-back-to-top {
    background: #e74c3c;
    color: white;
}

/* =============================================
   Color Picker
   ============================================= */
.creative-scroll-to-top-button-color-preview {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: var(--csttb-radius-sm);
    margin-left: 10px;
    vertical-align: middle;
    border: 1px solid var(--csttb-color-border);
    transition: all 0.2s ease;
}

input[type="color"] {
    width: 50px;
    height: 35px;
    border: 1px solid var(--csttb-color-border-strong);
    border-radius: var(--csttb-radius-sm);
    cursor: pointer;
    vertical-align: middle;
}

input[type="color"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(139,92,246,.15);
}

/* =============================================
   Range Slider
   ============================================= */
.creative-scroll-to-top-button-range-value {
    font-weight: 600;
    margin-left: 10px;
    color: var(--csttb-color-primary);
}

input[type="range"] {
    width: 300px;
    margin-right: 10px;
    accent-color: var(--csttb-color-primary);
}

/* =============================================
   Post Types Grid
   ============================================= */
.creative-scroll-to-top-button-post-types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.creative-scroll-to-top-button-post-types-grid label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--csttb-color-border);
    border-radius: var(--csttb-radius-md);
    background: var(--csttb-color-bg);
    transition: all 0.15s ease;
    cursor: pointer;
    font-size: .875rem;
}

.creative-scroll-to-top-button-post-types-grid label:hover {
    background: #f5f3ff;
    border-color: var(--csttb-color-primary);
}

/* =============================================
   Live Preview
   ============================================= */
.creative-scroll-to-top-button-live-preview-area {
    background: #f0f4f8;
    background-image:
        linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
        linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
        linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
    background-size: 14px 14px;
    background-position: 0 0, 0 7px, 7px -7px, -7px 0;
    border-radius: var(--csttb-radius-md);
    min-height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    margin-bottom: 10px;
    overflow: hidden;
}

#creative-scroll-to-top-button-preview-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

#creative-scroll-to-top-button-preview-container .creative-scroll-to-top-button-btn {
    cursor: default;
}

#creative-scroll-to-top-button-preview-container[data-size="small"] .creative-scroll-to-top-button-btn,
#creative-scroll-to-top-button-preview-container[data-size="small"] .creative-scroll-to-top-button-progress {
    width: 2.5rem !important;
    height: 2.5rem !important;
}
#creative-scroll-to-top-button-preview-container[data-size="large"] .creative-scroll-to-top-button-btn,
#creative-scroll-to-top-button-preview-container[data-size="large"] .creative-scroll-to-top-button-progress {
    width: 4.5rem !important;
    height: 4.5rem !important;
}

/* =============================================
   Icon Picker
   ============================================= */
.creative-scroll-to-top-button-icon-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.creative-scroll-to-top-button-icon-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 8px 6px 6px;
    border: 2px solid var(--csttb-color-border);
    border-radius: var(--csttb-radius-md);
    cursor: pointer;
    background: var(--csttb-color-surface);
    width: 74px;
    text-align: center;
    transition: border-color 0.15s, background 0.15s;
}

.creative-scroll-to-top-button-icon-option:hover {
    border-color: var(--csttb-color-primary);
    background: #f5f3ff;
}

.creative-scroll-to-top-button-icon-option.selected {
    border-color: var(--csttb-color-primary);
    background: #f3f0ff;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.creative-scroll-to-top-button-icon-preview-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f1f0ff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--csttb-color-primary);
    flex-shrink: 0;
}

.creative-scroll-to-top-button-icon-preview-circle svg {
    display: block;
}

.creative-scroll-to-top-button-icon-label {
    font-size: 11px;
    font-weight: 600;
    color: #444;
    line-height: 1.3;
}

.creative-scroll-to-top-button-icon-note {
    font-size: 10px;
    color: #999;
    line-height: 1.2;
}

/* =============================================
   Field validation
   ============================================= */
.creative-scroll-to-top-button-field-error {
    border-color: #d63638 !important;
    box-shadow: 0 0 0 1px #d63638 !important;
}

.creative-scroll-to-top-button-field-error-msg {
    color: #d63638;
    font-style: normal !important;
    margin-top: 6px !important;
    font-size: 13px;
}

/* =============================================
   Accessibility
   ============================================= */
.creative-scroll-to-top-button-style-option:focus-within {
    outline: 2px solid var(--csttb-color-primary);
    outline-offset: 2px;
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 782px) {
    .creative-scroll-to-top-button-style-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .creative-scroll-to-top-button-post-types-grid {
        grid-template-columns: 1fr;
    }

    .creative-scroll-to-top-button-settings-main .form-table th {
        width: 160px;
        padding: 12px 14px;
    }

    .creative-scroll-to-top-button-settings-main .form-table td {
        padding: 12px 14px;
    }

    .creative-scroll-to-top-button-settings-main input[type="text"],
    .creative-scroll-to-top-button-settings-main input[type="url"],
    .creative-scroll-to-top-button-settings-main input[type="number"],
    .creative-scroll-to-top-button-settings-main select,
    .creative-scroll-to-top-button-settings-main textarea,
    .creative-scroll-to-top-button-settings-main .regular-text,
    .creative-scroll-to-top-button-settings-main .large-text {
        width: 100% !important;
        max-width: 100%;
        box-sizing: border-box;
    }

    input[type="range"] {
        width: 100%;
        max-width: 250px;
    }
}

@media (max-width: 600px) {
    .creative-scroll-to-top-button-settings-main .form-table {
        border-radius: var(--csttb-radius-md);
    }

    .creative-scroll-to-top-button-settings-main .form-table tr {
        display: flex;
        flex-direction: column;
    }

    .creative-scroll-to-top-button-settings-main .form-table th {
        width: 100%;
        border-bottom: none;
        padding: 12px 14px 6px;
    }

    .creative-scroll-to-top-button-settings-main .form-table td {
        width: 100%;
        padding: 6px 14px 14px;
    }

    .creative-scroll-to-top-button-settings-main .form-table tr:last-child td {
        border-bottom: none;
    }
}

@media (max-width: 480px) {
    .creative-scroll-to-top-button-style-grid {
        grid-template-columns: 1fr;
    }

    .creative-scroll-to-top-button-style-option {
        padding: 10px;
    }

    .creative-scroll-to-top-button-style-preview {
        width: 40px;
        height: 40px;
    }
}

/* =============================================
   Reduced Motion
   ============================================= */
@media (prefers-reduced-motion: reduce) {
    .creative-scroll-to-top-button-style-preview,
    .creative-scroll-to-top-button-preview-demo {
        animation: none !important;
    }
}
