/* ==================== CSS Variables ==================== */
:root {
    --color-primary: #5B7FE9;
    --color-primary-dark: #4A6FDB;
    --color-primary-light: #7A9CF5;
    --color-primary-bg: #EEF2FD;
    --color-secondary: #56C596;
    --color-secondary-bg: #E8F7F0;
    --color-accent: #9B6FE9;
    --color-danger: #EF4444;
    --color-success: #22C55E;
    --color-warning: #F59E0B;

    --color-text: #1E293B;
    --color-text-light: #64748B;
    --color-text-lighter: #94A3B8;
    --color-border: #E2E8F0;
    --color-border-light: #F1F5F9;
    --color-bg: #F8FAFC;
    --color-bg-alt: #F1F5F9;
    --color-white: #FFFFFF;
    --color-overlay: rgba(0, 0, 0, 0.4);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12);

    --transition: all 0.25s ease;
    --transition-fast: all 0.15s ease;

    --container-max: 1140px;
    --header-h: 64px;

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", "Lucida Console", Monaco, monospace;
}

/* ==================== Reset ==================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover { color: var(--color-primary-dark); }

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

img, svg { display: block; max-width: 100%; }

/* ==================== Container ==================== */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
}

/* ==================== Background Decoration ==================== */
.bg-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-shape {
    position: absolute;
    width: 500px;
    height: 500px;
}

.bg-shape-1 {
    top: -100px;
    right: -150px;
    animation: float-slow 20s ease-in-out infinite;
}

.bg-shape-2 {
    bottom: -100px;
    left: -150px;
    animation: float-slow 25s ease-in-out infinite reverse;
}

@keyframes float-slow {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(20px, -20px) rotate(10deg); }
}

/* ==================== Header ==================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border-light);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-h);
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
}

.logo:hover { color: var(--color-primary); }

.logo-text { letter-spacing: -0.5px; }

.logo-arrow {
    color: var(--color-secondary);
    margin: 0 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.header-nav {
    display: flex;
    gap: 20px;
}

.header-nav a {
    color: var(--color-text-light);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition-fast);
}

.header-nav a:hover {
    color: var(--color-primary);
}

/* Language Selector */
.lang-selector {
    position: relative;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: var(--color-bg-alt);
    color: var(--color-text);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition-fast);
}

.lang-btn:hover {
    background: var(--color-primary-bg);
}

.lang-current {
    min-width: 24px;
    text-align: center;
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 140px;
    background: var(--color-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-border-light);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: var(--transition);
    z-index: 200;
}

.lang-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-dropdown button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--color-text);
    transition: var(--transition-fast);
}

.lang-dropdown button:hover {
    background: var(--color-primary-bg);
    color: var(--color-primary);
}

.lang-dropdown button.active {
    background: var(--color-primary-bg);
    color: var(--color-primary);
    font-weight: 600;
}

/* ==================== Hero ==================== */
.hero {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 60px 24px 40px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 100px;
    background: var(--color-secondary-bg);
    color: var(--color-secondary);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 20px;
    border: 1px solid rgba(86, 197, 150, 0.2);
}

.hero-title {
    font-size: clamp(28px, 5vw, 44px);
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--color-text);
    margin-bottom: 16px;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: clamp(15px, 2.5vw, 18px);
    color: var(--color-text-light);
    max-width: 680px;
    margin: 0 auto 28px;
    line-height: 1.7;
}

.hero-features {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.feature-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 100px;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    color: var(--color-text-light);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.feature-chip svg {
    color: var(--color-primary);
}

/* ==================== Main Tool ==================== */
.main-tool {
    position: relative;
    z-index: 1;
    padding: 20px 0 40px;
}

.tool-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.tool-panel {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border-light);
}

.panel-header svg {
    color: var(--color-primary);
    flex-shrink: 0;
}

.panel-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

.panel-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

.slide-counter {
    margin-left: auto;
    font-size: 13px;
    color: var(--color-text-lighter);
    font-weight: 500;
}

/* Upload Zone */
.upload-zone {
    margin: 16px 20px 0;
    padding: 32px 20px;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--color-text-lighter);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--color-primary);
    background: var(--color-primary-bg);
    color: var(--color-primary);
}

.upload-zone svg {
    margin: 0 auto 8px;
}

