/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06);
    --card-shadow-hover: 0 4px 12px rgba(0,0,0,0.08), 0 8px 24px rgba(0,0,0,0.01);
    --input-bg: #ffffff;
    --modal-bg: #ffffff;
    --hover-bg: #f1f5f9;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-dark: #312e81;
    --bg-accent: #eef2ff;
    --shadow-xs: 0 0.5px 1px rgba(0,0,0,0.02);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 10px 10px -5px rgba(0,0,0,0.03);
    --shadow-2xl: 0 25px 30px -5px rgba(0,0,0,0.12);
    --shadow-accent-sm: 0 2px 4px -1px rgba(99, 102, 241, 0.05);
    --shadow-accent-md: 0 4px 6px -1px rgba(99, 102, 241, 0.1);
    --shadow-accent-lg: 0 6px 8px -1px rgba(99, 102, 241, 0.15);
    --shadow-accent-xl: 0 8px 10px -1px rgba(99, 102, 241, 0.2);
}

.dark-mode {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 4px 12px rgba(0,0,0,0.3);
    --card-shadow-hover: 0 4px 12px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.4);
    --input-bg: #334155;
    --modal-bg: #1e293b;
    --hover-bg: #334155;
    --accent-primary: #818cf8;
    --accent-secondary: #a78bfa;
    --accent-dark: #c7d2fe;
    --bg-accent: #312e81;
    --shadow-xs: 0 0.5px 1px rgba(0,0,0,0.08);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -1px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4), 0 4px 6px -2px rgba(0,0,0,0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.5), 0 10px 10px -5px rgba(0,0,0,0.3);
    --shadow-2xl: 0 25px 30px -5px rgba(0,0,0,0.6);
    --shadow-accent-sm: 0 2px 4px -1px rgba(129, 140, 248, 0.1);
    --shadow-accent-md: 0 4px 6px -1px rgba(129, 140, 248, 0.15);
    --shadow-accent-lg: 0 6px 8px -1px rgba(129, 140, 248, 0.2);
    --shadow-accent-xl: 0 8px 10px -1px rgba(129, 140, 248, 0.25);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

/* App Body (sidebar + main) */
.app-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ===== NAVBAR ===== */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, #06b6d4 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--hover-bg) 100%);
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.user-badge:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.user-badge i {
    color: var(--accent-primary);
}

.theme-toggle {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--hover-bg) 100%);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
    border-color: var(--accent-secondary);
    background: linear-gradient(135deg, var(--bg-accent) 0%, var(--hover-bg) 100%);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px) rotate(0deg);
}

.theme-toggle i {
    font-size: 1.1rem;
    transition: transform 0.25s ease;
}

.theme-toggle:hover i {
    transform: rotate(-5deg);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.25s ease;
    box-shadow: var(--shadow-sm);
}

.logout-btn:hover {
    border-color: #dc2626;
    color: #dc2626;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    box-shadow: var(--shadow-md), 0 0 20px rgba(220, 38, 38, 0.15);
    transform: translateY(-2px);
}

.sidebar-desktop-footer {
    display: flex;
    flex-direction: column;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    background: rgba(0,0,0,0.02);
}

.sidebar-mobile-footer {
    display: none;
    flex-direction: column;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    background: rgba(0,0,0,0.02);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
    cursor: default;
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user i {
    flex-shrink: 0;
    font-size: 1.1rem;
    color: var(--accent-primary);
}

.sidebar-actions {
    display: flex;
    flex-direction: column;
}

.sidebar-actions .btn-secondary {
    border: none;
    width: 100%;
    font-family: inherit;
    font-size: inherit;
    background: none;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0;
    transition: background 0.2s;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-actions .btn-secondary:hover {
    background: var(--hover-bg);
}

.sidebar-actions .btn-secondary i {
    flex-shrink: 0;
    font-size: 1.1rem;
    width: 1.4rem;
    text-align: center;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--hover-bg) 100%);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
}

.sidebar-footer-nav {
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding: 0.5rem 0;
    background: rgba(0,0,0,0.02);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    position: relative;
}

