:root {
    color-scheme: light;
    --bg: hsl(0, 0%, 100%);
    --bg-elevated: hsla(0, 0%, 100%, 0.8);
    --bg-elevated-strong: hsl(0, 0%, 100%);
    --surface: hsl(0, 0%, 100%);
    --surface-2: hsl(0, 0%, 96.1%);
    --text: hsl(0, 0%, 9%);
    --text-muted: hsl(0, 0%, 45.1%);
    --border: hsl(0, 0%, 89.8%);
    --border-active: hsl(0, 0%, 9%);
    --brand: hsl(221.2, 83.2%, 53.3%);
    --brand-2: hsl(217.2, 91.2%, 59.8%);
    --brand-3: hsl(199, 89%, 48%);
    --brand-glow: rgba(37, 99, 235, 0.04);
    --danger: hsl(0, 84.2%, 60.2%);
    --success: hsl(142.1, 76.2%, 36.3%);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.03);
    --radius-xl: 14px;
    --radius-lg: 10px;
    --radius-md: 8px;
    --transition: 150ms cubic-bezier(.16, 1, .3, 1);
}

html[data-theme='dark'] {
    color-scheme: dark;
    --bg: hsl(0, 0%, 0%);
    --bg-elevated: hsla(0, 0%, 4%, 0.7);
    --bg-elevated-strong: hsl(0, 0%, 4%);
    --surface: hsl(0, 0%, 2%);
    --surface-2: hsl(0, 0%, 7%);
    --text: hsl(0, 0%, 100%);
    --text-muted: hsl(0, 0%, 63.9%);
    --border: hsl(0, 0%, 14.9%);
    --border-active: hsl(0, 0%, 100%);
    --brand: hsl(217.2, 91.2%, 59.8%);
    --brand-2: hsl(221.2, 83.2%, 53.3%);
    --brand-3: hsl(199, 89%, 48%);
    --brand-glow: rgba(59, 130, 246, 0.08);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.6);
}

html,
body {
    min-height: 100%;
}

body {
    position: relative;
    margin: 0;
    background:
        radial-gradient(circle at top left, var(--brand-glow), transparent 30%),
        radial-gradient(circle at top right, rgba(0, 194, 255, 0.06), transparent 26%),
        var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    transition: background-color var(--transition), color var(--transition);
    overflow-x: hidden;
}

html[lang='ar'] body {
    font-family: 'Tajawal', 'Inter', system-ui, sans-serif;
}

h1, h2, h3, h4, h5, h6, .hero-title, .section-title {
    font-family: 'Outfit', 'Plus Jakarta Sans', 'Tajawal', system-ui, sans-serif;
    font-weight: 750;
    letter-spacing: -0.02em;
}

a {
    color: inherit;
}

.text-secondary,
.text-muted {
    color: var(--text-muted) !important;
}

.page-bg {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: -1;
}

.bg-orb {
    position: absolute;
    border-radius: 999px;
    filter: blur(18px);
    opacity: 0.65;
    animation: floatOrb 18s ease-in-out infinite;
}

.orb-1 {
    top: 6%;
    left: 8%;
    width: 280px;
    height: 280px;
    background: linear-gradient(135deg, rgba(91, 108, 255, 0.42), rgba(124, 77, 255, 0.18));
}

.orb-2 {
    top: 38%;
    right: 4%;
    width: 360px;
    height: 360px;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.28), rgba(91, 108, 255, 0.18));
    animation-duration: 21s;
}

.orb-3 {
    bottom: 6%;
    left: 40%;
    width: 260px;
    height: 260px;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.22), rgba(91, 108, 255, 0.16));
    animation-duration: 24s;
}

.grid-overlay {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: radial-gradient(circle at center, black 20%, transparent 85%);
}

.app-shell {
    width: min(1180px, calc(100% - 2rem));
    margin-inline: auto;
}

.site-header {
    padding-top: 1rem;
    position: relative;
    z-index: 1030;
}

