/* ========== PLAGN — Main Styles ========== */

body {
    font-family: 'Inter', 'Noto Sans Arabic', sans-serif;
}

/* ---- Drop Zone ---- */
.drop-zone {
    transition: all 0.3s ease;
}

.drop-zone.dragover {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.08);
    transform: scale(1.01);
}

/* ---- Color Palette Dots ---- */
.color-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.2s;
    cursor: pointer;
}

.color-dot:hover {
    transform: scale(1.25);
}

/* ---- Template Cards ---- */
.tpl-card {
    transition: all 0.2s ease;
    cursor: pointer;
}

.tpl-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.tpl-card.active {
    outline: 3px solid #818cf8;
    outline-offset: 2px;
}

/* ---- Generate Button ---- */
.btn-gen {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    transition: all 0.3s;
}

.btn-gen:hover:not(:disabled) {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

/* ---- Glass Card ---- */
.glass {
    background: rgba(255, 255, 255, 0.04);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

/* ---- Progress Bar ---- */
.pbar {
    transition: width 0.4s ease;
}

/* ---- Pulse Glow Animation ---- */
@keyframes pglow {

    0%,
    100% {
        box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
    }

    50% {
        box-shadow: 0 0 28px rgba(99, 102, 241, 0.6);
    }
}

.pulsing {
    animation: pglow 1.5s infinite;
}

/* ---- Fade In ---- */
@keyframes fadein {
    from {
        opacity: 0;
        transform: translateY(8px)
    }

    to {
        opacity: 1;
        transform: none
    }
}

.fadein {
    animation: fadein .5s ease both
}

/* Live Preview */
#previewContainer {
    transition: all 0.3s ease
}

#previewContainer:hover {
    border-color: rgba(99, 102, 241, 0.3)
}

#livePreviewCanvas {
    transition: opacity 0.3s ease;
    display: block;
    margin: 0 auto
}

/* Scrollbar thin */
.scrollbar-thin::-webkit-scrollbar {
    width: 4px
}

.scrollbar-thin::-webkit-scrollbar-track {
    background: transparent
}

.scrollbar-thin::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 4px
}

.scrollbar-thin::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.5)
}

/* Watermark options */
#watermarkOptions {
    transition: max-height 0.3s ease, opacity 0.3s ease
}

/* Preset row hover */
#presetList .group:hover {
    background: rgba(99, 102, 241, 0.08)
}

/* ---- Preview ---- */
.preview-thumb {
    max-height: 300px;
    object-fit: contain;
    border-radius: 10px;
}

.preview-grid img {
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ---- Font Select Preview ---- */
#selFont option[value="Poppins"] {
    font-family: 'Poppins', sans-serif;
}

#selFont option[value="Inter"] {
    font-family: 'Inter', sans-serif;
}

#selFont option[value="Montserrat"] {
    font-family: 'Montserrat', sans-serif;
}

#selFont option[value="Raleway"] {
    font-family: 'Raleway', sans-serif;
}

#selFont option[value="Playfair Display"] {
    font-family: 'Playfair Display', serif;
}

#selFont option[value="Oswald"] {
    font-family: 'Oswald', sans-serif;
}

#selFont option[value="Nunito"] {
    font-family: 'Nunito', sans-serif;
}

#selFont option[value="Rubik"] {
    font-family: 'Rubik', sans-serif;
}

#selFont option[value="Archivo Black"] {
    font-family: 'Archivo Black', sans-serif;
}

#selFont option[value="Noto Sans Arabic"] {
    font-family: 'Noto Sans Arabic', sans-serif;
}

#selFont option[value="Cairo"] {
    font-family: 'Cairo', sans-serif;
}

#selFont option[value="Tajawal"] {
    font-family: 'Tajawal', sans-serif;
}

/* ---- Checkerboard Background ---- */
.checkerboard {
    background-color: #0f172a;
    background-image: linear-gradient(45deg, #1e293b 25%, transparent 25%),
        linear-gradient(-45deg, #1e293b 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #1e293b 75%),
        linear-gradient(-45deg, transparent 75%, #1e293b 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* ---- Glass Refinement ---- */
.glass {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
}

/* ---- Results Gallery ---- */
#previewGrid .group {
    perspective: 1000px;
}

#previewGrid .group img {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#previewGrid .group:hover img {
    transform: rotateX(10deg) translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

/* ---- Modal Animations ---- */
#previewModal {
    transition: opacity 0.3s ease;
}

#previewModal.hidden {
    opacity: 0;
    pointer-events: none;
    display: flex !important;
    /* Keep flex but hide via opacity */
}

#modalImg {
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#previewModal:not(.hidden) #modalImg {
    transform: scale(1);
}

/* ---- Responsive Adjustments ---- */
@media (max-width: 1024px) {
    #tplGrid {
        grid-template-cols: repeat(3, 1fr);
    }
}

