/* Usl.ink Web Application Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;
    --accent: #8b5cf6;
    --bg-light: #f8fafc;
    --bg-dark: #0f172a;
    --card-light: #ffffff;
    --card-dark: #1e293b;
    --text-light: #1e293b;
    --text-dark: #f1f5f9;
    --text-muted-light: #64748b;
    --text-muted-dark: #94a3b8;
    --border-light: #e2e8f0;
    --border-dark: #334155;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-alt: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --shadow: 0 10px 30px rgba(99, 102, 241, 0.1);
    --shadow-lg: 0 20px 60px rgba(99, 102, 241, 0.15);
    --radius: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-light);
    color: var(--text-light);
    line-height: 1.6;
    transition: var(--transition);
    min-height: 100vh;
}

body.dark-mode {
    background: var(--bg-dark);
    color: var(--text-dark);
}

/* ===== LOGIN PAGE ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.login-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    opacity: 0.08;
}

body.dark-mode .login-bg {
    opacity: 0.15;
}

.login-card {
    background: var(--card-light);
    border-radius: var(--radius-lg);
    padding: 3rem;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.6s ease;
    position: relative;
    overflow: hidden;
}

body.dark-mode .login-card {
    background: var(--card-dark);
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo h1 {
    font-size: 2rem;
    font-weight: 900;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-logo p {
    color: var(--text-muted-light);
    margin-top: 0.5rem;
    font-size: 0.95rem;
}

body.dark-mode .login-logo p {
    color: var(--text-muted-dark);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 2px solid var(--border-light);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    background: var(--bg-light);
    color: var(--text-light);
}

body.dark-mode .form-group input {
    border-color: var(--border-dark);
    background: var(--bg-dark);
    color: var(--text-dark);
}

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

.form-group input::placeholder {
    color: var(--text-muted-light);
}

body.dark-mode .form-group input::placeholder {
    color: var(--text-muted-dark);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--card-light);
    color: var(--text-light);
    border: 2px solid var(--border-light);
}

body.dark-mode .btn-secondary {
    background: var(--card-dark);
    color: var(--text-dark);
    border-color: var(--border-dark);
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    color: #ffffff;
}

.btn-success:hover {
    background: #059669;
}

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

.btn-icon {
    padding: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted-light);
    transition: var(--transition);
    border-radius: 8px;
}

body.dark-mode .btn-icon {
    color: var(--text-muted-dark);
}

.btn-icon:hover {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

/* ===== DASHBOARD LAYOUT ===== */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--card-light);
    border-right: 1px solid var(--border-light);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: var(--transition);
}

body.dark-mode .sidebar {
    background: var(--card-dark);
    border-color: var(--border-dark);
}

.sidebar-logo {
    font-size: 1.4rem;
    font-weight: 900;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2rem;
    padding: 0.5rem 0;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-muted-light);
    font-weight: 500;
    transition: var(--transition);
    font-size: 0.95rem;
}

body.dark-mode .sidebar-link {
    color: var(--text-muted-dark);
}

.sidebar-link:hover,
.sidebar-link.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.sidebar-link .icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    border-top: 1px solid var(--border-light);
    padding-top: 1rem;
    margin-top: 1rem;
}

body.dark-mode .sidebar-footer {
    border-color: var(--border-dark);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    margin-bottom: 0.75rem;
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: white;
    flex-shrink: 0;
}

.sidebar-user-info {
    overflow: hidden;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: var(--text-muted-light);
}

body.dark-mode .sidebar-user-role {
    color: var(--text-muted-dark);
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
    min-height: 100vh;
}

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

.main-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
}

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

