/* OmniLink - Hyper-Clean Minimalist SaaS (Dub.co style) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root, [data-theme="dark"] {
    --bg: #09090b;
    --bg-card: #121215;
    --bg-card-hover: #18181c;
    --bg-input: #18181b;
    --border: #27272a;
    --border-subtle: #1e1e24;
    --border-focus: #3f3f46;
    --text: #fafafa;
    --text-muted: #a1a1aa;
    --text-subtle: #71717a;
    --accent: #10b981;
    --accent-hover: #059669;
    --accent-glow: rgba(16, 185, 129, 0.15);
    --accent-badge: rgba(16, 185, 129, 0.1);
    --danger: #ef4444;
    --danger-badge: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    --warning-badge: rgba(245, 158, 11, 0.1);
    --info-badge: rgba(59, 130, 246, 0.1);
    --info: #3b82f6;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.6);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

[data-theme="light"] {
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-input: #f8fafc;
    --border: #e2e8f0;
    --border-subtle: #edf2f7;
    --border-focus: #cbd5e1;
    --text: #0f172a;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;
    --accent: #10b981;
    --accent-hover: #059669;
    --accent-glow: rgba(16, 185, 129, 0.12);
    --accent-badge: rgba(16, 185, 129, 0.08);
    --danger: #ef4444;
    --danger-badge: rgba(239, 68, 68, 0.08);
    --warning: #d97706;
    --warning-badge: rgba(217, 119, 6, 0.08);
    --info-badge: rgba(59, 130, 246, 0.08);
    --info: #2563eb;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

body {
    font-family: var(--font);
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 80px;
}

/* Header & Nav */
.header {
    border-bottom: 1px solid var(--border);
    background-color: var(--bg);
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(12px);
}

.header-container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: var(--accent);
    color: #000;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 14px var(--accent-glow);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pill-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

.pill-stat strong {
    color: var(--text);
    font-weight: 600;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.icon-btn:hover {
    color: var(--text);
    border-color: var(--border-focus);
    background: var(--bg-card-hover);
}

.icon-btn.active {
    color: var(--accent);
    border-color: var(--accent);
}

/* Layout */
.main-container {
    max-width: 1140px;
    margin: 36px auto 0;
    padding: 0 24px;
}

/* Hero Section */
.hero-header {
    text-align: center;
    margin-bottom: 32px;
}

.hero-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--accent-badge);
    color: var(--accent);
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: 0.02em;
}

.hero-header h1 {
    font-size: 2.3rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}

.hero-header p {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Shortener Box */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

.shortener-box {
    padding: 24px;
    margin-bottom: 40px;
    position: relative;
}

.tabs-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.tab-btn {
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    color: var(--text);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-sm);
}

/* URL Input Row */
.url-input-wrap {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 6px 6px 6px 16px;
    gap: 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.url-input-wrap:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.protocol-badge {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--border);
    color: var(--text-muted);
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.05em;
    user-select: none;
}

.protocol-badge.active {
    background: var(--accent-badge);
    color: var(--accent);
}

.main-url-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 1.05rem;
    color: var(--text);
    min-width: 0;
}

.main-url-input::placeholder {
    color: var(--text-subtle);
}

.btn-shorten {
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: var(--radius);
    padding: 12px 22px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    transition: background 0.15s, transform 0.1s;
}

.btn-shorten:hover {
    background: var(--accent-hover);
}

.btn-shorten:active {
    transform: scale(0.98);
}

/* Options Bar & Collapsible Panels */
.options-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

.option-chip {
    background: transparent;
    border: 1px dashed var(--border);
    color: var(--text-muted);
    border-radius: 9999px;
    padding: 5px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
}

.option-chip:hover {
    border-color: var(--border-focus);
    color: var(--text);
}

.option-chip.active {
    border-style: solid;
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-badge);
}

.expandable-panel {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 14px;
    display: none;
    animation: fadeIn 0.2s ease-out;
}

.expandable-panel.open {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.field-input-wrap {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    gap: 8px;
}

.field-input-wrap:focus-within {
    border-color: var(--accent);
}

.field-prefix {
    color: var(--text-subtle);
    font-size: 0.88rem;
    font-family: monospace;
    user-select: none;
}

.text-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--text);
    min-width: 0;
}

/* Bulk Mode Form */
.bulk-wrap {
    display: none;
}

.bulk-wrap.open {
    display: block;
}

