/* ============================================================
   AI Content Gap Analyzer — Premium Dark Glass CSS
   Matches PulsrWeb tool design system
   ============================================================ */

/* === Variables === */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --glass-bg: rgba(15, 23, 42, 0.6);
    --glass-border: rgba(99, 102, 241, 0.15);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #6366f1;
    --accent-2: #06b6d4;
    --accent-gradient: linear-gradient(135deg, #6366f1, #06b6d4);
    --good: #10b981;
    --good-bg: rgba(16, 185, 129, 0.15);
    --medium: #f59e0b;
    --medium-bg: rgba(245, 158, 11, 0.15);
    --critical: #ef4444;
    --critical-bg: rgba(239, 68, 68, 0.15);
    --border: rgba(148, 163, 184, 0.1);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Reset === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.hidden { display: none !important; }

/* === Top Bar === */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
}

.top-bar-left, .top-bar-right { display: flex; align-items: center; gap: 12px; }

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.back-btn:hover { color: var(--text-primary); background: rgba(99, 102, 241, 0.08); }

.brand-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.08);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
}
.brand-dot {
    width: 8px; height: 8px;
    background: var(--accent-gradient);
    border-radius: 50%;
    display: inline-block;
}

.lang-switcher { display: flex; gap: 4px; }
.lang-btn {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: var(--transition);
}
.lang-btn:hover { color: var(--text-primary); background: rgba(99, 102, 241, 0.08); }
.lang-btn.active {
    color: #fff;
    background: var(--accent-gradient);
    border-color: transparent;
}

/* === Hero === */
.hero {
    text-align: center;
    padding: 2rem 0 3rem;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1.5rem;
}
.hero-badge-dot {
    width: 6px; height: 6px;
    background: var(--good);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.5); }
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    max-width: 650px;
    margin: 0 auto;
    line-height: 1.7;
}

/* === Feature Pills === */
.feature-pills {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 2.5rem;
}

.pill {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    text-align: left;
}
[dir="rtl"] .pill { text-align: right; }
.pill:hover { border-color: rgba(99, 102, 241, 0.3); transform: translateY(-2px); }
.pill-icon { font-size: 1.5rem; flex-shrink: 0; }
.pill-text strong {
    display: block;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.pill-text span {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* === Glass Card === */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.card { padding: 2rem; margin-bottom: 2rem; }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 700;
}
.card-title .icon { font-size: 1.2rem; }
.card-title-badge {
    font-size: 10px;
    font-weight: 800;
    padding: 3px 10px;
    background: var(--accent-gradient);
    color: #fff;
    border-radius: 20px;
    letter-spacing: 1px;
}

/* === Form === */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-group { display: flex; flex-direction: column; gap: 8px; }

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}
.label-icon { font-size: 1rem; }

.input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.input-prefix {
    padding: 0 0 0 14px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    user-select: none;
}
[dir="rtl"] .input-prefix { padding: 0 14px 0 0; }

.form-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    padding: 12px 14px;
    font-family: inherit;
}
.form-input::placeholder { color: var(--text-muted); }

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-primary {
    background: var(--accent-gradient);
    color: #fff;
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.1); }
.btn-primary:active { transform: translateY(0); }

.btn-full { width: 100%; }

.btn-glow {
    position: relative;
    overflow: hidden;
}
.btn-glow::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shimmer 3s infinite;
}
@keyframes shimmer { 100% { left: 100%; } }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }
.btn:disabled::before { animation: none; }

.btn-icon { font-size: 1.1rem; }

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
}
.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(99, 102, 241, 0.05);
}

/* === Loading Overlay === */
.loading-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(10, 14, 26, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s;
}

.loading-card {
    text-align: center;
    padding: 48px 64px;
    max-width: 420px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
}

.loading-spinner {
    position: relative;
    width: 80px; height: 80px;
    margin: 0 auto 24px;
}
.spinner-ring {
    position: absolute;
    border: 3px solid transparent;
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
}
.spinner-ring:nth-child(1) {
    width: 80px; height: 80px;
    border-top-color: #6366f1;
    animation-duration: 1.5s;
}
.spinner-ring:nth-child(2) {
    width: 60px; height: 60px;
    top: 10px; left: 10px;
    border-top-color: #06b6d4;
    animation-duration: 1s;
    animation-direction: reverse;
}
.spinner-ring:nth-child(3) {
    width: 40px; height: 40px;
    top: 20px; left: 20px;
    border-top-color: #8b5cf6;
    animation-duration: 0.8s;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; }
.loading-status { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 20px; }

