:root {
    --bg-dark: #0f172a;
    --primary-glow: #8b5cf6;
    --secondary-glow: #3b82f6;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --accent: #a855f7;
}

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

body {
    background-color: var(--bg-dark);
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(59, 130, 246, 0.15) 0%, transparent 40%);
}

.container {
    width: 100%;
    max-width: 1000px;
    padding: 2rem;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-family: 'Cinzel', serif;
    font-size: 3rem;
    background: linear-gradient(to right, #c084fc, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(139, 92, 246, 0.3);
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    letter-spacing: 1px;
}

/* Glass Panels */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* Tabs */
.tabs {
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    gap: 1rem;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: white;
    border-bottom-color: var(--accent);
}

.tab-btn:hover {
    color: white;
}

/* Inputs */
.input-content {
    margin-bottom: 0;
}

.url-input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.input-icon {
    margin-left: 1rem;
    color: var(--accent);
}

input[type="text"],
textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.1rem;
    padding: 0.8rem;
    outline: none;
    font-family: 'Inter', sans-serif;
}

textarea {
    resize: vertical;
    margin-top: 0.5rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    width: 100%;
    border: 1px solid var(--glass-border);
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-glow), var(--secondary-glow));
    border: none;
    color: white;
    padding: 1rem 2.5rem;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Cinzel', serif;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.6);
}

.btn-primary.glow-anim {
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
    }

    50% {
        box-shadow: 0 0 30px rgba(139, 92, 246, 0.8);
    }

    100% {
        box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
    }
}

.action-bar {
    display: flex;
    justify-content: flex-end;
}

/* Config */
.config-section h3 {
    margin-bottom: 1.25rem;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.config-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.8rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.config-card.selected {
    border-color: var(--accent);
    background: rgba(168, 85, 247, 0.1);
}

.config-card p {
    font-size: 0.8rem;
    color: rgba(148, 163, 184, 0.6);
}

.config-card.selected p {
    color: rgba(168, 85, 247, 0.8);
}


.controls-row {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 1rem;
    padding: 0 1rem;
}

.toggle-control {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Advanced Settings */
.advanced-toggle {
    text-align: center;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    margin-top: 1rem;
    padding: 0.5rem;
    border-top: 1px solid var(--glass-border);
}

.advanced-panel {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 1.5rem;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 100%;
    height: 40px;
    background: transparent;
    cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: 1px solid var(--glass-border);
    border-radius: 6px;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--accent);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Preview Area */
.preview-section {
    max-height: none;
    display: flex;
    flex-direction: column;
}

.preview-container {
    overflow-y: auto;
    overflow-x: auto;
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
}

.preview-deck {
    margin-bottom: 2rem;
}

.preview-deck h4 {
    color: white;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
}

.preview-batch-label {
    color: var(--accent);
    font-size: 0.9rem;
    margin: 0.5rem 0;
    font-weight: bold;
}

.preview-grid-wrapper {
    display: flex;
    gap: 3rem;
    overflow-x: auto;
    padding-bottom: 2rem;
    justify-content: center;
    align-items: flex-start;
}

/* 
   Accurate Scale Representation - 2.5x
   Physical: 215.9mm x 279.4mm 
   Card: 63mm x 88mm
   Scale Factor: 2.5 pixels per mm
*/
.preview-page {
    position: relative;
    border: 1px solid var(--glass-border);
    background: white;
    width: 540px;
    height: 699px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
    display: block;
}

.preview-page.landscape {
    width: 699px;
    height: 540px;
}

.preview-page-grid {
    position: absolute;
    display: grid;
    grid-template-columns: repeat(3, 157.5px);
    grid-template-rows: repeat(3, 220px);
}

.preview-card-slot {
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 157.5px;
    height: 220px;
    border: none;
    border-radius: 7.5px;
    position: relative;
    transform: translateZ(0);
    z-index: 2;
}

.preview-card-img {
    width: 100%;
    height: 100%;
    object-fit: fill;
    display: block;
    border-radius: 7.5px;
}

.page-label {
    position: absolute;
    bottom: -25px;
    left: 0;
    width: 100%;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* New Loading Bar */
.loading-section {
    text-align: center;
    padding: 3rem;
}

.loading-wrapper {
    max-width: 500px;
    margin: 0 auto;
}

.loading-bar-bg {
    height: 30px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    border: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
    margin-bottom: 1rem;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5);
}

.loading-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--secondary-glow), var(--primary-glow), var(--accent));
    background-size: 200% 100%;
    animation: gradientMove 2s linear infinite;
    transition: width 0.3s ease;
}

