html {
    font-size: 93.75%; /* 15px base — a calmer, more compact scale than the browser default */
}

:root {
    /* Brand — one restrained two-stop gradient, used sparingly (primary buttons only) */
    --i-brand-1: #4f46e5;
    --i-brand-2: #6d28d9;
    --i-brand-gradient: linear-gradient(135deg, var(--i-brand-1) 0%, var(--i-brand-2) 100%);

    /* Surfaces */
    --i-bg: #f7f7f9;
    --i-surface: #ffffff;
    --i-surface-2: #f2f2f6;
    --i-text: #1c1d2b;
    --i-muted: #71738c;
    --i-border: #e7e7ee;
    --i-shadow: 0 1px 2px rgba(20, 21, 43, 0.04), 0 6px 16px -8px rgba(20, 21, 43, 0.08);
    --i-shadow-lg: 0 12px 32px -12px rgba(20, 21, 43, 0.18);

    /* Interactive */
    --i-primary: var(--i-brand-1);
    --i-primary-contrast: #ffffff;
    --i-radius: 14px;
    --i-radius-sm: 10px;
    --i-font: 'Inter', 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --i-bg: #0e0e16;
        --i-surface: #17171f;
        --i-surface-2: #1e1e29;
        --i-text: #eeeef2;
        --i-muted: #9495a8;
        --i-border: #2a2a37;
        --i-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 16px -8px rgba(0, 0, 0, 0.4);
        --i-shadow-lg: 0 12px 32px -12px rgba(0, 0, 0, 0.55);
    }
}

html, body {
    background: var(--i-bg);
    color: var(--i-text);
    font-family: var(--i-font);
    font-size: 0.95rem;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* ---------- Shared brand bits ---------- */
.i-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--i-brand-gradient);
    color: var(--i-primary-contrast);
    font-weight: 700;
    font-size: 0.95rem;
}

.i-btn-gradient {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: var(--i-brand-gradient);
    color: #fff !important;
    border: none;
    padding: 0.65rem 1.4rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none !important;
    box-shadow: 0 6px 16px -6px rgba(79, 70, 229, 0.45);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.i-btn-gradient:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px -6px rgba(79, 70, 229, 0.5);
    color: #fff;
}

.i-btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: var(--i-surface);
    color: var(--i-text) !important;
    border: 1px solid var(--i-border);
    padding: 0.6rem 1.35rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none !important;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.i-btn-ghost:hover {
    border-color: var(--i-brand-1);
    color: var(--i-brand-1) !important;
}

/* ---------- Landing page ---------- */
.i-hero {
    background: var(--i-bg);
    font-family: var(--i-font);
}

.i-hero-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1080px;
    margin: 0 auto;
    padding: 1.25rem 1.5rem;
}

.i-hero-nav .i-brand-name {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--i-text);
}

.i-hero-content {
    max-width: 640px;
    margin: 0 auto;
    padding: 3rem 1.5rem 3.5rem;
    text-align: center;
}

.i-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--i-surface-2);
    border: 1px solid var(--i-border);
    color: var(--i-muted);
    padding: 0.3rem 0.85rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
}

.i-hero h1 {
    font-family: var(--i-font);
    font-size: clamp(1.6rem, 3.4vw, 2.1rem);
    line-height: 1.3;
    font-weight: 700;
    margin: 0 0 0.75rem;
    color: var(--i-text);
}

.i-hero p.i-hero-sub {
    font-size: 0.95rem;
    color: var(--i-muted);
    max-width: 480px;
    margin: 0 auto 1.75rem;
    line-height: 1.65;
}

.i-landing-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.i-hero-hint {
    color: var(--i-muted);
    font-size: 0.78rem;
}

/* Feature strip */
.i-features {
    background: var(--i-bg);
    padding: 0 1.5rem 4rem;
}

.i-features-grid {
    max-width: 920px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.i-feature-card {
    background: var(--i-surface);
    border: 1px solid var(--i-border);
    border-radius: var(--i-radius);
    padding: 1.35rem;
    box-shadow: var(--i-shadow);
}

.i-feature-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--i-surface-2);
    color: var(--i-brand-1);
    margin-bottom: 0.85rem;
    font-size: 1rem;
}