/* ===== STATS CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

body.dark-mode .stat-card {
    background: var(--card-dark);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--gradient);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card .stat-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card .stat-label {
    color: var(--text-muted-light);
    font-weight: 500;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

body.dark-mode .stat-card .stat-label {
    color: var(--text-muted-dark);
}

/* ===== CARDS ===== */
.card {
    background: var(--card-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

body.dark-mode .card {
    background: var(--card-dark);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

body.dark-mode .card-header {
    border-color: var(--border-dark);
}

.card-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
}

.card-body {
    padding: 1.5rem;
}

/* ===== TABLE ===== */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
}

body.dark-mode table th,
body.dark-mode table td {
    border-color: var(--border-dark);
}

table th {
    font-weight: 600;
    color: var(--text-muted-light);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body.dark-mode table th {
    color: var(--text-muted-dark);
}

table tr:hover {
    background: rgba(99, 102, 241, 0.03);
}

body.dark-mode table tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

table tr:last-child td {
    border-bottom: none;
}

.link-code {
    font-family: 'JetBrains Mono', monospace;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.link-target {
    display: inline-block;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted-light);
    font-size: 0.85rem;
}

body.dark-mode .link-target {
    color: var(--text-muted-dark);
}

.actions-cell {
    display: flex;
    gap: 0.25rem;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--card-light);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.3s ease;
    overflow: hidden;
}

body.dark-mode .modal {
    background: var(--card-dark);
}

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

body.dark-mode .modal-header {
    border-color: var(--border-dark);
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

body.dark-mode .modal-footer {
    border-color: var(--border-dark);
}

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: var(--card-light);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    animation: slideIn 0.3s ease;
    border-left: 4px solid var(--primary);
}

body.dark-mode .toast {
    background: var(--card-dark);
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.warning {
    border-left-color: var(--warning);
}

.toast-icon {
    font-size: 1.25rem;
}

.toast-message {
    flex: 1;
    font-size: 0.9rem;
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted-light);
    font-size: 1.25rem;
    padding: 0;
    line-height: 1;
}

/* ===== BADGE ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-admin {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
}

.badge-user {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.badge-clicks {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    font-family: 'JetBrains Mono', monospace;
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
    background: var(--gradient);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    color: white;
    transition: var(--transition);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.theme-toggle:hover {
    transform: scale(1.1);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted-light);
}

body.dark-mode .empty-state {
    color: var(--text-muted-dark);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

/* ===== MOBILE MENU ===== */
.mobile-menu-btn {
    display: none;
    background: var(--gradient);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 200;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted-light);
    position: absolute;
    top: 1rem;
    right: 1rem;
}

body.dark-mode .sidebar-close {
    color: var(--text-muted-dark);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar-close {
        display: block;
    }

    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
        padding-top: 4.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .main-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .modal {
        max-width: 100%;
        margin: 0.5rem;
    }

    table th,
    table td {
        padding: 0.6rem 0.5rem;
        font-size: 0.8rem;
    }

    .link-target {
        max-width: 150px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== SETTINGS ===== */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.settings-section {
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

body.dark-mode .settings-section {
    border-color: var(--border-dark);
}

.settings-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.settings-section-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--primary);
}

.form-hint {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted-light);
    margin-top: 0.3rem;
}

body.dark-mode .form-hint {
    color: var(--text-muted-dark);
}

.input-with-toggle {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-toggle input {
    flex: 1;
    padding-right: 3rem;
}

.btn-toggle-visibility {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.25rem 0.4rem;
    border-radius: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.btn-toggle-visibility:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
}

body.dark-mode .btn-toggle-visibility:hover {
    background: rgba(255, 255, 255, 0.1);
}

@media (min-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem 3rem;
    }
    .settings-section:first-child {
        grid-column: 1 / -1;
    }
}

/* ===== SEARCH ===== */
.search-input {
    padding: 0.6rem 1rem;
    border: 2px solid var(--border-light);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    transition: var(--transition);
    background: var(--bg-light);
    color: var(--text-light);
    width: 250px;
}

body.dark-mode .search-input {
    border-color: var(--border-dark);
    background: var(--bg-dark);
    color: var(--text-dark);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ===== COPY BUTTON ===== */
.copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted-light);
    padding: 0.25rem;
    border-radius: 4px;
    transition: var(--transition);
    font-size: 0.9rem;
}

body.dark-mode .copy-btn {
    color: var(--text-muted-dark);
}

.copy-btn:hover {
    color: var(--primary);
}

.copy-btn.copied {
    color: var(--success);
}

/* ===== FORM INLINE ===== */
.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-row .btn {
    flex-shrink: 0;
    height: fit-content;
}

@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-light);
    margin-bottom: 1.5rem;
}

body.dark-mode .tabs {
    border-color: var(--border-dark);
}

.tab {
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted-light);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    font-family: inherit;
}

body.dark-mode .tab {
    color: var(--text-muted-dark);
}

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

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ===== ALERT ===== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* ===== LOADING ===== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}