@keyframes gradientMove {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

.loading-text {
    font-family: 'JetBrains Mono', monospace;
    color: white;
    text-shadow: 0 0 10px var(--primary-glow);
    font-size: 1.1rem;
}

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

.download-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1.5rem 0;
}

.download-btn {
    text-decoration: none;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    transition: all 0.2s;
}

.download-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--accent);
}

@media (max-width: 768px) {
    .config-grid {
        grid-template-columns: 1fr;
    }

    .advanced-panel {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 1rem;
    }
}

/* Add styling for the inline action button */
.btn-input-action {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    padding: 0 1rem;
    cursor: pointer;
    transition: all 0.2s;
    height: 100%;
    margin-right: 0.2rem;
    border-left: 1px solid var(--glass-border);
}

.btn-input-action:hover {
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent);
}

/* Right align action bar for batch */
.action-bar-right {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
}

/* Cut Lines Overlay */
.cut-lines-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.cut-line {
    position: absolute;
    background-color: #000;
}

/* Footer in Preview */
.preview-footer {
    position: absolute;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    font-family: 'Helvetica', sans-serif;
    font-size: 10px;
    color: rgba(0, 0, 0, 0.8);
    padding: 0 2px;
    box-sizing: border-box;
    font-weight: 300;
    letter-spacing: 0.5px;
    line-height: 1;
}

.footer-left {
    text-align: left;
}

.footer-right {
    text-align: right;
}

/* Monetization Footer */
.footer-monetize {
    margin-top: 3rem;
    margin-bottom: 2rem;
    padding: 1.5rem 2rem;
    transition: all 0.5s ease-in-out;
}

.footer-monetize-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.footer-monetize-text {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    max-width: 700px;
    font-style: italic;
    transition: color 0.5s ease-in-out;
}

.footer-monetize-actions {
    display: flex;
    align-items: center;
}

.btn-support {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1.6rem;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    font-family: 'Cinzel', serif;
    letter-spacing: 0.5px;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    transition: background 0.6s ease, color 0.6s ease, border-color 0.6s ease, box-shadow 0.6s ease, transform 0.6s ease;
}

/* Subtle (default/inactive) state */
.footer-monetize.subtle {
    opacity: 0.45;
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.05);
}

.footer-monetize.subtle .footer-monetize-text {
    color: rgba(148, 163, 184, 0.65);
    font-size: 0.9rem;
}

.kofi-btn {
    background: rgba(255, 140, 91, 0.08);
    color: rgba(255, 140, 91, 0.85);
    border: 1px solid rgba(255, 140, 91, 0.45);
    box-shadow: none;
}

.kofi-btn:hover {
    background: rgba(255, 140, 91, 0.16);
    color: white;
    border-color: rgba(255, 140, 91, 0.65);
    transform: translateY(-1px);
}

/* Prominent (active) state */
.footer-monetize.prominent {
    opacity: 1.0;
    background: var(--glass-bg);
    border-color: var(--glass-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

.footer-monetize.prominent .footer-monetize-text {
    color: var(--text-main);
    font-size: 0.95rem;
}

.footer-monetize.prominent .kofi-btn {
    background: linear-gradient(135deg, #ff5e5b 0%, #ff8c5b 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.4), 
        inset 0 -1px 0 rgba(0, 0, 0, 0.2), 
        0 0 15px rgba(255, 94, 91, 0.35);
    transform: scale(1.03);
}

.footer-monetize.prominent .kofi-btn:hover {
    transform: scale(1.06) translateY(-2px);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.5), 
        inset 0 -1px 0 rgba(0, 0, 0, 0.2), 
        0 0 25px rgba(255, 94, 91, 0.55);
}

.footer-monetize.prominent .kofi-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 80%;
    height: 100%;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.55) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: skewX(-25deg);
    pointer-events: none;
    animation: shineSweep 2.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.footer-monetize.prominent .kofi-btn:hover::after {
    animation: shineSweep 1.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.footer-monetize.prominent .kofi-btn i {
    transition: transform 0.2s ease;
}

.footer-monetize.prominent .kofi-btn:hover i {
    animation: heartBeat 0.8s infinite alternate;
}

@keyframes heartBeat {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(1.25);
    }
}

@keyframes shineSweep {
    0% {
        left: -150%;
    }
    100% {
        left: 150%;
    }
}

@media (max-width: 768px) {
    .footer-monetize-content {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
    .footer-monetize-text {
        max-width: 100%;
    }
}