.upload-main-text {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.upload-sub-text {
    font-size: 13px;
    color: var(--color-text-lighter);
}

/* Textarea */
.textarea-wrapper {
    padding: 16px 20px;
}

.html-textarea {
    width: 100%;
    min-height: 180px;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
    color: var(--color-text);
    resize: vertical;
    transition: var(--transition-fast);
}

.html-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    background: var(--color-white);
    box-shadow: 0 0 0 3px rgba(91, 127, 233, 0.1);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 12px;
    padding: 0 20px 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    flex: 1;
    background: var(--color-primary);
    color: var(--color-white);
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    box-shadow: 0 4px 12px rgba(91, 127, 233, 0.3);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-secondary {
    background: var(--color-bg-alt);
    color: var(--color-text-light);
}

.btn-secondary:hover {
    background: var(--color-border-light);
    color: var(--color-text);
}

.btn-success {
    background: var(--color-success);
    color: var(--color-white);
}

.btn-success:hover {
    background: #1AB854;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.btn-large {
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Preview Panel */
.preview-content {
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
    position: relative;
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--color-text-lighter);
    text-align: center;
    padding: 40px 20px;
}

.preview-placeholder p {
    margin-top: 16px;
    font-size: 14px;
    max-width: 280px;
}

.preview-slides {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.preview-slide-item {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
}

.preview-slide-item iframe {
    width: 100%;
    border: none;
    pointer-events: none;
}

.preview-slide-label {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    z-index: 10;
}

.download-area {
    padding: 20px;
    border-top: 1px solid var(--color-border-light);
}

/* Options Panel */
.options-panel {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: 24px;
}

.options-panel .panel-header {
    padding: 14px 20px;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding: 20px;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-light);
}

.select-input {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-white);
    font-size: 14px;
    color: var(--color-text);
    cursor: pointer;
    transition: var(--transition-fast);
}

.select-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(91, 127, 233, 0.1);
}

.checkbox-group {
    flex-direction: row;
    align-items: center;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
}

.checkbox-label input {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

/* Ad Container */
.ad-container {
    margin-bottom: 24px;
    padding: 16px;
    background: var(--color-white);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-light);
    min-height: 100px;
    text-align: center;
}

.ad-label {
    font-size: 11px;
    color: var(--color-text-lighter);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

/* Status Bar */
.status-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    background: var(--color-primary-bg);
    border: 1px solid rgba(91, 127, 233, 0.15);
    margin-bottom: 24px;
}

.status-bar.success {
    background: var(--color-secondary-bg);
    border-color: rgba(86, 197, 150, 0.15);
}

.status-bar.error {
    background: #FEF2F2;
    border-color: rgba(239, 68, 68, 0.15);
}

.status-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.status-bar:not(.error) .status-icon::before {
    content: "";
    display: block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.status-bar.success .status-icon::before {
    border: none;
    animation: none;
}

.status-bar.success .status-icon::before {
    content: "✓";
    font-size: 18px;
    color: var(--color-success);
    font-weight: bold;
}

.status-bar.error .status-icon::before {
    content: "✕";
    font-size: 18px;
    color: var(--color-danger);
    font-weight: bold;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.status-text {
    font-size: 14px;
    color: var(--color-text);
}

/* ==================== About Section ==================== */
.about-section {
    position: relative;
    z-index: 1;
    padding: 40px 0;
}

.section-title {
    text-align: center;
    font-size: clamp(24px, 4vw, 32px);
    font-weight: 800;
    color: var(--color-text);
    margin-bottom: 12px;
}

.section-desc {
    text-align: center;
    font-size: 16px;
    color: var(--color-text-light);
    max-width: 640px;
    margin: 0 auto 40px;
    line-height: 1.7;
}

.about-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.about-card {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.about-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.about-card-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--color-primary-bg);
}

.about-card h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 8px;
}

.about-card p {
    font-size: 14px;
    color: var(--color-text-light);
    line-height: 1.6;
}

/* ==================== FAQ Section ==================== */
.faq-section {
    position: relative;
    z-index: 1;
    padding: 40px 0 60px;
}

.faq-list {
    max-width: 760px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.faq-item {
    background: var(--color-white);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

.faq-item:hover {
    box-shadow: var(--shadow-md);
}

.faq-item summary {
    padding: 18px 24px;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition-fast);
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: "+";
    font-size: 24px;
    color: var(--color-primary);
    font-weight: 300;
    transition: var(--transition-fast);
}

.faq-item[open] summary::after {
    transform: rotate(45deg);
}

.faq-item summary:hover {
    color: var(--color-primary);
}

.faq-item p {
    padding: 0 24px 18px;
    font-size: 14px;
    color: var(--color-text-light);
    line-height: 1.7;
}

/* ==================== Footer ==================== */
.site-footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--color-border-light);
    background: var(--color-white);
    padding: 24px 0;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.footer-left p {
    font-size: 13px;
    color: var(--color-text-light);
}

.footer-right {
    display: flex;
    gap: 20px;
}

.footer-right a {
    font-size: 13px;
    color: var(--color-text-light);
    font-weight: 500;
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .tool-grid {
        grid-template-columns: 1fr;
    }

    .header-nav {
        display: none;
    }

    .hero {
        padding: 40px 16px 30px;
    }

    .hero-features {
        gap: 8px;
    }

    .feature-chip {
        padding: 6px 12px;
        font-size: 12px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }
}

/* RTL Support for Arabic */
[dir="rtl"] .lang-dropdown {
    right: auto;
    left: 0;
}

[dir="rtl"] .slide-counter {
    margin-left: 0;
    margin-right: auto;
}

[dir="rtl"] .preview-slide-label {
    left: auto;
    right: 8px;
}

/* ==================== Spinner Overlay ==================== */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.spinner-overlay .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-overlay .spinner-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-light);
}

/* ==================== Accessibility ==================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}