.glass-panel,
.glass-nav,
.feature-card,
.dashboard-card,
.auth-card,
.footer-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: var(--shadow-md);
}

.glass-nav {
    border-radius: 999px;
    padding: 0.6rem 1.25rem;
    margin-top: 0.75rem;
    overflow: visible;
    position: relative;
    z-index: 1030;
    transition: all var(--transition);
}
.glass-nav:hover {
    border-color: color-mix(in srgb, var(--brand) 20%, var(--border));
    box-shadow: var(--shadow-lg);
}

/* Ensure dropdowns are not clipped by navbar collapse */
.navbar .navbar-collapse {
    overflow: visible !important;
}

.navbar .dropdown {
    position: relative;
}

.main-shell {
    padding-block: 2rem 4rem;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 0.9rem;
    text-decoration: none;
}

.brand-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: white;
    font-size: 1.2rem;
    box-shadow: 0 16px 28px rgba(91, 108, 255, 0.32);
}

.brand-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
}

.brand-copy strong {
    font-size: 1.1rem;
}

.brand-copy small {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.toolbar-actions,
.auth-cluster {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.toolbar-btn,
.toolbar-link,
.nav-pills-modern .nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text);
    border-radius: 999px;
    padding: 0.55rem 0.95rem;
    font-size: 0.88rem;
    font-weight: 550;
    text-decoration: none;
    transition: all var(--transition);
}

.toolbar-btn:hover,
.toolbar-link:hover,
.nav-pills-modern .nav-link:hover,
.nav-pills-modern .nav-link.active {
    background: var(--bg-elevated-strong);
    border-color: var(--border);
    transform: translateY(-1px);
    color: var(--brand);
}

.user-pill {
    display: inline-flex !important;
    align-items: center;
    gap: 0.55rem;
    padding-inline: 0.9rem !important;
}

.user-pill-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--success);
    box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.13);
}

/* ── Nav icon next to text ─────────────────────────────────── */
.nav-icon {
    font-size: 1rem;
    opacity: 0.7;
}

/* ── Toolbar icon-only buttons (theme / language) ──────────── */
.toolbar-btn-icon-only {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 12px;
    font-size: 1.1rem;
}
.toolbar-btn-icon-only .toolbar-btn-icon {
    font-size: 1.15rem;
}

/* ── User avatar circle ────────────────────────────────────── */
.user-avatar {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.user-avatar-btn {
    gap: 0.5rem;
    padding: 0.35rem 0.55rem 0.35rem 0.35rem;
    border-radius: 999px;
}
.user-avatar-btn:hover {
    background: var(--bg-elevated-strong);
    border-color: var(--border);
}

.user-display-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ── Dropdown chevron ──────────────────────────────────────── */
.dropdown-chevron {
    font-size: 0.6rem;
    opacity: 0.5;
    transition: transform var(--transition);
}
.dropdown.show .dropdown-chevron {
    transform: rotate(180deg);
}

/* ── Nav dropdown toggle (admin) ───────────────────────────── */
.nav-dropdown-toggle {
    gap: 0.45rem;
    padding: 0.45rem 0.75rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.88rem;
}
.admin-badge-icon {
    font-size: 1rem;
}

/* ── Glass dropdown menu ───────────────────────────────────── */
.nav-dropdown-menu {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    min-width: 220px;
    z-index: 1050;
    animation: dropdownFadeIn 0.18s ease;
}
.nav-dropdown-menu .dropdown-header {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 0.5rem 0.75rem 0.35rem;
}
.nav-dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    transition: background var(--transition);
    cursor: pointer;
    text-decoration: none;
}
.nav-dropdown-menu .dropdown-item:hover,
.nav-dropdown-menu .dropdown-item:focus {
    background: var(--bg-elevated-strong);
    color: var(--brand);
}
.nav-dropdown-menu .dropdown-item i {
    font-size: 1rem;
    opacity: 0.6;
    width: 1.25rem;
    text-align: center;
}
.nav-dropdown-menu .dropdown-item:hover i,
.nav-dropdown-menu .dropdown-item:focus i {
    opacity: 1;
}
.nav-dropdown-menu .dropdown-divider {
    border-color: var(--border);
    margin: 0.35rem 0;
    opacity: 0.5;
}

