:root {
    --bg: #0f1114;
    --bg-2: #15181d;
    --surface: #1a1e24;
    --surface-light: #20252c;
    --surface-hover: #282e37;
    --border: rgba(212, 175, 55, 0.08);
    --border-strong: rgba(212, 175, 55, 0.16);
    --accent: #d4af37;
    --accent-soft: rgba(212, 175, 55, 0.12);
    --accent-glow: rgba(212, 175, 55, 0.25);
    --text: #eeeef0;
    --text-muted: #9aa0a8;
    --success: #34d399;
    --success-soft: rgba(52, 211, 153, 0.12);
    --danger: #ff6b7a;
    --danger-soft: rgba(255, 107, 122, 0.12);
    --warning: #fbbf24;
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 22px;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
    --shadow-glow: 0 0 40px rgba(212, 175, 55, 0.12);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 15% 10%, rgba(212, 175, 55, 0.07) 0%, transparent 45%),
        radial-gradient(ellipse at 85% 20%, rgba(230, 185, 74, 0.05) 0%, transparent 45%),
        radial-gradient(ellipse at 50% 90%, rgba(212, 175, 55, 0.04) 0%, transparent 45%);
    pointer-events: none;
    z-index: -1;
}

.orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    z-index: -1;
    opacity: 0.5;
}

.orb-1 {
    width: 360px;
    height: 360px;
    background: rgba(212, 175, 55, 0.15);
    top: -120px;
    right: -80px;
    animation: float 10s ease-in-out infinite;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: rgba(230, 185, 74, 0.12);
    bottom: -100px;
    left: -60px;
    animation: float 12s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(30px) scale(1.05); }
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #f3d27a;
}

/* ================= HOME ================= */
.home-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.home-box {
    width: 100%;
    max-width: 720px;
    min-height: 360px;
    background: rgba(26, 30, 36, 0.65);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow), var(--shadow-glow);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 48px;
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.8s ease-out;
}

.home-box::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.4), transparent 40%, transparent 60%, rgba(230, 185, 74, 0.3));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.brand-block {
    text-align: center;
    z-index: 1;
}

.brand-logo {
    font-family: var(--mono);
    font-size: clamp(42px, 8vw, 72px);
    font-weight: 800;
    letter-spacing: -2px;
    background: linear-gradient(135deg, var(--accent) 0%, #f3d27a 50%, #e6b94a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 60px rgba(212, 175, 55, 0.25);
    margin-bottom: 12px;
}

.brand-tagline {
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: clamp(14px, 2.5vw, 18px);
}

.home-footer {
    position: fixed;
    bottom: 28px;
    left: 0;
    right: 0;
    text-align: center;
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.5px;
}

/* ================= BUTTONS ================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 24px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #b8922f);
    color: #1a1403;
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(212, 175, 55, 0.4);
    color: #1a1403;
}

.btn-secondary {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
}

.btn-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid rgba(255, 107, 122, 0.2);
}

.btn-danger:hover {
    background: rgba(255, 107, 122, 0.2);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 12px;
    border-radius: 8px;
}

.btn-login {
    composes: btn btn-secondary;
    font-family: var(--mono);
    font-size: 15px;
    padding: 14px 36px;
}

/* ================= AUTH ================= */
.auth-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: rgba(26, 30, 36, 0.7);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow), var(--shadow-glow);
    padding: 42px;
    animation: fadeInUp 0.6s ease-out;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h2 {
    font-family: var(--mono);
    font-size: 28px;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    font-family: var(--mono);
}

.form-control {
    width: 100%;
    background: rgba(13, 15, 18, 0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
}

.form-control::placeholder {
    color: #565b63;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    background: rgba(13, 15, 18, 0.8);
}

.form-control:read-only {
    background: rgba(212, 175, 55, 0.04);
    color: var(--text-muted);
}

.error-msg {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid rgba(255, 107, 122, 0.2);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 13px;
    margin-bottom: 20px;
}

/* ================= DASHBOARD ================= */
.dashboard-page {
    min-height: 100vh;
    padding-bottom: 60px;
}

.dashboard-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 17, 20, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.dashboard-header .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.header-brand {
    font-family: var(--mono);
    font-size: 20px;
    font-weight: 800;
    color: var(--accent);
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.25);
}

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