.bulk-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    color: var(--text);
    font-family: monospace;
    font-size: 0.88rem;
    outline: none;
    min-height: 140px;
    resize: vertical;
    margin-bottom: 12px;
}

.bulk-textarea:focus {
    border-color: var(--accent);
}

/* Management Header & Controls */
.mgmt-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 20px;
}

.mgmt-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mgmt-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.search-wrap {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 7px 12px;
    gap: 8px;
    width: 240px;
}

.search-wrap:focus-within {
    border-color: var(--accent);
}

.search-input {
    background: transparent;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--text);
    width: 100%;
}

.select-dropdown {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius);
    padding: 8px 12px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
}

.select-dropdown:focus {
    border-color: var(--accent);
    color: var(--text);
}

.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius);
    padding: 8px 14px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-focus);
}

/* Status Filter Tabs */
.filter-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.filter-tab {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 5px 12px;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.filter-tab:hover {
    color: var(--text);
    background: var(--bg-card);
}

.filter-tab.active {
    color: var(--text);
    background: var(--bg-card);
    border-color: var(--border);
}

.tab-count {
    background: var(--border);
    font-size: 0.72rem;
    padding: 1px 6px;
    border-radius: 9999px;
    color: var(--text-subtle);
}

/* Links List */
.links-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.link-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.link-card:hover {
    border-color: var(--border-focus);
    box-shadow: var(--shadow-sm);
}

.link-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.link-main-info {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-width: 0;
}

.link-favicon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--accent);
}

.link-details {
    min-width: 0;
}

.link-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 4px;
}

.link-title {
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 450px;
}

.badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-active {
    background: var(--accent-badge);
    color: var(--accent);
}

.badge-paused {
    background: var(--warning-badge);
    color: var(--warning);
}

.badge-expired {
    background: var(--danger-badge);
    color: var(--danger);
}

.badge-protected {
    background: var(--info-badge);
    color: var(--info);
}

.link-urls-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.short-url-link {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
}

.short-url-link:hover {
    text-decoration: underline;
}

.target-url-preview {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 550px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.target-url-preview:hover {
    color: var(--text);
}

/* Link Actions */
.link-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
}

.link-metrics {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.click-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 9999px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s;
}

.click-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.link-action-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-action {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 5px 9px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s;
}

.btn-action:hover {
    color: var(--text);
    background: var(--bg-card-hover);
    border-color: var(--border);
}

.btn-action.btn-danger:hover {
    color: var(--danger);
    background: var(--danger-badge);
    border-color: transparent;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius-xl);
}

.empty-icon {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--bg-input);
    color: var(--text-subtle);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 400px;
    margin: 0 auto;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: translateY(8px);
    transition: transform 0.2s ease;
}

.modal-overlay.open .modal-card {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* Slide-over Analytics Drawer */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 110;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.drawer-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.drawer-content {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 600px;
    background: var(--bg);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 120;
    overflow-y: auto;
}

.drawer-overlay.open .drawer-content {
    transform: translateX(0);
}

.drawer-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.drawer-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Analytics Cards */
.analytics-metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
}

.metric-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.chart-card h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.breakdown-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.85rem;
}

.breakdown-bar-bg {
    flex: 1;
    height: 6px;
    background: var(--bg-input);
    border-radius: 9999px;
    margin: 0 12px;
    overflow: hidden;
}

.breakdown-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 9999px;
    transition: width 0.4s ease;
}

/* QR Code Section */
.qr-preview-box {
    background: #ffffff;
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.color-swatches {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s;
}

.color-swatch:hover {
    transform: scale(1.1);
}

.color-swatch.selected {
    border-color: var(--text);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 200;
    pointer-events: none;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 18px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
    animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.toast-success {
    border-left: 4px solid var(--accent);
}

.toast.toast-error {
    border-left: 4px solid var(--danger);
}

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

/* Responsive */
@media (max-width: 768px) {
    .hero-header h1 { font-size: 1.8rem; }
    .url-input-wrap { flex-direction: column; padding: 12px; }
    .main-url-input { width: 100%; }
    .btn-shorten { width: 100%; justify-content: center; }
    .mgmt-header { flex-direction: column; align-items: stretch; }
    .mgmt-controls { width: 100%; justify-content: space-between; }
    .search-wrap { width: 100%; }
    .link-card-bottom { flex-direction: column; align-items: flex-start; }
    .link-action-buttons { width: 100%; justify-content: space-between; }
    .analytics-metrics-grid { grid-template-columns: 1fr; }
}