/* ── Register button in nav ────────────────────────────────── */
.nav-register-btn {
    padding: 0.55rem 1.15rem;
    border-radius: 12px;
    font-size: 0.85rem;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.btn-brand {
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px var(--brand-glow);
    transition: all var(--transition);
}

.btn-brand:hover,
.btn-brand:focus-visible {
    color: white;
    transform: translateY(-1.5px);
    box-shadow: 0 8px 20px var(--brand-glow), 0 0 0 2px var(--bg), 0 0 0 4px var(--brand);
}

.hero-section,
.page-header {
    display: grid;
    grid-template-columns: 1.4fr 0.9fr;
    gap: 1.5rem;
    align-items: center;
    margin-bottom: 1.75rem;
}

.hero-title {
    font-size: clamp(2.4rem, 5vw, 4.4rem);
    line-height: 1;
    margin: 0.6rem 0 1rem;
    letter-spacing: -0.05em;
    font-weight: 800;
}

.hero-title-sm {
    font-size: clamp(2rem, 4vw, 3.2rem);
}

.hero-subtitle,
.section-subtitle,
.form-heading-row p {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin: 0;
}

.eyebrow-pill,
.type-pill,
.info-badge,
.badge-soft,
.stat-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border-radius: 999px;
    padding: 0.5rem 0.85rem;
    background: var(--bg-elevated-strong);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
}

.hero-badges,
.landing-actions,
.dashboard-actions,
.result-actions,
.dashboard-meta {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    align-items: center;
}

.hero-card,
.landing-panel,
.content-panel,
.preview-shell,
.empty-state,
.auth-card {
    border-radius: var(--radius-xl);
    padding: 2rem;
}

/* ── Section dividers ──────────────────────────────────────── */
hr:not(.dropdown-divider) {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
    margin: 1.5rem 0;
    opacity: 0.7;
}

hr.my-4 {
    margin: 2rem 0;
}

/* ── Consistent glass-panel content padding ────────────────── */
section.glass-panel {
    padding: 2rem;
    border-radius: var(--radius-xl);
}

/* ── Form section spacing ──────────────────────────────────── */
.stack-form .mb-3 {
    margin-bottom: 1.25rem !important;
}

.stack-form .row.mb-3 {
    margin-bottom: 1.25rem !important;
}

/* ── Styled alerts ─────────────────────────────────────────── */
.alert {
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
}

.alert-success {
    background: color-mix(in srgb, var(--success) 12%, var(--bg-elevated));
    color: var(--success);
    border: 1px solid color-mix(in srgb, var(--success) 25%, transparent);
}

.alert-danger {
    background: color-mix(in srgb, var(--danger) 12%, var(--bg-elevated));
    color: var(--danger);
    border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
}

.alert-info {
    background: color-mix(in srgb, var(--brand-3) 12%, var(--bg-elevated));
    color: var(--brand-3);
    border: 1px solid color-mix(in srgb, var(--brand-3) 25%, transparent);
}