.i-feature-card h3 {
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.i-feature-card p {
    color: var(--i-muted);
    font-size: 0.82rem;
    line-height: 1.55;
    margin: 0;
}

/* ---------- Account pages (login/register) ---------- */
.i-auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    background: var(--i-bg);
    font-family: var(--i-font);
}

.account-page {
    width: 100%;
    max-width: 380px;
    background: var(--i-surface);
    border: 1px solid var(--i-border);
    border-radius: var(--i-radius);
    box-shadow: var(--i-shadow);
    padding: 2rem 1.75rem;
}

.i-auth-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.i-auth-header .i-brand-mark {
    margin: 0 auto 0.85rem;
}

.i-auth-header h1 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 0.3rem;
}

.i-auth-header p {
    color: var(--i-muted);
    font-size: 0.82rem;
    margin: 0;
}

.account-page .i-lang-switch {
    justify-content: center;
    margin-bottom: 1.1rem;
}

.account-form .form-group {
    margin-bottom: 1rem;
}

.account-form label {
    display: block;
    font-weight: 600;
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
    color: var(--i-text);
}

.account-form .form-control {
    border-radius: var(--i-radius-sm);
    border: 1px solid var(--i-border);
    padding: 0.55rem 0.8rem;
    background: var(--i-surface-2);
    font-size: 0.88rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.account-form .form-control:focus {
    border-color: var(--i-brand-1);
    background: var(--i-surface);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.account-form button[type="submit"] {
    width: 100%;
    border: none;
    background: var(--i-brand-gradient);
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.65rem 1rem;
    border-radius: var(--i-radius-sm);
    margin-top: 0.25rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.account-form button[type="submit"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px -8px rgba(79, 70, 229, 0.5);
}

.account-page p.mt-3 {
    text-align: center;
    color: var(--i-muted);
    font-size: 0.82rem;
}

.account-page p.mt-3 a {
    color: var(--i-brand-1);
    font-weight: 600;
    text-decoration: none;
}

.account-page p.mt-3 a:hover {
    text-decoration: underline;
}

/* ---------- Public profile card ---------- */
.i-card-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 3rem 1rem 2rem;
    background: var(--i-bg);
    color: var(--i-text);
    font-family: var(--i-font);
}

.i-card {
    width: 100%;
    max-width: 380px;
    background: var(--i-surface);
    border: 1px solid var(--i-border);
    border-radius: 20px;
    padding: 2rem 1.5rem 1.75rem;
    text-align: center;
    box-shadow: var(--i-shadow-lg);
}

.i-avatar {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
    border: 2px solid var(--i-border);
}

.i-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--i-brand-gradient);
    color: var(--i-primary-contrast);
    font-size: 2rem;
    font-weight: 700;
    margin-inline: auto;
}

.i-display-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}

.i-username {
    color: var(--i-muted);
    margin: 0.2rem 0 0.9rem;
    direction: ltr;
    unicode-bidi: embed;
    font-size: 0.82rem;
}

.i-bio {
    margin-bottom: 1.4rem;
    line-height: 1.6;
    color: var(--i-text);
    font-size: 0.87rem;
}