.progress-bar {
    width: 100%; height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
}
.progress-fill {
    width: 0%; height: 100%;
    background: var(--accent-gradient);
    border-radius: 2px;
    transition: width 0.5s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* === Results === */
.results-section { animation: fadeSlideUp 0.5s ease; }
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Summary Grid */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 2rem;
}
.summary-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    text-align: center;
    transition: var(--transition);
}
.summary-card:hover { border-color: rgba(99, 102, 241, 0.3); transform: translateY(-2px); }
.summary-card .number {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.summary-card .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Results Header */
.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 12px;
}
.results-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}
.export-btns { display: flex; gap: 8px; }

/* Gap Cards */
.gap-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: var(--transition);
}
.gap-card:hover { border-color: rgba(99, 102, 241, 0.3); }

.gap-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 8px;
}
.gap-keyword {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}
.gap-badges { display: flex; gap: 8px; align-items: center; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-good { background: var(--good-bg); color: var(--good); }
.badge-medium { background: var(--medium-bg); color: var(--medium); }
.badge-critical { background: var(--critical-bg); color: var(--critical); }
.badge-info { background: rgba(99, 102, 241, 0.15); color: var(--accent); }

.gap-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 1rem;
}
.gap-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.gap-meta-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.gap-meta-value {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}
.gap-meta-value a {
    color: var(--accent-2);
    text-decoration: none;
    word-break: break-all;
}
.gap-meta-value a:hover { text-decoration: underline; }

.gap-suggestion {
    padding: 12px 16px;
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}
.gap-suggestion-label {
    font-size: 0.72rem;
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.gap-suggestion-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.gap-tips {
    padding: 10px 14px;
    background: rgba(16, 185, 129, 0.06);
    border-left: 3px solid var(--good);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
}
[dir="rtl"] .gap-tips {
    border-left: none;
    border-right: 3px solid var(--good);
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

/* Difficulty Bar */
.difficulty-bar {
    width: 60px; height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
}
[dir="rtl"] .difficulty-bar { margin-left: 0; margin-right: 6px; }
.difficulty-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* No gaps */
.no-gaps {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}
.no-gaps-icon { font-size: 3rem; margin-bottom: 1rem; }
.no-gaps h3 { font-size: 1.2rem; color: var(--good); }

/* === FAQ === */
.faq-section {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}
.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}
.faq-item { margin-bottom: 0.75rem; }
.faq-item details {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.faq-item summary {
    padding: 14px 18px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: var(--transition);
    list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before {
    content: '+';
    margin-right: 10px;
    font-weight: 700;
    color: var(--accent);
}
[dir="rtl"] .faq-item summary::before { margin-right: 0; margin-left: 10px; }
.faq-item details[open] summary::before { content: '−'; }
.faq-item summary:hover { background: rgba(99, 102, 241, 0.05); }
.faq-item div {
    padding: 0 18px 14px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* === Footer === */
.unified-footer {
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    text-align: center;
}
.footer-content { color: var(--text-muted); font-size: 0.85rem; }
.footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.footer-logo span {
    font-size: 0.65rem;
    padding: 2px 8px;
    background: var(--accent-gradient);
    color: #fff;
    border-radius: 4px;
    font-weight: 800;
}

/* === Toast === */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
[dir="rtl"] .toast-container { right: auto; left: 24px; }

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    animation: slideInToast 0.3s ease;
    max-width: 350px;
}
.toast-success { background: var(--good-bg); color: var(--good); border: 1px solid var(--good); }
.toast-error { background: var(--critical-bg); color: var(--critical); border: 1px solid var(--critical); }

@keyframes slideInToast {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === How It Works === */
.how-section { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.how-content { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 1.5rem 2rem; }
.how-content p { font-size: 0.92rem; color: var(--text-secondary); line-height: 1.8; margin-bottom: 1rem; }
.how-content p:last-child { margin-bottom: 0; }

/* === Related Tools === */
.related-section { margin-top: 3rem; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.related-card { display: flex; flex-direction: column; gap: 6px; padding: 1.25rem; background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius-sm); text-decoration: none; transition: var(--transition); }
.related-card:hover { border-color: rgba(99,102,241,0.3); transform: translateY(-3px); }
.related-icon { font-size: 1.5rem; }
.related-card strong { font-size: 0.9rem; color: var(--text-primary); }
.related-card span { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; }

/* === Responsive === */
@media (max-width: 768px) {
    .form-grid { grid-template-columns: 1fr; }
    .summary-grid { grid-template-columns: repeat(2, 1fr); }
    .feature-pills { grid-template-columns: 1fr; }
    .gap-meta { grid-template-columns: 1fr; }
    .hidden-mobile { display: none !important; }
    .hero h1 { font-size: 1.8rem; }
    .hero-subtitle { font-size: 0.95rem; }
    .card { padding: 1.25rem; }
    .loading-card { padding: 32px; }
    .results-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
    .summary-grid { grid-template-columns: 1fr; }
    .container { padding: 0 12px; }
}