.header-nav a {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s;
}

.header-nav a:hover,
.header-nav a.active {
    color: var(--accent);
    background: var(--accent-soft);
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13px;
}

.user-pill .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #e6b94a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #1a1403;
    font-size: 12px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

.section-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title span {
    color: var(--accent);
    font-family: var(--mono);
}

/* ================= CARDS ================= */
.card {
    background: rgba(26, 30, 36, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 28px;
    animation: fadeInUp 0.5s ease-out;
}

.card-header {
    padding: 22px 26px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.card-body {
    padding: 26px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .form-grid {
        grid-template-columns: 1.4fr 0.8fr auto;
        align-items: end;
    }
}

.form-grid .form-group {
    margin-bottom: 0;
}

.form-grid .btn {
    height: 49px;
}

/* ================= FLASH ================= */
.flash {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 200;
    padding: 16px 22px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow);
    animation: slideIn 0.4s ease-out;
    max-width: 420px;
    line-height: 1.5;
}

.flash-success {
    background: rgba(11, 23, 18, 0.95);
    color: var(--success);
    border: 1px solid rgba(52, 211, 153, 0.25);
}

.flash-error {
    background: rgba(28, 13, 15, 0.95);
    color: var(--danger);
    border: 1px solid rgba(255, 107, 122, 0.25);
}

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

/* ================= TABLE ================= */
.links-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.links-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 760px;
}

.links-table thead {
    background: rgba(212, 175, 55, 0.05);
}

.links-table th,
.links-table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.links-table th {
    color: var(--accent);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-family: var(--mono);
}

.links-table tbody tr {
    transition: background 0.2s;
}

.links-table tbody tr:hover {
    background: rgba(212, 175, 55, 0.04);
}

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

.short-url {
    font-family: var(--mono);
    color: var(--accent);
    font-weight: 600;
    font-size: 13px;
    word-break: break-all;
}

.original-url {
    color: var(--text-muted);
    font-size: 13px;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.visits-cell {
    font-family: var(--mono);
    font-weight: 700;
    color: var(--text);
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    stroke: var(--text-muted);
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ================= STATS ================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: rgba(26, 30, 36, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
}

.stat-card h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 30px;
    font-weight: 800;
    font-family: var(--mono);
    background: linear-gradient(135deg, var(--accent), #f3d27a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ================= MODAL ================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 300;
    padding: 24px;
}

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

.modal {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow), var(--shadow-glow);
    width: 100%;
    max-width: 360px;
    padding: 28px;
    text-align: center;
    animation: fadeInUp 0.3s ease-out;
}

.modal h3 {
    margin-bottom: 8px;
    font-size: 18px;
}

.modal p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

#qrcode canvas,
#qrcode img {
    margin: 0 auto 20px;
    border-radius: 10px;
    padding: 10px;
    background: #fff;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* ================= ANIMATIONS ================= */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* ================= RESPONSIVE ================= */
@media (max-width: 768px) {
    .dashboard-header .container {
        flex-wrap: wrap;
    }

    .header-nav {
        order: 3;
        width: 100%;
        justify-content: space-between;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .auth-card {
        padding: 28px;
    }

    .home-box {
        padding: 36px 24px;
    }
}

@media (max-width: 480px) {
    .brand-logo {
        font-size: 40px;
    }

    .btn {
        width: 100%;
    }

    .actions .btn {
        width: auto;
    }

    .header-brand {
        font-size: 18px;
    }
}
/* ================= AUTO REPLACE CARD ================= */
.card-autoreplace {
    border-color: rgba(212, 175, 55, 0.35);
    box-shadow: var(--shadow), 0 0 45px rgba(212, 175, 55, 0.10);
}

.card-autoreplace .card-header {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.10), transparent);
}

.card-autoreplace .card-header h3 {
    color: #e6b94a;
    font-family: var(--mono);
}

.hint {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 20px;
    line-height: 1.6;
}

.hint code {
    font-family: var(--mono);
    color: #f3d27a;
    background: rgba(212, 175, 55, 0.08);
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 12px;
    word-break: break-all;
}