.alert-warning {
    background: color-mix(in srgb, #eab308 12%, var(--bg-elevated));
    color: #eab308;
    border: 1px solid color-mix(in srgb, #eab308 25%, transparent);
}

.hero-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.hero-stat-grid div {
    padding: 1rem;
    border-radius: var(--radius-lg);
    background: var(--bg-elevated-strong);
    border: 1px solid var(--border);
}

.hero-stat-grid strong {
    display: block;
    font-size: 1.8rem;
    margin-bottom: 0.35rem;
}

.section-heading {
    margin-bottom: 1.25rem;
}

.section-title {
    font-size: 1.8rem;
    margin: 0 0 0.35rem;
}

.modern-tabs {
    background: var(--surface-2);
    padding: 5px;
    border-radius: 999px;
    display: inline-flex;
    border: 1px solid var(--border);
    gap: 4px;
    flex-wrap: wrap;
}

.modern-tabs .nav-link {
    border: none;
    border-radius: 999px;
    color: var(--text-muted);
    padding: 0.5rem 1.25rem;
    font-size: 0.88rem;
    font-weight: 550;
    background: transparent;
    transition: all var(--transition);
}

.modern-tabs .nav-link:hover {
    color: var(--text);
    background: var(--bg-elevated);
}

.modern-tabs .nav-link.active {
    color: var(--surface) !important;
    background: var(--text) !important;
    box-shadow: var(--shadow-md);
}

.feature-card {
    border-radius: var(--radius-xl);
    padding: 1.5rem;
}

.stack-form {
    display: grid;
    gap: 0.65rem;
}

.form-heading-row {
    margin-bottom: 0.25rem;
}

.form-heading-row h3 {
    margin-bottom: 0.3rem;
    font-size: 1.35rem;
}

/* ── Unified form labels ─────────────────────────────────── */
.form-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.45rem;
    letter-spacing: 0.01em;
}

.form-label .text-danger {
    font-weight: 700;
}

.form-text {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    line-height: 1.45;
}

.form-check-label {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
}

.form-check-input {
    border-color: var(--border);
    background-color: var(--bg-elevated-strong);
}

.form-check-input:checked {
    background-color: var(--brand);
    border-color: var(--brand);
}

.form-check-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}

/* ── Unified input fields ───────────────────────────────────── */
.modern-input,
.form-control,
.form-select {
    min-height: 50px;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-elevated-strong);
    color: var(--text);
    font-size: 0.92rem;
    box-shadow: none !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea.modern-input,
textarea.form-control {
    min-height: 120px;
    line-height: 1.6;
}

.modern-input::placeholder,
.form-control::placeholder {
    color: color-mix(in srgb, var(--text-muted) 70%, transparent);
    font-weight: 400;
}

.modern-input:focus,
.form-control:focus,
.form-select:focus {
    border-color: var(--border-active);
    box-shadow: 0 0 0 1px var(--border-active), 0 0 0 4px var(--brand-glow) !important;
    background: var(--bg-elevated-strong);
    color: var(--text);
}

/* Small variant for nested card forms */
.form-control-sm,
.form-select-sm {
    min-height: 40px !important;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    border-radius: 12px;
}

.form-label-sm {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Read-only / disabled inputs */
.form-control[aria-readonly="true"],
.form-control:disabled,
.form-control[readonly] {
    background: var(--surface-2);
    color: var(--text-muted);
    border-color: var(--border);
    cursor: default;
    opacity: 0.85;
}

.cta-grid {
    display: grid;
    gap: 0.8rem;
}

.cta-button-group {
    padding: 0.8rem;
    border-radius: 18px;
    background: var(--bg-elevated-strong);
    border: 1px solid var(--border);
}

.result-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    border-radius: var(--radius-xl);
    padding: 1.25rem 1.5rem;
}

.short-link-display {
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.98rem;
    word-break: break-word;
    color: var(--brand);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.dashboard-card {
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: grid;
    gap: 1rem;
    min-width: 0;
    overflow: hidden;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.dashboard-card:hover {
    transform: translateY(-4px);
    border-color: color-mix(in srgb, var(--brand) 25%, var(--border));
    box-shadow: var(--shadow-lg), 0 0 24px var(--brand-glow);
}

.dashboard-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
}

.dashboard-card-title {
    margin: 0;
    font-size: 1.15rem;
}

.landing-shell,
.preview-shell,
.auth-shell {
    max-width: 860px;
    margin-inline: auto;
}

.landing-hero-media,
.preview-image-wrap {
    overflow: hidden;
    border-radius: 28px;
    padding: 0.5rem;
    background: var(--bg-elevated-strong);
    border: 1px solid var(--border);
}

.landing-actions {
    justify-content: center;
    margin-top: 2rem;
}

.empty-state {
    max-width: 760px;
    margin-inline: auto;
}

.empty-icon {
    width: 88px;
    height: 88px;
    border-radius: 24px;
    display: grid;
    place-items: center;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: white;
    font-size: 1.8rem;
    box-shadow: 0 20px 40px rgba(91, 108, 255, 0.28);
}

.site-footer {
    padding-bottom: 2rem;
}

.footer-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 24px;
}