@media (max-width: 640px) {
    #tplGrid {
        grid-template-cols: repeat(2, 1fr);
    }
}

/* ---- Pro Section Styles ---- */
.border-indigo-500\/20 {
    animation: borderGlow 3s infinite alternate;
}

@keyframes borderGlow {
    from {
        border-color: rgba(99, 102, 241, 0.1);
    }

    to {
        border-color: rgba(99, 102, 241, 0.4);
    }
}

/* Sparkle Animation for Magic Demo */
@keyframes sparkle {
    0% {
        transform: scale(1) rotate(0deg);
        filter: brightness(1);
    }

    50% {
        transform: scale(1.1) rotate(10deg);
        filter: brightness(1.5);
    }

    100% {
        transform: scale(1) rotate(0deg);
        filter: brightness(1);
    }
}

#btnMagicDemo:hover svg {
    animation: sparkle 0.8s ease-in-out infinite;
}

/* ASO Hints Style */
#asoScoreHints li {
    transition: all 0.3s ease;
}

#asoScoreHints li:hover {
    transform: translateX(-2px);
    color: #fff;
}

/* ---- Font Previews ---- */
.font-preview-item {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

/* ---- Phase 1: Full-Screen Preview ---- */
.preview-expanded {
    position: fixed !important;
    inset: 0;
    z-index: 40;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 !important;
    margin: 0 !important;
    max-height: none !important;
    padding: 20px;
}

.preview-expanded #livePreviewCanvas {
    max-height: 90vh !important;
    max-width: 90vw !important;
}

.preview-expanded #previewPlaceholder {
    transform: scale(1.5);
}

/* ---- Phase 1: Drag & Reorder ---- */
.thumb-item {
    cursor: grab;
    transition: all 0.2s ease;
    position: relative;
}

.thumb-item:active {
    cursor: grabbing;
}

.thumb-item.dragging {
    opacity: 0.4;
    transform: scale(0.9);
}

.thumb-item.drag-over {
    outline: 2px solid #818cf8;
    outline-offset: 2px;
    transform: scale(1.05);
}

.thumb-item .thumb-order {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(99, 102, 241, 0.8);
    color: white;
    font-size: 9px;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

/* ---- Phase 1: Toast Notification ---- */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(99, 102, 241, 0.3);
    backdrop-filter: blur(12px);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 13px;
    z-index: 9999;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ========== Sidebar Tab Navigation ========== */
.sidebar-tabs {
    display: flex;
    gap: 2px;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 4px;
    position: sticky;
    top: 78px;
    z-index: 20;
}

.sidebar-tab {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    user-select: none;
}

.sidebar-tab:hover {
    color: #a5b4fc;
    background: rgba(99, 102, 241, 0.05);
}

.sidebar-tab.active {
    color: white;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.15));
    border: 1px solid rgba(99, 102, 241, 0.25);
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.15);
}

.sidebar-tab svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.sidebar-tab.active svg {
    opacity: 1;
}

/* Tab Panels */
.tab-panel {
    display: none;
    animation: tabFadeIn 0.3s ease;
}

.tab-panel.active {
    display: block;
}

@keyframes tabFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Section Headers ---- */
.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.section-header .section-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.section-header h3 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.section-header .section-badge {
    margin-right: auto;
    font-size: 9px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

/* ---- Tip Card ---- */
.tip-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.05));
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 11px;
    color: #a5b4fc;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.5;
}

.tip-card svg {
    width: 14px;
    height: 14px;
    color: #818cf8;
    flex-shrink: 0;
    margin-top: 2px;
}

/* ---- Scrollable Panel Max Height ---- */
.sidebar-scroll-panel {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.3) transparent;
    padding-left: 2px;
}

.sidebar-scroll-panel::-webkit-scrollbar {
    width: 3px;
}

.sidebar-scroll-panel::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 3px;
}

/* ---- Quick Stats Banner ---- */
.quick-stat {
    text-align: center;
    padding: 6px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.quick-stat .stat-value {
    font-size: 16px;
    font-weight: 800;
}

.quick-stat .stat-label {
    font-size: 9px;
    color: #6b7280;
    margin-top: 2px;
}

/* ---- Completion Ring ---- */
.completion-ring {
    width: 40px;
    height: 40px;
    position: relative;
}

.completion-ring svg {
    transform: rotate(-90deg);
}

.completion-ring .ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 3;
}

.completion-ring .ring-fill {
    fill: none;
    stroke: url(#ringGradient);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s ease;
}

.completion-ring .ring-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 800;
    color: #a5b4fc;
}

/* ---- Input Group Style ---- */
.input-group {
    margin-bottom: 8px;
}

.input-group label {
    display: block;
    font-size: 10px;
    color: #6b7280;
    margin-bottom: 3px;
    font-weight: 500;
}

.input-group .hint {
    font-size: 9px;
    color: #4b5563;
    margin-top: 2px;
}