.i-links {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.i-link-btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.9rem;
    border-radius: var(--i-radius-sm);
    background: var(--i-surface-2);
    border: 1px solid var(--i-border);
    color: var(--i-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.87rem;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.i-link-btn:hover {
    border-color: var(--i-brand-1);
    background: var(--i-surface);
    color: var(--i-text);
}

.i-link-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex: none;
    border-radius: 8px;
    background: var(--i-surface);
    color: var(--i-brand-1);
    font-size: 0.85rem;
}

.i-link-text {
    flex: 1;
    text-align: center;
    margin-inline-end: 26px;
}

.i-share {
    margin-top: 1.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
}

.i-qr {
    border-radius: 10px;
    border: 1px solid var(--i-border);
    padding: 6px;
    background: #fff;
}

.i-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid var(--i-border);
    background: var(--i-surface);
    color: var(--i-text);
    padding: 0.45rem 1.1rem;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.78rem;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.i-copy-btn:hover {
    border-color: var(--i-brand-1);
    color: var(--i-brand-1);
}

.i-copy-btn.i-copied {
    border-color: #16a34a;
    color: #16a34a;
}

.i-card .i-lang-switch {
    margin-top: 1.5rem;
    margin-bottom: 0;
}

.i-powered-by {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1.5rem;
    color: var(--i-muted);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
}

.i-powered-by:hover {
    color: var(--i-brand-1);
}

.i-brand-mark-xs {
    width: 18px;
    height: 18px;
    font-size: 0.62rem;
    border-radius: 6px;
}

.i-notfound {
    max-width: 360px;
    margin: 10vh auto 0;
    text-align: center;
    font-family: var(--i-font);
    padding: 2rem 1.5rem;
    background: var(--i-surface);
    border: 1px solid var(--i-border);
    border-radius: 20px;
    box-shadow: var(--i-shadow-lg);
}

.i-notfound-mark {
    margin: 0.25rem auto 1rem;
}

.i-notfound h1 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.i-notfound p {
    color: var(--i-muted);
    margin: 0;
    font-size: 0.85rem;
}

/* Language switcher */
.i-lang-switch {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    margin-bottom: 0.85rem;
}

.i-lang-switch a {
    color: var(--i-muted);
    text-decoration: none;
    font-weight: 600;
}

.i-lang-switch a:hover {
    color: var(--i-brand-1);
}

.i-lang-switch span {
    color: var(--i-border);
}

/* ---------- Dashboard ---------- */
.i-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.i-page-header h1 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
}

.i-share-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem 1rem;
    background: var(--i-surface);
    border: 1px solid var(--i-border);
    border-radius: var(--i-radius-sm);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
}

.i-share-row-label {
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--i-muted);
    flex: none;
}

.i-share-row-main {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex: 1;
}

.i-share-url {
    background: var(--i-surface-2);
    border: 1px solid var(--i-border);
    border-radius: 999px;
    padding: 0.32rem 0.85rem;
    font-size: 0.78rem;
    color: var(--i-text);
    direction: ltr;
}

.i-form-section {
    background: var(--i-surface);
    border: 1px solid var(--i-border);
    border-radius: var(--i-radius);
    padding: 1.25rem 1.35rem;
    margin-bottom: 1rem;
}

.i-form-section-title {
    font-size: 0.88rem;
    font-weight: 700;
    margin: 0 0 0.15rem;
}

.i-form-section-hint {
    color: var(--i-muted);
    font-size: 0.78rem;
    margin: 0 0 1rem;
}

.i-avatar-upload {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.i-avatar-upload-preview {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    flex: none;
    border: 1px solid var(--i-border);
}

.i-avatar-upload-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--i-brand-gradient);
    color: #fff;
    font-size: 1.3rem;
    font-weight: 700;
}

.i-avatar-upload-controls {
    flex: 1;
    min-width: 200px;
}

.i-field-hint {
    display: block;
    color: var(--i-muted);
    font-size: 0.74rem;
    margin-top: 0.3rem;
}

.i-remove-avatar-btn {
    border: none;
    background: none;
    color: #e11d48;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.3rem 0;
    cursor: pointer;
}

.i-remove-avatar-btn:hover {
    text-decoration: underline;
}

.i-theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
    gap: 0.5rem;
}