.nav-item:hover {
    background: linear-gradient(90deg, var(--hover-bg) 0%, transparent 100%);
    color: var(--text-primary);
}

.nav-item:hover::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-primary);
    opacity: 0.5;
}

.nav-item.active {
    background: linear-gradient(90deg, var(--bg-accent) 0%, transparent 100%);
    color: var(--accent-primary);
    border-left-color: var(--accent-primary);
    font-weight: 500;
}

.nav-item.active::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background: var(--accent-primary);
    border-radius: 50%;
}

.nav-item i {
    width: 20px;
    text-align: center;
    transition: transform 0.2s ease;
}

.nav-item:hover i {
    transform: translateY(-2px);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--hover-bg) 100%);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.content-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Search Box */
.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.search-box:focus-within {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md), 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-box i {
    color: var(--text-secondary);
    margin-right: 0.5rem;
    transition: color 0.2s ease;
}

.search-box:focus-within i {
    color: var(--accent-primary);
}

.search-box input {
    border: none;
    outline: none;
    font-size: 0.875rem;
    width: 200px;
    background: transparent;
    color: var(--text-primary);
}

/* Links Container */
.links-container {
    background: var(--bg-secondary);
    border-radius: 1rem;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.links-container:hover {
    box-shadow: var(--card-shadow-hover);
}

.loading-state {
    padding: 3rem;
    text-align: center;
    color: var(--text-secondary);
}

.loading-state i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Link Card */
.link-card {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
    position: relative;
}

.link-card:last-child {
    border-bottom: none;
}

.link-card:hover {
    background: linear-gradient(90deg, var(--hover-bg) 0%, transparent 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.link-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-md), 0 0 20px rgba(99, 102, 241, 0.3);
    transition: all 0.25s ease;
}

.link-card:hover .link-icon {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg), 0 0 25px rgba(99, 102, 241, 0.4);
}

.link-info {
    flex: 1;
    min-width: 0;
}

.link-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s ease;
    text-decoration: none;
    cursor: pointer;
}

.link-title:hover {
    color: var(--accent-primary);
}

.link-card:hover .link-title {
    color: var(--accent-primary);
}

.link-url {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: monospace;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.short-url-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

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

.link-arrow {
    color: var(--text-secondary);
    margin: 0 0.25rem;
}

.long-url-link {
    color: var(--text-secondary);
    text-decoration: none;
}

.long-url-link:hover {
    color: #667eea;
    text-decoration: underline;
}

.link-stats {
    display: flex;
    gap: 1.5rem;
    margin-left: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.5rem;
    background: var(--hover-bg);
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.stat-item:hover {
    background: var(--bg-accent);
    color: var(--accent-primary);
}

.link-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--hover-bg) 100%);
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.btn-icon:hover {
    background: linear-gradient(135deg, var(--hover-bg) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.btn-icon.danger:hover {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #dc2626;
    border-color: #fecaca;
    box-shadow: var(--shadow-md), 0 0 15px rgba(220, 38, 38, 0.2);
}

/* Tags */
.tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: linear-gradient(135deg, var(--hover-bg) 0%, var(--bg-accent) 100%);
    color: var(--text-secondary);
    border-radius: 1rem;
    font-size: 0.75rem;
    margin-right: 0.25rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.tag:hover {
    background: linear-gradient(135deg, var(--bg-accent) 0%, var(--hover-bg) 100%);
    color: var(--accent-primary);
}

/* Grafana Notice */
.grafana-notice {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.grafana-notice i {
    font-size: 1.5rem;
    color: #667eea;
    margin-top: 0.25rem;
}

.grafana-notice strong {
    display: block;
    margin-bottom: 0.5rem;
}

.grafana-notice p {
    margin: 0.25rem 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Grafana Container */
#analyticsTab {
    padding: 0;
    height: 100%;
    overflow: hidden;
}

.grafana-container {
    background: var(--bg-secondary);
    overflow: hidden;
    height: 100%;
    width: 100%;
}

.grafana-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    overflow: hidden;
}

/* Settings Section */
.settings-section {
    margin-bottom: 1.5rem;
}

.settings-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.settings-title i {
    color: #667eea;
}

.settings-card {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--hover-bg) 100%);
    border-radius: 1rem;
    padding: 1rem 1.5rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    transition: all 0.25s ease;
}

