:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --accent: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.08);
    --radius: 12px;
    --radius-lg: 16px;
    --input-font: 'Terafont', 'Noto Sans Gujarati', sans-serif;
    --output-font: 'Noto Sans Gujarati', 'Shruti', sans-serif;
    --nav-bg: rgba(255,255,255,0.85);
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --nav-bg: rgba(15,23,42,0.9);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3);
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

/* Navbar */
.navbar-gfc {
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
}

.navbar-gfc .navbar-brand { font-weight: 700; color: var(--text) !important; }
.brand-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.1rem;
}

.nav-link { color: var(--text-muted) !important; font-weight: 500; border-radius: 8px; padding: 0.5rem 0.75rem !important; }
.nav-link:hover { color: var(--primary) !important; background: rgba(99,102,241,0.08); }

.btn-primary-gfc {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none; color: #fff; font-weight: 600;
    padding: 0.5rem 1.25rem; border-radius: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.btn-primary-gfc:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(99,102,241,0.35); color: #fff; }

.btn-outline-gfc {
    border: 1px solid var(--border); color: var(--text);
    background: var(--bg-card); border-radius: 10px; font-weight: 500;
}
.btn-outline-gfc:hover { border-color: var(--primary); color: var(--primary); background: rgba(99,102,241,0.05); }

.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); border-radius: 8px; }
.btn-profile { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; color: var(--text); display: flex; align-items: center; gap: 0.5rem; }
.avatar { width: 28px; height: 28px; background: var(--primary); color: #fff; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; }

/* Converter */
.converter-page { min-height: calc(100vh - 70px); }
.converter-header h1 { font-weight: 700; }
.usage-badge-card {
    display: flex; gap: 1.5rem; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1rem 1.5rem; box-shadow: var(--shadow);
}
.usage-item .label { display: block; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.usage-item .value { font-weight: 700; font-size: 1.1rem; }
.badge-package { color: var(--primary); }

.converter-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow 0.3s;
}
.converter-panel:hover { box-shadow: var(--shadow-lg); }
.converter-panel .panel-header { padding: 1rem 1.25rem 0; }
.converter-panel .panel-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex; justify-content: space-between;
    font-size: 0.85rem; color: var(--text-muted);
}
.converter-textarea {
    border: none; border-radius: 0; resize: vertical;
    min-height: 320px; font-size: 1.15rem; line-height: 1.8;
    padding: 1.25rem; background: transparent; color: var(--text);
}
.converter-textarea:focus { box-shadow: none; outline: none; }
.font-select { border-radius: 10px; border-color: var(--border); font-weight: 500; }
.convert-status { color: var(--success); font-weight: 500; }
.convert-status.error { color: var(--danger); }
.convert-status.loading { color: var(--primary); }

/* Auth & Landing */
.guest-body { background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%); min-height: 100vh; }
.navbar-guest { background: transparent !important; border: none; }
.navbar-guest .navbar-brand, .navbar-guest .btn-outline-light { color: #fff !important; }

.auth-card {
    max-width: 420px; margin: 3rem auto;
    background: var(--bg-card); border-radius: var(--radius-lg);
    padding: 2.5rem; box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}
.auth-card h2 { font-weight: 700; margin-bottom: 0.5rem; }
.auth-card .form-control { border-radius: 10px; padding: 0.75rem 1rem; }

.hero-section {
    padding: 5rem 0 4rem; text-align: center; color: #fff;
}
.hero-section h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; line-height: 1.2; }
.hero-section .gradient-text {
    background: linear-gradient(135deg, #818cf8, #06b6d4);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; margin-top: 4rem; }
.feature-card {
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-lg); padding: 2rem; text-align: left;
    backdrop-filter: blur(8px); transition: transform 0.3s;
}
.feature-card:hover { transform: translateY(-4px); }
.feature-card i { font-size: 2rem; color: var(--primary-light); margin-bottom: 1rem; }

/* Dashboard cards */
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 1.5rem;
    box-shadow: var(--shadow); transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { color: var(--text-muted); font-size: 0.875rem; }

.package-card {
    background: var(--bg-card); border: 2px solid var(--border);
    border-radius: var(--radius-lg); padding: 2rem;
    transition: all 0.3s; height: 100%;
}
.package-card.featured { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99,102,241,0.15); }
.package-card .price { font-size: 2.5rem; font-weight: 800; }
.package-card ul { list-style: none; padding: 0; }
.package-card ul li { padding: 0.35rem 0; color: var(--text-muted); }
.package-card ul li::before { content: "✓ "; color: var(--success); font-weight: 700; }

/* Loading & states */
.btn-loading { pointer-events: none; opacity: 0.7; }
.spinner-gfc {
    width: 1rem; height: 1rem;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.toast-gfc {
    position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999;
    background: var(--bg-card); border: 1px solid var(--border);
    padding: 1rem 1.25rem; border-radius: var(--radius);
    box-shadow: var(--shadow-lg); animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } }
.onboarding-banner {
    background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(6,182,212,0.1));
    border: 1px solid var(--primary-light); border-radius: var(--radius);
    padding: 1rem 1.25rem; margin-bottom: 1rem;
}
.converter-toolbar-sticky {
    position: sticky; top: 70px; z-index: 50;
    background: var(--bg); padding: 0.5rem 0;
}
.render-box { word-break: break-word; line-height: 1.8; }

/* Mobile — Android, iOS, tablets */
@media (max-width: 991px) {
    .converter-panels .col-lg-6:first-child { margin-bottom: 0; }
    .usage-badge-card { flex-direction: column; gap: 0.75rem; width: 100%; }
    .converter-toolbar { justify-content: center; gap: 0.5rem; }
    .converter-textarea { min-height: 200px; font-size: 16px; }
    .converter-toolbar-sticky { top: 56px; }
    .navbar-gfc .navbar-collapse { padding-top: 0.5rem; }
}

@media (max-width: 576px) {
    .converter-toolbar .btn {
        min-height: 44px; min-width: 44px;
        flex: 1 1 calc(50% - 0.25rem); font-size: 0.8rem;
    }
    .auth-card { margin: 1rem; padding: 1.25rem; }
    .usage-badge-card { padding: 0.75rem 1rem; }
    .converter-page { padding-bottom: env(safe-area-inset-bottom); }
    .toast-gfc { left: 1rem; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); }
}
