/* ===== LAYOUT ===== */

.rbg-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(80% 100% at 0% 0%, rgba(59, 130, 246, 0.08), transparent 60%),
        radial-gradient(70% 90% at 100% 100%, rgba(16, 185, 129, 0.1), transparent 60%),
        var(--rbg-bg);
}

.rbg-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.25rem;
}

/* Header */

.rbg-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(248, 250, 252, 0.9);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.rbg-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.rbg-logo {
    font-weight: 800;
    font-size: 1.3rem;
    letter-spacing: 0.03em;
    color: #0f172a;
}

.rbg-logo span {
    color: var(--rbg-primary);
}

.rbg-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.rbg-nav-link {
    font-size: 0.9rem;
    text-decoration: none;
    color: #475569;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.rbg-nav-link:hover {
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    transform: translateY(-1px);
}

/* Hero */

.rbg-hero {
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
}

.rbg-wrap-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.1fr);
    gap: 2rem;
    align-items: center;
}

.rbg-hero-title {
    font-size: clamp(2.1rem, 4vw, 2.7rem);
    line-height: 1.1;
    margin: 0;
}

.rbg-hero-title strong {
    color: #0f172a;
}

.rbg-hero-sub {
    margin-top: 0.75rem;
    font-size: 0.95rem;
    color: var(--rbg-muted);
    max-width: 34rem;
}

.rbg-hero-list {
    margin: 1.25rem 0 0;
    padding: 0;
    list-style: none;
    font-size: 0.9rem;
    color: #4b5563;
}

.rbg-hero-list li+li {
    margin-top: 0.3rem;
}

/* Tool Card */

.rbg-wrap-form {
    background: #ffffff;
    border-radius: var(--rbg-radius-lg);
    padding: 1.25rem;
    box-shadow: var(--rbg-shadow-soft);
    border: 1px solid rgba(148, 163, 184, 0.15);
}

/* ===== TOOLBAR (iOS switches) ===== */

.rbg-toolbar {
    position: relative;
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.02);
    border: 1px solid rgba(148, 163, 184, 0.35);
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1rem;
    align-items: center;
}

.rbg-toolbar-label {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 600;
}

/* iOS liquid glass switches */
.ios-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.85rem;
}

.ios-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Track */
.ios-toggle .track {
    --glass-bg: rgba(255, 255, 255, 0.18);
    --glass-br: rgba(255, 255, 255, 0.35);
    --glow: rgba(30, 215, 96, 0.25);
    position: relative;
    width: 54px;
    height: 30px;
    border-radius: 999px;
    background: linear-gradient(180deg,
            rgba(255, 255, 255, 0.28),
            rgba(255, 255, 255, 0.18));
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.35),
        inset 0 -1px 0 rgba(0, 0, 0, 0.06),
        0 8px 24px rgba(31, 38, 135, 0.18);
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
}

/* liquid highlight */
.ios-toggle .track::before {
    content: '';
    position: absolute;
    inset: -40%;
    background: radial-gradient(120px 80px at var(--lx, 20%) var(--ly, 30%),
            rgba(255, 255, 255, 0.45),
            transparent 60%);
    filter: blur(14px);
    transition: transform 0.35s ease;
    pointer-events: none;
}

/* knob */
.ios-toggle .track::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background:
        radial-gradient(60% 60% at 30% 30%,
            rgba(255, 255, 255, 0.9),
            rgba(255, 255, 255, 0.75) 60%,
            rgba(255, 255, 255, 0.6) 100%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(240, 240, 240, 0.85));
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.65);
    transition:
        transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
        box-shadow 0.2s ease;
}

/* ON state */
.ios-toggle input[type='radio']:checked+.track {
    border-color: rgba(30, 215, 96, 0.55);
    background: linear-gradient(135deg,
            rgba(46, 213, 115, 0.65),
            rgba(30, 215, 96, 0.56));
    box-shadow:
        0 0 0 5px rgba(30, 215, 96, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.35),
        inset 0 -1px 0 rgba(0, 0, 0, 0.06);
}