.inline-link {
    color: var(--brand);
    font-weight: 700;
    text-decoration: none;
}

.custom-toggler {
    border-radius: 14px;
    border: 1px solid var(--border);
}

.skip-link {
    position: absolute;
    top: -48px;
    left: 1rem;
    z-index: 1000;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: white;
    padding: 0.8rem 1rem;
    border-radius: 16px;
}

.skip-link:focus {
    top: 1rem;
}

.reveal-on-scroll {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 500ms cubic-bezier(.16, 1, .3, 1), transform 500ms cubic-bezier(.16, 1, .3, 1);
}

.reveal-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.floating-card {
    animation: floatCard 8s ease-in-out infinite;
}

.btn-copy.copied {
    background: linear-gradient(135deg, var(--success), #16a34a);
    border-color: transparent;
    color: #fff;
}

.char-counter {
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

*:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--brand) 75%, white);
    outline-offset: 3px;
}

html[dir='rtl'] .skip-link {
    left: auto;
    right: 1rem;
}

html[dir='rtl'] .dashboard-card-top,
html[dir='rtl'] .footer-card,
html[dir='rtl'] .result-panel {
    direction: rtl;
}

html[dir='rtl'] .brand-copy,
html[dir='rtl'] .hero-copy,
html[dir='rtl'] .section-heading,
html[dir='rtl'] .feature-card,
html[dir='rtl'] .auth-card,
html[dir='rtl'] .landing-panel {
    text-align: right;
}

/* ── Dashboard filter bar ────────────────────────────────────────── */

.dashboard-filter-bar {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    margin-bottom: 0.75rem;
}

.filter-form {
    width: 100%;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

.filter-search {
    position: relative;
    flex: 1 1 260px;
    min-width: 200px;
}

.search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 1;
}

html[dir='rtl'] .search-icon {
    left: auto;
    right: 0.85rem;
}

.search-input {
    padding-inline-start: 2.5rem !important;
}

.filter-group {
    flex: 0 1 auto;
    min-width: 150px;
}

.filter-select {
    cursor: pointer;
}

.filter-submit {
    flex-shrink: 0;
}

.filter-clear {
    flex-shrink: 0;
}

/* ── Dashboard sort bar ──────────────────────────────────────────── */

.dashboard-sort-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.sort-label {
    font-size: 0.85rem;
    font-weight: 500;
}

.sort-btn {
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.3rem 0.8rem;
    text-decoration: none;
    min-width: 72px;
    text-align: center;
}

.result-count {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

/* ── Tag chips on dashboard cards ────────────────────────────────── */

.dashboard-tag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.25rem;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: color-mix(in srgb, var(--brand) 14%, transparent);
    color: var(--brand);
    border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent);
    line-height: 1.5;
}

/* ── Pagination ──────────────────────────────────────────────────── */

.pagination-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem 0 0.5rem;
}

.pagination-list {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    transition: var(--transition);
    cursor: pointer;
}

.pagination-link:hover:not(.pagination-disabled):not(.pagination-active) {
    background: color-mix(in srgb, var(--brand) 12%, var(--surface));
    border-color: var(--brand);
    color: var(--brand);
}

.pagination-active {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    border-color: transparent;
    cursor: default;
}

.pagination-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 40px;
    font-weight: 700;
    color: var(--text-muted);
}

.pagination-info {
    font-size: 0.82rem;
}

html[dir='rtl'] .filter-row,
html[dir='rtl'] .sort-controls,
html[dir='rtl'] .dashboard-sort-bar,
html[dir='rtl'] .pagination-list {
    direction: rtl;
}

@keyframes floatOrb {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(22px, -18px, 0) scale(1.06); }
}