.i-theme-option {
    border: 1px solid var(--i-border);
    border-radius: var(--i-radius-sm);
    padding: 0.5rem 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.i-theme-option.selected {
    border-color: var(--i-brand-1);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.i-links-editor {
    list-style: none;
    padding: 0;
    margin: 0;
}

.i-link-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    border: 1px solid var(--i-border);
    border-radius: var(--i-radius-sm);
    padding: 0.7rem;
    margin-bottom: 0.55rem;
    background: var(--i-surface);
}

.i-drag-handle {
    cursor: grab;
    color: var(--i-muted);
    user-select: none;
    font-size: 1rem;
}

.i-link-row .i-link-fields {
    flex: 1;
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 0.45rem;
}

/* Add-new-link form */
.i-add-link-form {
    max-width: 440px;
    background: var(--i-surface);
    border: 1px solid var(--i-border);
    border-radius: var(--i-radius-sm);
    padding: 1.1rem;
}

.i-add-link-row {
    margin-bottom: 0.85rem;
}

.i-add-link-row label {
    display: block;
    font-weight: 600;
    font-size: 0.78rem;
    margin-bottom: 0.3rem;
    color: var(--i-text);
}

.i-mode-toggle {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.85rem;
}

.i-mode-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: 1px solid var(--i-border);
    border-radius: var(--i-radius-sm);
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--i-muted);
    transition: border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.i-mode-option input {
    accent-color: var(--i-brand-1);
}

.i-mode-option.selected {
    border-color: var(--i-brand-1);
    color: var(--i-brand-1);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.i-prefixed-input {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--i-border);
    border-radius: var(--i-radius-sm);
    overflow: hidden;
    background: var(--i-surface-2);
}

.i-prefixed-input:focus-within {
    border-color: var(--i-brand-1);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.i-input-prefix {
    display: flex;
    align-items: center;
    padding: 0 0.55rem;
    color: var(--i-muted);
    font-size: 0.78rem;
    background: var(--i-border);
    white-space: nowrap;
    direction: ltr;
}

.i-prefixed-input .form-control {
    border: none;
    border-radius: 0;
    background: transparent;
    direction: ltr;
    text-align: start;
}

.i-prefixed-input .form-control:focus {
    box-shadow: none;
}

/* Password visibility toggle */
.i-password-field {
    position: relative;
}

.i-password-field .form-control {
    padding-inline-end: 2.5rem;
}

.i-password-toggle {
    position: absolute;
    inset-inline-end: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.2rem;
    color: var(--i-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.i-password-toggle svg {
    width: 17px;
    height: 17px;
}

.i-password-toggle:hover {
    color: var(--i-brand-1);
}

.i-logout-link {
    background: none;
    border: none;
    text-align: start;
    width: 100%;
    padding: 0;
    color: inherit;
    cursor: pointer;
}

.i-stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}

.i-stat-card {
    background: var(--i-surface);
    border: 1px solid var(--i-border);
    border-radius: var(--i-radius-sm);
    padding: 1rem;
    text-align: center;
}

.i-stat-card .i-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
    color: var(--i-brand-1);
}

.i-stat-card .i-stat-label {
    color: var(--i-muted);
    font-size: 0.78rem;
}

/* ---------- Bootstrap component harmonization ---------- */
.btn {
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.87rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn-sm {
    font-size: 0.78rem;
}

.btn-primary {
    background: var(--i-brand-gradient);
    border: none;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--i-brand-gradient);
    transform: translateY(-1px);
    box-shadow: 0 8px 18px -8px rgba(79, 70, 229, 0.5);
}

.btn-outline-secondary {
    color: var(--i-text);
    border: 1px solid var(--i-border);
    background: var(--i-surface);
}

.btn-outline-secondary:hover {
    border-color: var(--i-brand-1);
    color: var(--i-brand-1);
    background: var(--i-surface);
}

.btn-outline-danger {
    border: 1px solid #fecdd3;
    color: #e11d48;
    background: transparent;
}

.btn-outline-danger:hover {
    background: #fef2f4;
    border-color: #e11d48;
    color: #e11d48;
}

.form-select,
.form-control {
    border-radius: var(--i-radius-sm);
    font-size: 0.87rem;
}

.form-check-input:checked {
    background-color: var(--i-brand-1);
    border-color: var(--i-brand-1);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

h1 {
    font-size: 1.2rem;
}

h2 {
    font-size: 1rem;
}

table {
    font-size: 0.85rem;
}

/* ---------- RTL / LTR ---------- */
html[dir="rtl"] .i-link-row {
    direction: rtl;
}