.ios-toggle input[type='radio']:checked+.track::after {
    transform: translateX(24px);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.22),
        0 0 0 6px rgba(30, 215, 96, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.65);
    animation: knob-pop 0.22s ease-out;
}

/* micro-bounce */
@keyframes knob-pop {
    0% {
        transform: translateX(0) scale(1);
    }

    60% {
        transform: translateX(24px) scale(1.06);
    }

    100% {
        transform: translateX(24px) scale(1);
    }
}

.ios-toggle .txt {
    font-size: 0.85rem;
    color: #243447;
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {

    .ios-toggle .track::before,
    .ios-toggle .track::after {
        transition: none;
        animation: none;
    }
}

/* ===== DROPZONE ===== */

.dropzone {
    border: 1.5px dashed #cbd5e1;
    border-radius: 14px;
    padding: 18px;
    background: #f9fafb;
    margin-top: 1rem;
}

.dz-inner {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dz-text {
    text-align: center;
    color: #6b7280;
}

.dz-or {
    display: block;
    margin-top: 0.75rem;
}

.dz-hint {
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: #9ca3af;
}

.dz-text.hidden {
    display: none;
}

/* Buttons */

.btn-primary {
    background: var(--rbg-primary);
    color: #fff;
    border: none;
    padding: 0.6rem 0.9rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    cursor: pointer;
    transition:
        background 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.1s ease;
}

.btn-primary:hover {
    background: #1d4ed8;
    box-shadow: 0 12px 25px rgba(37, 99, 235, 0.25);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn-icon {
    height: 24px;
    width: 24px;
    flex-shrink: 0;
}

.btn-ghost {
    background: #f3f4f6;
    color: #111827;
    border: none;
    padding: 0.45rem 0.8rem;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-top: 0.4rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-ghost:hover {
    background: #e5e7eb;
}

/* Preview */

.dz-preview {
    margin-top: 0.5rem;
}

.dz-preview.hidden {
    display: none;
}

.dz-preview-box {
    display: flex;
    gap: 12px;
    align-items: center;
}

.dz-preview img {
    max-width: 138px;
    display: block;
    border-radius: 12px;
}

.dz-info {
    flex: 1;
    min-width: 0;
}

.dz-filename {
    font-size: 0.85rem;
    color: #374151;
    margin-bottom: 0.25rem;
    word-break: break-all;
}

/* Progress */

.rbg-progress {
    margin-top: 0.75rem;
}

.progress-wrap {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.progress {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.progress .bar {
    height: 100%;
    background: var(--rbg-success);
}

.progress-percent {
    font-size: 0.8rem;
    color: #4b5563;
    min-width: 2.2rem;
    text-align: right;
}

.rbg-status {
    margin-top: 0.3rem;
    font-size: 0.82rem;
    color: #6b7280;
}

/* ===== BEFORE / AFTER ===== */

.rbg-result {
    margin-top: 1rem;
}

.ba-card {
    border: 1px solid var(--rbg-border);
    border-radius: 16px;
    padding: 12px;
    background: #ffffff;
}

.ba-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.btn-download {
    background: var(--rbg-success);
    color: #fff;
    border: none;
    padding: 0.55rem 0.9rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition:
        background 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.1s ease;
}

.btn-download:hover {
    background: #059669;
    box-shadow: 0 12px 22px rgba(16, 185, 129, 0.35);
    transform: translateY(-1px);
}

.ba-box {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 12px;
    --pos: 50%;
    background: #f3f4f6;
}

/* checkerboard */
.ba-img-base {
    background:
        linear-gradient(45deg, #e5e5e5 25%, transparent 25%, transparent 75%, #e5e5e5 75%, #e5e5e5),
        linear-gradient(45deg, #e5e5e5 25%, transparent 25%, transparent 75%, #e5e5e5 75%, #e5e5e5);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}

.ba-img-base,
.ba-img-clip {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ba-img-clip {
    clip-path: polygon(0 0, var(--pos) 0, var(--pos) 100%, 0 100%);
}

.ba-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--pos);
    width: 2px;
    transform: translateX(-1px);
    background: rgba(0, 0, 0, 0.25);
}

.ba-handle {
    position: absolute;
    top: 50%;
    left: var(--pos);
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: rgba(17, 24, 39, 0.15);
    backdrop-filter: blur(8px) saturate(180%);
    -webkit-backdrop-filter: blur(8px) saturate(180%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    cursor: ew-resize;
    transition:
        background 0.2s ease,
        box-shadow 0.2s ease;
}

.ba-handle::before,
.ba-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 6px;
    height: 6px;
    border-top: 2px solid #fff;
    border-right: 2px solid #fff;
    transform-origin: center;
}

.ba-handle::before {
    left: 13px;
    transform: translateY(-50%) rotate(-135deg);
}

.ba-handle::after {
    right: 13px;
    transform: translateY(-50%) rotate(45deg);
}

.ba-handle:hover {
    background: rgba(17, 24, 39, 0.25);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.ba-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 6px;
}

/* ===== GENERIC ===== */
.hidden {
    display: none !important;
}

/* ===== SECTIONS BELOW TOOL ===== */

.rbg-section {
    padding: 2.5rem 0 2.5rem;
}

.rbg-section-alt {
    background: #f1f5f9;
}

.rbg-section-title {
    font-size: 1.4rem;
    margin: 0 0 1.4rem;
    text-align: center;
    color: #0f172a;
}

.rbg-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
}

.rbg-step {
    background: #ffffff;
    border-radius: 14px;
    padding: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.04);
}

.rbg-step-num {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.1);
    color: #1d4ed8;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.4rem;
    font-weight: 600;
}

.rbg-step h3 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
}

.rbg-step p {
    margin: 0;
    font-size: 0.9rem;
    color: #6b7280;
}

/* FAQ */

.rbg-faq {
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.rbg-faq-item {
    padding: 0.8rem 1rem;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.rbg-faq-item summary {
    cursor: pointer;
    list-style: none;
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
}

.rbg-faq-item summary::-webkit-details-marker {
    display: none;
}

.rbg-faq-item summary::after {
    content: '+';
    float: right;
    color: #64748b;
}

.rbg-faq-item[open] summary::after {
    content: '–';
}

.rbg-faq-item p {
    margin: 0.4rem 0 0;
    font-size: 0.9rem;
    color: #6b7280;
}

/* Footer */

.rbg-footer {
    margin-top: auto;
    padding: 1rem 0 1.25rem;
    border-top: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(248, 250, 252, 0.95);
}

.rbg-footer-inner {
    font-size: 0.85rem;
    color: #6b7280;
    text-align: center;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 900px) {
    .rbg-wrap-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .rbg-wrap-form {
        margin-top: 0.5rem;
    }

    .rbg-steps {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .rbg-header-inner {
        flex-direction: row;
    }

    .rbg-nav {
        gap: 0.5rem;
    }

    .rbg-hero {
        padding-top: 1.8rem;
    }

    .rbg-hero-title {
        font-size: 1.9rem;
        text-align: left;
    }

    .rbg-hero-sub,
    .rbg-hero-list {
        text-align: left;
    }

    .rbg-wrap-form {
        padding: 1rem;
    }

    .dz-preview-box {
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    .rbg-header-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .rbg-nav {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .rbg-hero-title {
        font-size: 1.7rem;
    }

    .rbg-hero-sub {
        font-size: 0.9rem;
    }

    .rbg-hero-list {
        font-size: 0.88rem;
    }

    .rbg-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .dropzone {
        padding: 14px;
    }

    .btn-primary {
        width: 100%;
    }

    .rbg-steps {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 420px) {
    .rbg-container {
        padding: 0.9rem;
    }

    .rbg-wrap-form {
        padding: 0.9rem;
    }

    .dz-preview img {
        max-width: 110px;
    }
}