@keyframes floatCard {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@media (max-width: 991.98px) {
    .hero-section,
    .page-header {
        grid-template-columns: 1fr;
    }

    .toolbar-actions {
        flex-wrap: wrap;
        margin-top: 1rem;
    }

    .glass-nav {
        border-radius: 28px;
    }
}

@media (max-width: 767.98px) {
    .app-shell {
        width: min(100% - 1rem, 1180px);
    }

    .main-shell {
        padding-block: 1.25rem 3rem;
    }

    .hero-title {
        letter-spacing: -0.03em;
    }

    .hero-stat-grid {
        grid-template-columns: 1fr;
    }

    .result-panel,
    .footer-card {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-actions {
        flex-direction: column;
    }

    .filter-row {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-search,
    .filter-group {
        flex: 1 1 100%;
        min-width: 0;
    }

    .filter-submit,
    .filter-clear {
        width: 100%;
    }

    .dashboard-sort-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .sort-controls {
        width: 100%;
    }

    .sort-btn {
        flex: 1;
    }

    .pagination-link {
        min-width: 36px;
        height: 36px;
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }

    .reveal-on-scroll {
        opacity: 1;
        transform: none;
    }
}

/* ── Admin Panel ─────────────────────────────────────────────────── */

/* Admin Navigation */
.admin-sidebar {
    padding: 0.5rem !important;
}

.admin-nav-items {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.admin-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.85rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary, #6c757d);
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.admin-nav-link i {
    font-size: 1rem;
}

.admin-nav-link:hover {
    color: var(--brand);
    background: rgba(91, 108, 255, 0.08);
}

.admin-nav-link.active {
    color: #fff;
    background: var(--brand);
    box-shadow: 0 2px 8px rgba(91, 108, 255, 0.3);
}

@media (max-width: 576px) {
    .admin-nav-link span {
        display: none;
    }
    .admin-nav-link {
        padding: 0.5rem;
    }
    .admin-nav-link i {
        font-size: 1.15rem;
    }
}

/* Admin Stats Grid */
.admin-stats-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    padding: 0 !important;
}

@media (max-width: 768px) {
    .admin-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .admin-stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-card-admin {
    text-align: center;
    padding: 1.5rem 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card-admin:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.stat-card-admin .stat-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.stat-card-admin .stat-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card-admin .stat-label {
    font-size: 0.85rem;
    margin-top: 0.25rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Admin nav active pill highlight */
.admin-stats-grid + .glass-panel,
.glass-panel .d-flex .btn-brand {
    position: relative;
}

/* Admin table row hover effect */
.modern-table tbody tr {
    transition: background 0.15s ease;
}

.badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid transparent;
    transition: all var(--transition);
}

.badge.bg-success {
    background: hsla(142.1, 76.2%, 36.3%, 0.08) !important;
    color: var(--success) !important;
    border: 1px solid hsla(142.1, 76.2%, 36.3%, 0.18);
    box-shadow: 0 0 8px hsla(142.1, 76.2%, 36.3%, 0.08);
}

.badge.bg-danger {
    background: hsla(0, 84.2%, 60.2%, 0.08) !important;
    color: var(--danger) !important;
    border: 1px solid hsla(0, 84.2%, 60.2%, 0.18);
    box-shadow: 0 0 8px hsla(0, 84.2%, 60.2%, 0.08);
}

.badge.bg-warning {
    background: hsla(45, 93%, 47%, 0.08) !important;
    color: hsl(45, 93%, 47%) !important;
    border: 1px solid hsla(45, 93%, 47%, 0.18);
}

.badge.bg-secondary {
    background: var(--surface-2) !important;
    color: var(--text-muted) !important;
    border: 1px solid var(--border);
}

/* ── Phase 5: UI Polish & Animations ─────────────────────────────── */

/* Smooth page transitions */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* Staggered reveal animation for cards */
.reveal-on-scroll {
    animation: fadeInUp 0.5s ease both;
}

.reveal-on-scroll:nth-child(2) { animation-delay: 0.08s; }
.reveal-on-scroll:nth-child(3) { animation-delay: 0.16s; }
.reveal-on-scroll:nth-child(4) { animation-delay: 0.24s; }
.reveal-on-scroll:nth-child(5) { animation-delay: 0.32s; }
.reveal-on-scroll:nth-child(6) { animation-delay: 0.40s; }

/* Button micro-interactions */
.btn {
    transition: all 0.2s cubic-bezier(.2, .8, .2, 1);
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.97);
}

.btn-brand::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.btn-brand:hover::after {
    opacity: 1;
}

/* Card hover lift effect */
.glass-panel {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.glass-panel:hover {
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.1);
}

/* Prevent hover effect on nav and footer */
.glass-nav:hover,
.footer-card:hover {
    transform: none;
    box-shadow: var(--shadow-md);
}

/* Form input focus animations */
.form-control,
.form-select {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Toast notification system */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast-item {
    animation: slideInRight 0.3s ease both;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    background: var(--bg-elevated-strong);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(16px);
    font-size: 0.9rem;
    max-width: 360px;
}

.toast-item.success { border-left: 4px solid var(--success); }
.toast-item.error   { border-left: 4px solid var(--danger); }
.toast-item.info    { border-left: 4px solid var(--brand); }

/* Skeleton loading placeholder */
.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--bg-elevated) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
    min-height: 1rem;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Smooth link/nav transitions */
.nav-link,
.navbar-brand {
    transition: color 0.2s ease, opacity 0.2s ease;
}

/* Table row hover */
.modern-table tbody tr:hover {
    background: rgba(91, 108, 255, 0.04);
}

/* Pricing card hover */
.pricing-card {
    transition: transform 0.25s cubic-bezier(.2, .8, .2, 1), box-shadow 0.25s ease;
}

.pricing-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12) !important;
}

/* Alert dismissal animation */
.alert {
    animation: fadeInUp 0.3s ease both;
}

/* ── Advanced Features ───────────────────────────────────────────────── */

/* Brand text color utility */
.text-brand {
    color: var(--brand);
}

/* Eyebrow label above hero titles */
.hero-eyebrow {
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

/* Notification badge on bell icon */
.notification-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    font-size: 0.65rem;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    padding: 0 5px;
    pointer-events: none;
}

/* Brand outline button variant */
.btn-outline-brand {
    color: var(--brand);
    border-color: var(--brand);
    background: transparent;
}

.btn-outline-brand:hover,
.btn-outline-brand:focus-visible {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

/* Tag suggestion button */
.btn-tag-suggest {
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.btn-tag-suggest:hover {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

/* Sort info container */
.sort-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Redirect rule group row */
.redirect-rule-group {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    background: var(--surface-2);
    border: 1px solid var(--border);
    transition: background var(--transition), border-color var(--transition);
}

.redirect-rule-group:hover {
    background: var(--bg-elevated-strong);
    border-color: color-mix(in srgb, var(--brand) 30%, transparent);
}

/* A/B variant group card */
.ab-variant-group {
    border-radius: var(--radius-md) !important;
    border-color: var(--border);
    background: var(--surface-2);
    padding: 0.85rem 1rem !important;
    transition: border-color var(--transition), background var(--transition);
}

.ab-variant-group:hover {
    border-color: color-mix(in srgb, var(--brand) 35%, transparent);
    background: var(--bg-elevated-strong);
}

/* A/B weight percentage input */
.ab-weight-input {
    max-width: 80px;
    text-align: center;
    font-weight: 600;
}

/* Scheduled redirect group card */
.schedule-group {
    border-radius: var(--radius-md) !important;
    border-color: var(--border);
    background: var(--surface-2);
    padding: 0.85rem 1rem !important;
    transition: border-color var(--transition), background var(--transition);
}

.schedule-group:hover {
    border-color: color-mix(in srgb, var(--brand-3) 35%, transparent);
    background: var(--bg-elevated-strong);
}

/* Health status badges */
.health-badge-healthy {
    color: var(--success);
    font-weight: 600;
}

.health-badge-broken {
    color: var(--danger);
    font-weight: 600;
}

/* API key display (show-once banner) */
.api-key-display {
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    word-break: break-all;
    background: var(--surface-2);
    border: 1px dashed var(--brand);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
}

/* ═══════════════════════════════════════════════════════════════════
   RTL / Arabic — Comprehensive overrides
   Bootstrap RTL bundle handles utility classes (me-*, ms-*, text-start,
   text-end, etc.). The rules below fix custom component positioning
   that relies on physical CSS properties (left/right, border-left, etc.)
   ═══════════════════════════════════════════════════════════════════ */

/* ── Toast notification system ──────────────────────────── */
html[dir='rtl'] .toast-container {
    right: auto;
    left: 1rem;
}

html[dir='rtl'] .toast-item {
    animation-name: slideInLeft;
}

html[dir='rtl'] .toast-item.success { border-left: none;  border-right: 4px solid var(--success); }
html[dir='rtl'] .toast-item.error   { border-left: none;  border-right: 4px solid var(--danger); }
html[dir='rtl'] .toast-item.info    { border-left: none;  border-right: 4px solid var(--brand); }

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ── Notification badge ─────────────────────────────────── */
html[dir='rtl'] .notification-badge {
    right: auto;
    left: -6px;
}

/* ── API key / code displays — keep LTR for readability ── */
html[dir='rtl'] .api-key-display,
html[dir='rtl'] .short-link-display,
html[dir='rtl'] code,
html[dir='rtl'] pre {
    direction: ltr;
    text-align: left;
    unicode-bidi: isolate;
}

/* ── Pricing badge inline style uses left:50% — stays centered, no fix needed ── */

/* ── Dropdown alignment (already handled by Bootstrap RTL, but kept for safety) ── */
html[dir='rtl'] .dropdown-menu-end {
    right: auto !important;
    left: 0 !important;
}

/* ── Custom Branding Logos (Pure CSS) ─────────────────── */
:root {
    --brand-dark: #121826;     /* Sleek premium slate */
    --brand-primary: #1d4ed8;  /* Vibrant blue */
    --brand-muted: #6b7280;    /* Gray for tagline and dot-link */
}

html[data-theme="dark"] {
    --brand-dark: #f8fafc;
    --brand-primary: #3b82f6;
    --brand-muted: #9ca3af;
}

.brand-logo-css {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    user-select: none;
    text-decoration: none !important;
    font-family: 'Inter', sans-serif;
    transition: opacity 0.2s ease;
    direction: ltr !important;
    text-align: left !important;
}
.brand-logo-css:hover {
    opacity: 0.95;
}

.brand-logo-css .brand-name {
    display: flex;
    align-items: center;
    line-height: 1;
    letter-spacing: -0.03em;
}

.brand-logo-css .text-36 {
    color: var(--brand-dark);
    font-weight: 800;
}

.brand-logo-css .icon-0 {
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-logo-css .text-uni {
    color: var(--brand-primary);
    font-weight: 700;
}

.brand-logo-css .text-link {
    color: var(--brand-muted);
    font-weight: 400;
}

.brand-logo-css .tagline {
    font-weight: 500;
    color: var(--brand-muted);
    text-transform: capitalize;
    width: 100%;
    display: flex;
    justify-content: space-between;
}

/* Header Specific Scaling (navbar) */
.logo-header .brand-name {
    font-size: 24px;
}
.logo-header .icon-0 {
    width: 22px;
    height: 22px;
    margin: 0 2px;
}
.logo-header .tagline {
    font-size: 7px;
    letter-spacing: 0.14em;
    margin-top: 4px;
    padding-left: 1px;
}

/* Footer Specific Scaling */
.logo-footer .brand-name {
    font-size: 26px;
}
.logo-footer .icon-0 {
    width: 24px;
    height: 24px;
    margin: 0 2px;
}
.logo-footer .tagline {
    font-size: 7.5px;
    letter-spacing: 0.14em;
    margin-top: 4px;
    padding-left: 1px;
}