.settings-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
}

#apiKeySection {
    display: none;
}

#apiKeySection.admin-visible {
    display: block;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.setting-value {
    color: var(--text-primary);
    font-weight: 500;
}

.setting-item.column {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.email-edit-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.email-input {
    flex: 1;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.email-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md), 0 0 0 3px rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

.setting-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

.settings-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.api-key-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Settings API key display */
.api-key-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.api-key-value {
    flex: 1;
    background: var(--hover-bg);
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-family: monospace;
    font-size: 0.875rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.api-key {
    flex: 1;
    background: var(--hover-bg);
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-family: monospace;
    font-size: 0.875rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 52px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 28px;
    border: 2px solid var(--border-color);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--accent-primary, #4f46e5);
    border-color: var(--accent-primary, #4f46e5);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Export Section */
.export-section {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--hover-bg) 100%);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    transition: all 0.25s ease;
}

.export-section:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
}

.export-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.export-title i {
    color: #667eea;
}

.export-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.export-options {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--modal-bg);
    border-radius: 1rem;
    padding: 1.5rem;
    width: 100%;
    max-width: 640px;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    margin: 1rem;
    box-shadow: var(--shadow-xl), 0 0 40px rgba(0,0,0,0.15);
    animation: slideUp 0.3s ease;
    border: 1px solid var(--border-color);
}

.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.modal-content::-webkit-scrollbar-thumb {
    background-color: rgba(128, 128, 128, 0.3);
    border-radius: 3px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background-color: rgba(128, 128, 128, 0.5);
}

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

.modal-small {
    max-width: 400px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-primary);
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 140px;
}

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

.toggle-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.toggle-label span:first-child {
    font-weight: 500;
    color: var(--text-primary);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.2s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.2s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--accent-primary, #4f46e5);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

.modal-content > p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Form */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background: var(--input-bg);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md), 0 0 0 3px rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.url-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 400;
    padding: 0.125rem 0.5rem;
    border-radius: 1rem;
    background: #e0e7ff;
    color: #4338ca;
    transition: all 0.2s;
}

.url-status.changed {
    background: #d1fae5;
    color: #059669;
}

.url-status i {
    font-size: 0.75rem;
}

