/* ============================================================
   CTR Analysis Tool — Premium Dark Glass CSS
   ============================================================ */

: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);
}

*, *::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); }

/* 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); }
.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: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff; border-radius: 20px; letter-spacing: 1px; }

/* Form Grids */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 0.5rem; }
.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; }

.form-input {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    padding: 12px 14px;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
    width: 100%;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1); }
.form-input::placeholder { color: var(--text-muted); }

.form-textarea { resize: vertical; min-height: 80px; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; cursor: pointer; }
[dir="rtl"] .form-select { background-position: left 14px center; }
.form-select option { background: var(--bg-secondary); color: var(--text-primary); }

.radio-group { display: flex; gap: 16px; padding: 10px 0; }
.radio-label { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; color: var(--text-secondary); cursor: pointer; transition: var(--transition); }
.radio-label:hover { color: var(--text-primary); }
.radio-label input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }

/* 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-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 */
.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; }
.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-wrap { animation: fadeSlideUp 0.5s ease; }
@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.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; }

/* CTR Score Ring */
.score-ring-wrap { text-align: center; margin-bottom: 2rem; }
.score-ring { position: relative; width: 140px; height: 140px; margin: 0 auto 12px; }
.score-ring svg { transform: rotate(-90deg); width: 140px; height: 140px; }
.score-ring-bg { fill: none; stroke: rgba(255,255,255,0.08); stroke-width: 8; }
.score-ring-value { fill: none; stroke-width: 8; stroke-linecap: round; stroke-dasharray: 395.84; stroke-dashoffset: 395.84; transition: stroke-dashoffset 1.5s ease-out, stroke 0.5s ease; }
.score-number { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 2rem; font-weight: 800; }
.score-label { font-size: 0.85rem; color: var(--text-secondary); font-weight: 600; margin-top: 4px; }
.severity-badge { display: inline-block; padding: 4px 14px; border-radius: 20px; font-size: 0.8rem; font-weight: 700; margin-top: 8px; text-transform: uppercase; letter-spacing: 0.5px; }

/* Analysis Cards */
.analysis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
.analysis-card { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 1.5rem; transition: var(--transition); }
.analysis-card:hover { border-color: rgba(99, 102, 241, 0.3); }
.analysis-card.full-width { grid-column: 1 / -1; }
.analysis-card-icon { font-size: 1.5rem; margin-bottom: 10px; }
.analysis-card-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; margin-bottom: 8px; }
.analysis-card-value { font-size: 0.95rem; color: var(--text-primary); font-weight: 500; line-height: 1.7; }
.analysis-card-sub { font-size: 0.82rem; color: var(--text-secondary); margin-top: 6px; line-height: 1.6; }

/* Action Card (highlighted) */
.action-card { background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(6,182,212,0.05)); border-color: rgba(99,102,241,0.25); }
.action-card .analysis-card-value { color: var(--accent-2); font-weight: 700; }

/* Strategic Note */
.strategic-note { padding: 14px 18px; 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.88rem; color: var(--text-secondary); line-height: 1.7; margin-top: 1rem; }
[dir="rtl"] .strategic-note { border-left: none; border-right: 3px solid var(--good); border-radius: var(--radius-sm) 0 0 var(--radius-sm); }

/* 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; 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, .form-grid-3 { grid-template-columns: 1fr; }
    .analysis-grid { grid-template-columns: 1fr; }
    .feature-pills { grid-template-columns: 1fr; }
    .hidden-mobile { display: none !important; }
    .hero h1 { font-size: 1.8rem; }
    .card { padding: 1.25rem; }
    .loading-card { padding: 32px; }
    .results-header { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) { .container { padding: 0 12px; } }