/* Buttons */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn-primary {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: var(--shadow-md), 0 0 20px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(99, 102, 241, 0.35);
    background: linear-gradient(135deg, #5558e8 0%, #7c4fe3 100%);
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    color: var(--accent-dark);
    border: 2px solid var(--border-color);
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    border-color: var(--accent-primary);
    background: linear-gradient(135deg, var(--bg-accent) 0%, var(--hover-bg) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(99, 102, 241, 0.25);
}

.view-toggle-animated {
    overflow: hidden;
}

.view-toggle-animated i {
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55), opacity 0.3s ease;
}

.view-toggle-animated:hover i {
    transform: translateY(-2px);
}

.view-toggle-animated:active i {
    transform: scale(0.9) rotate(180deg);
}

.btn-danger {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: var(--shadow-md);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(220, 38, 38, 0.25);
}

.btn-danger-icon {
    color: #dc2626 !important;
}

.btn-danger-icon:hover {
    color: #b91c1c !important;
    background: rgba(220, 38, 38, 0.1);
}

/* Empty State */
.empty-state {
    padding: 3rem;
    text-align: center;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    color: var(--border-color);
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.125rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* Mobile Navigation Toggle */
.mobile-nav-toggle {
    display: none;
    position: fixed;
    top: 73px;
    left: 1rem;
    z-index: 1001;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    width: 44px;
    height: 44px;
    border-radius: 0.5rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Error Toast */
.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 1rem 1.5rem;
    background: #1f2937;
    color: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    z-index: 1001;
    display: none;
    max-width: calc(100vw - 3rem);
}

.toast.show {
    display: block;
    animation: slideIn 0.3s ease;
}

.toast.success {
    background: #059669;
}

.toast.error {
    background: #dc2626;
}

@keyframes slideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 900px) {
    .search-box input {
        width: 150px;
    }
    
    .link-stats {
        display: none;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 12px 16px;
    }
    
    .logo {
        font-size: 1.25rem;
    }

    .navbar .user-badge {
        display: none;
    }

    .navbar .lang-dropdown {
        display: none;
    }

    .navbar .theme-toggle {
        display: none;
    }

    .navbar .logout-btn {
        display: none;
    }

    .sidebar-desktop-footer {
        display: none;
    }

    .sidebar-mobile-footer {
        display: flex;
    }

    .sidebar-mobile-footer .sidebar-user span {
        display: none;
    }

    .sidebar-mobile-footer .sidebar-user {
        justify-content: center;
        padding: 0.75rem;
    }

    .sidebar-mobile-footer .nav-item span,
    .sidebar-mobile-footer .sidebar-actions .btn-secondary span {
        display: none;
    }

    .sidebar-mobile-footer .nav-item,
    .sidebar-mobile-footer .sidebar-actions .btn-secondary {
        justify-content: center;
        padding: 0.75rem;
    }
    
    .sidebar {
        width: 60px;
    }
    
    .nav-item span {
        display: none;
    }
    
    .nav-item {
        justify-content: center;
        padding: 0.875rem;
    }
    
    .nav-item.active {
        border-left: none;
        border-bottom-color: var(--accent-primary);
    }
    
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .header-actions {
        width: 100%;
    }
    
    .search-box {
        width: 100%;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .link-card {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .link-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 0.5rem;
    }
    
    .link-code {
        display: none;
    }
    
    .link-url {
        display: none;
    }
    
    .link-item .link-title {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }
    
    .link-item {
        flex-wrap: nowrap;
    }
    
    .link-meta {
        margin: 0 0.5rem 0 0;
        gap: 0.5rem;
        flex-shrink: 0;
        order: -1;
    }
    
    .link-info {
        flex-direction: column;
        flex: 1;
        min-width: 0;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .modal-content {
        margin: 1rem;
        padding: 1.25rem;
    }
}

/* ===== EASTER EGG ===== */
.easter-egg {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.5s ease;
    cursor: pointer;
}

.easter-egg.show {
    display: flex;
}

.easter-egg-content {
    text-align: center;
    color: white;
    padding: 3rem;
    pointer-events: auto;
    cursor: default;
}

.magic-wand-container {
    position: relative;
    width: 280px;
    height: 280px;
    margin: 0 auto 4rem;
}

/* Magic Wand */
.magic-wand {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    animation: waveWand 1s ease-in-out infinite;
}

@keyframes waveWand {
    0%, 100% { transform: translate(-50%, -50%) rotate(-45deg); }
    25% { transform: translate(-50%, -50%) rotate(-30deg); }
    50% { transform: translate(-50%, -50%) rotate(-60deg); }
    75% { transform: translate(-50%, -50%) rotate(-30deg); }
}

.wand-handle {
    width: 24px;
    height: 50px;
    background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
    border-radius: 6px;
    margin: 0 auto;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.wand-body {
    width: 14px;
    height: 100px;
    background: linear-gradient(180deg, #fef3c7 0%, #fcd34d 30%, #b8860b 70%, #78350f 100%);
    margin: 0 auto;
    border-radius: 3px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.wand-tip {
    width: 24px;
    height: 24px;
    background: radial-gradient(circle, #fff 0%, #fbbf24 40%, #f59e0b 100%);
    border-radius: 50%;
    margin: 0 auto;
    animation: glow 0.6s ease-in-out infinite alternate;
}

@keyframes glow {
    0% { box-shadow: 0 0 15px #fbbf24, 0 0 30px #f59e0b, 0 0 45px #fbbf24; }
    100% { box-shadow: 0 0 25px #fff, 0 0 50px #fbbf24, 0 0 75px #a78bfa; }
}

/* Sparkles */
.sparkles {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.sparkle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    animation: sparkle 2s ease-in-out infinite;
}

.sparkle::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: inherit;
    border-radius: 50%;
    animation: sparklePulse 0.8s ease-in-out infinite alternate;
}

.s1 { top: -110px; left: 0; animation-delay: 0s; }
.s2 { top: -78px; left: 78px; animation-delay: 0.25s; }
.s3 { top: 0; left: 110px; animation-delay: 0.5s; }
.s4 { top: 78px; left: 78px; animation-delay: 0.75s; }
.s5 { top: 110px; left: 0; animation-delay: 1s; }
.s6 { top: 78px; left: -78px; animation-delay: 1.25s; }
.s7 { top: 0; left: -110px; animation-delay: 1.5s; }
.s8 { top: -78px; left: -78px; animation-delay: 1.75s; }

@keyframes sparkle {
    0%, 100% { 
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% { 
        transform: scale(1.8) rotate(180deg);
        opacity: 0.3;
    }
}

@keyframes sparklePulse {
    0% { transform: scale(1); box-shadow: 0 0 10px white; }
    100% { transform: scale(1.5); box-shadow: 0 0 25px #fbbf24, 0 0 40px white; }
}

/* Magic Circle */
.magic-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 50%;
    animation: rotateCircle 4s linear infinite;
}

.magic-circle::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    border: 1px dashed rgba(255,255,255,0.1);
    border-radius: 50%;
    animation: rotateCircle 3s linear infinite reverse;
}

@keyframes rotateCircle {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Magic Text */
.magic-text {
    font-size: 4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    background: linear-gradient(135deg, #fbbf24 0%, #fff 40%, #a78bfa 70%, #fbbf24 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
    animation: textGlow 2s ease-in-out infinite alternate;
}

@keyframes textGlow {
    0% { filter: drop-shadow(0 0 15px rgba(251, 191, 36, 0.4)); }
    100% { filter: drop-shadow(0 0 30px rgba(167, 139, 250, 0.6)); }
}

.magic-subtext {
    font-size: 1.5rem;
    color: rgba(255,255,255,0.7);
    margin-bottom: 3rem;
    letter-spacing: 0.05em;
    font-weight: 300;
}

.magic-close {
    padding: 14px 40px;
    background: transparent;
    border: 2px solid rgba(255,255,255,0.25);
    border-radius: 50px;
    color: rgba(255,255,255,0.9);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.4s ease;
    backdrop-filter: blur(10px);
}

.magic-close:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.5);
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255,255,255,0.15);
}

/* Logo click animation */
.logo {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.logo:active {
    transform: scale(0.95);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 480px) {
    .navbar {
        padding: 12px 16px 12px 60px;
    }

    .mobile-nav-toggle {
        display: flex;
        top: 12px;
        left: 12px;
        right: auto;
        z-index: 1002;
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    .mobile-nav-toggle.hidden {
        opacity: 0;
        pointer-events: none;
        transform: translateX(-10px);
    }

    .modal-content {
        max-width: calc(100vw - 2rem);
        margin: 0.5rem;
        padding: 1rem;
    }

    .modal-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .modal-actions button {
        width: 100%;
    }

    #campaignsTab {
        padding-top: 1rem;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 73px;
        height: calc(100vh - 73px);
        z-index: 1001;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        transform: translateX(-100%);
        width: 140px;
        max-width: 85vw;
        box-shadow: var(--shadow-xl);
        border-top: 1px solid var(--border-color);
    }

    .sidebar-user {
        justify-content: flex-start;
        gap: 0.75rem;
        padding: 0.875rem 1rem;
    }

    .sidebar-user span {
        display: inline;
    }

    .sidebar-user i {
        font-size: 1.1rem;
    }

    .sidebar-actions .btn-secondary {
        justify-content: flex-start;
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }

    .sidebar-actions .btn-secondary span {
        display: inline;
    }

    .sidebar-actions .btn-secondary i {
        font-size: 1.1rem;
    }

    .nav-item i {
        font-size: 1.4rem;
    }

    .sidebar-mobile-footer .nav-item span {
        display: inline;
    }

    .link-url {
        display: none;
    }

    .link-code {
        display: none;
    }

    .link-item {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .link-info {
        flex: 1 1 auto;
        min-width: 0;
    }

    .link-title {
        font-size: 0.95rem;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }

    .link-meta {
        margin: 0;
        gap: 0.5rem;
    }

    .link-actions {
        width: auto;
        margin-top: 0;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 73px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        backdrop-filter: blur(2px);
        z-index: 1000;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .sidebar-overlay.show {
        display: block;
        opacity: 1;
    }
    
    .link-icon {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }
    
    .main-content {
        padding: 0.75rem;
    }
    
    .content-header {
        padding: 0 0.25rem;
    }
    
    .btn-icon {
        width: 44px;
        height: 44px;
    }
    
    .campaign-actions {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .campaign-actions .btn-secondary,
    .campaign-actions .btn-danger {
        padding: 0.5rem;
        min-width: 40px;
        height: 40px;
        justify-content: center;
        font-size: 0;
        border-radius: 0.5rem;
    }
    
    .campaign-actions .btn-secondary i,
    .campaign-actions .btn-danger i {
        font-size: 1rem;
    }
    
    .content-header h2 {
        font-size: 1.25rem;
    }
    
    .modal-content {
        padding: 1rem;
        margin: 0.5rem;
    }
    
    .form-group input {
        padding: 0.5rem 0.75rem;
    }
    
    .toast {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }
}

/* ===== NFC Campaigns Styles ===== */

.info-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.campaigns-container {
    display: grid;
    gap: 1rem;
}

.campaign-card {
    background: var(--card-bg);
    border-radius: 0.75rem;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.campaign-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
}

.campaign-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.campaign-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.campaign-status {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.campaign-status.active {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.campaign-status.inactive {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.campaign-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--accent-primary, #4f46e5);
    border-color: var(--accent-primary, #4f46e5);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.campaign-slug {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.campaign-slug-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.campaign-slug-code {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-primary);
    flex: 1;
    word-break: break-all;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
}

.campaign-slug-code:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.campaign-url {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.campaign-arrow {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.campaign-long-url {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-decoration: none;
    word-break: break-all;
    transition: color 0.2s;
}

.campaign-long-url:hover {
    color: var(--accent-primary);
}

.campaign-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.campaign-tag {
    background: var(--bg-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.campaign-stats {
    display: flex;
    gap: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.campaign-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.campaign-stat i {
    color: var(--accent-primary);
}

.campaign-stat-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* Budget bar (play budget progress) */
.budget-bar {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.budget-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.budget-bar-header strong {
    color: var(--text-primary);
}

.budget-remaining {
    font-size: 0.8125rem;
    white-space: nowrap;
}

.budget-bar-track {
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.budget-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.budget-bar-note {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.375rem;
    font-style: italic;
}

/* Contract time display */
.contract-time {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

.contract-time i {
    font-size: 0.7rem;
    color: var(--accent-primary);
    opacity: 0.7;
}

.contract-time strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Mini budget bar for compact view */
.link-budget-mini {
    height: 3px;
    background: var(--border-color);
    border-radius: 2px;
    margin: 0.25rem 0 0 0;
    position: relative;
    grid-column: 1 / -1;
}

.link-budget-mini::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: var(--budget-pct, 0%);
    background: var(--accent-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.campaign-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Campaign Modal Styles */
.campaign-info-box {
    background: var(--bg-secondary);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.campaign-slug-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.slug-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    width: 100%;
    margin-bottom: 0.5rem;
}

.slug-value {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-primary);
    background: var(--card-bg);
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
}

.campaign-history {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.campaign-history h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.history-list {
    max-height: 200px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.history-change-type {
    font-weight: 500;
    color: var(--text-primary);
}

.history-date {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.queue-items {
    margin-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.queue-items-header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.queue-items-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.queue-items-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.qi-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.qi-initial {
    border-color: var(--accent-primary);
    border-width: 1.5px;
}

.qi-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.qi-num {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: var(--bg-primary);
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
}

.qi-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.qi-url-row {
    margin-bottom: 0.5rem;
}

.qi-url {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.8rem;
    box-sizing: border-box;
}

.qi-url:focus {
    border-color: var(--accent-primary);
    outline: none;
}

.qi-meta-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.qi-schedule {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 180px;
}

.qi-date-row {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.qi-schedule input {
    flex: 1;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.75rem;
}

.qi-clear {
    padding: 0.25rem 0.4rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 0.25rem;
    font-size: 0.7rem;
}

.qi-clear:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.qi-clicks {
    width: 100px;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.75rem;
}

.qi-click-controls { display: flex; align-items: center; gap: 0.2rem; }

.qi-click-btn {
    padding: 0.2rem 0.35rem;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-size: 0.65rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1;
}
.qi-click-btn:hover { background: var(--accent-primary); color: #fff; border-color: var(--accent-primary); }
.qi-click-btn.qi-click-dec { color: #dc2626; }
.qi-click-btn.qi-click-dec:hover { background: #dc2626; color: #fff; border-color: #dc2626; }
.qi-click-btn.qi-click-inc { color: #16a34a; }
.qi-click-btn.qi-click-inc:hover { background: #16a34a; color: #fff; border-color: #16a34a; }

.qi-actions {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.qi-actions .btn-icon {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
}

.qi-add {
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
}

.qi-new {
    border-style: dashed;
    border-color: var(--accent-primary);
    opacity: 0.8;
}

.history-details {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.history-old {
    color: #ef4444;
    text-decoration: line-through;
}

.history-new {
    color: #10b981;
}

/* Empty Campaigns State */
.empty-campaigns {
    text-align: center;
    padding: 3rem 1rem;
    background: var(--card-bg);
    border-radius: 0.75rem;
    border: 1px dashed var(--border-color);
}

.empty-campaigns i {
    font-size: 3rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.empty-campaigns h3 {
    font-size: 1.125rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-campaigns p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Clients Grid */
.clients-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
    padding: 1rem 0;
}

.client-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.25rem;
    transition: all 0.2s ease;
}

.client-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-primary);
}

.client-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.client-avatar {
    font-size: 2.5rem;
    color: var(--accent-primary);
}

.client-info {
    flex: 1;
    min-width: 0;
}

.client-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
    word-break: break-word;
}

.client-email {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
    word-break: break-all;
}

.client-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.client-detail {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.client-detail i {
    width: 1rem;
    text-align: center;
    color: var(--accent-primary);
}

.client-detail-value {
    font-weight: 500;
    color: var(--text-primary);
}

.client-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.client-actions .btn-secondary {
    flex: 1;
    min-width: 120px;
    font-size: 0.8125rem;
    padding: 0.5rem 0.75rem;
}

/* Analytics Modal */
.modal-lg {
    max-width: 700px;
    width: 90%;
}

.analytics-summary {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 0.5rem;
}

.analytics-stat {
    text-align: center;
}

.analytics-stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.analytics-stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.analytics-period-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.analytics-period-selector label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.analytics-period-selector select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.analytics-chart {
    margin-bottom: 1.5rem;
    min-height: 150px;
    position: relative;
}

.analytics-bars {
    display: flex;
    gap: 4px;
    height: 140px;
    background: var(--bg-secondary);
    border-radius: 0.5rem;
    padding: 0.5rem;
    overflow-x: auto;
}

.analytics-y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    width: 32px;
    flex-shrink: 0;
    padding-bottom: 22px;
    font-size: 0.625rem;
    color: var(--text-secondary);
    line-height: 1;
    pointer-events: none;
    user-select: none;
}

.analytics-bars-inner {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 100%;
}

.analytics-bar-container {
    flex: 1;
    min-width: 20px;
    max-width: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    cursor: pointer;
    position: relative;
}

.analytics-bar {
    width: 100%;
    background: var(--accent-primary);
    border-radius: 2px 2px 0 0;
    transition: height 0.3s ease;
    margin-top: auto;
    position: relative;
    min-height: 16px;
}

.analytics-bar-label {
    font-size: 0.625rem;
    color: var(--text-secondary);
    margin-top: 4px;
    white-space: nowrap;
}

.analytics-bar-count {
    position: absolute;
    top: 3px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.35);
    line-height: 1;
    pointer-events: none;
    user-select: none;
}

.analytics-bar-tooltip {
    position: absolute;
    left: 50%;
    top: -999px;
    transform: translateX(-50%);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 0.4rem 0.65rem;
    font-size: 0.7rem;
    line-height: 1.4;
    box-shadow: var(--shadow-md);
    z-index: 10;
    pointer-events: none;
    white-space: nowrap;
    display: none;
}

.analytics-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
    font-size: 0.875rem;
}

.analytics-recent h4 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.recent-list {
    max-height: 200px;
    overflow-y: auto;
}

.recent-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.75rem;
}

.recent-date {
    font-size: 0.625rem;
    color: var(--text-secondary);
}

.recent-ua {
    color: var(--text-primary);
    font-size: 0.625rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Compact View */
.links-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.link-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.link-item:hover {
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
}

.link-item.inactive {
    opacity: 0.6;
}

.link-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #10b981;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.link-item.inactive .link-status-dot {
    background: #ef4444;
}

.link-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.link-title {
    font-weight: 500;
    color: var(--text-primary);
    padding: 0.375rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    cursor: pointer;
}

.link-title:hover {
    color: var(--accent-primary);
}

.link-url {
    font-size: 0.75rem;
    color: var(--accent-primary);
    text-decoration: none;
    cursor: pointer;
    word-break: break-all;
    line-height: 1.3;
}

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

.link-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0 1rem;
}

.link-clicks {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent-primary);
    background: var(--bg-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.link-code {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.link-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* Password visibility toggle */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.password-wrapper input {
    padding-right: 2.5rem;
    width: 100%;
}
.password-toggle {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
    font-size: 1rem;
    transition: color 0.2s;
}
.password-toggle:hover {
    color: var(--text-primary);
}

/* Admin filters */
.admin-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-group select {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    min-width: 150px;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Owner badge in campaigns */
.campaign-owner {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: var(--accent-primary);
    color: white;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

.link-owner {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

/* Create Client Modal */
#createClientBtn {
    margin-left: 0.5rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.create-client-success {
    text-align: center;
    padding: 1rem 0;
}

.create-client-success .success-icon {
    font-size: 3rem;
    color: #22c55e;
    margin-bottom: 1rem;
}

.create-client-success h4 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.create-client-success p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.credentials-display {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 1rem 0;
    text-align: left;
}

.credentials-display p {
    margin: 0.25rem 0;
    font-family: monospace;
}

.warning-text {
    color: #f59e0b;
    font-size: 0.875rem;
    margin: 1rem 0;
}

.warning-text i {
    margin-right: 0.25rem;
}

#createClientSuccess {
    margin-top: 1rem;
}

/* Manage Clients Modal */
.clients-list-container {
    max-height: 400px;
    overflow-y: auto;
}

.client-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
    flex-wrap: wrap;
}

.client-list-item:last-child {
    border-bottom: none;
}

.client-list-item:hover {
    background: var(--bg-secondary);
}

.client-info {
    flex: 1;
}

.client-name {
    font-weight: 600;
    color: var(--text-primary);
}

.client-email {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.client-stats {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.25rem;
}

.client-actions {
    display: flex;
    gap: 0.5rem;
}

.client-delete-btn {
    padding: 0.375rem 0.75rem;
    background: transparent;
    color: #dc2626;
    border: 1px solid #dc2626;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.client-delete-btn:hover {
    background: #dc2626;
    color: white;
}

.client-delete-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.clients-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* Feature toggles in client management */
.client-features {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}
.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}
.toggle-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}
.toggle-text {
    white-space: nowrap;
}
