:root {
    --color-primary:   #4a4e69;
    --color-secondary: #6d597a;
    --color-rose:      #723d46;
    --color-accent:    #e76f51;
    --color-plum:      #502f4c;
    --color-teal:      #005f73;
    --color-muted:     #9a8c98;
    --color-purple:    #70587c;
    --color-light-bg:  #f4f2f7;
    --color-dark-bg:   #1e1b2e;
    --navbar-height:   64px;
}

/* ── Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f8f7fc;
    color: #2d2b3d;
    min-height: 100vh;
}

a { color: var(--color-teal); text-decoration: none; }
a:hover { color: var(--color-accent); }

/* ── Navbar ───────────────────────────────────────────── */
.navbar-brand-logo {
    font-weight: 800;
    font-size: 1.4rem;
    letter-spacing: -0.5px;
}
.navbar-brand-logo span { color: var(--color-accent); }

.navbar-custom {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-plum) 100%);
    box-shadow: 0 2px 20px rgba(74, 78, 105, 0.4);
    height: var(--navbar-height);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.navbar-custom .nav-link {
    color: rgba(255,255,255,.75) !important;
    font-weight: 500;
    font-size: .9rem;
    transition: color .2s;
    padding: .4rem .8rem;
    border-radius: 6px;
}
.navbar-custom .nav-link:hover,
.navbar-custom .nav-link.active {
    color: #fff !important;
    background: rgba(255,255,255,.1);
}

/* ── Hero ─────────────────────────────────────────────── */
.hero-section {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-plum) 60%, var(--color-secondary) 100%);
    padding: 5rem 0 4rem;
    position: relative;
    overflow: hidden;
}
.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-section h1 { color: #fff; font-weight: 800; letter-spacing: -1px; }
.hero-section p  { color: rgba(255,255,255,.8); font-size: 1.1rem; }

/* ── URL Input Form ───────────────────────────────────── */
.url-form-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(74, 78, 105, 0.25);
    padding: 2.5rem;
    position: relative;
    z-index: 1;
}
.url-form-card .form-control {
    border: 2px solid #e8e4f0;
    border-radius: 10px;
    padding: .75rem 1rem;
    font-size: 1rem;
    transition: border-color .2s, box-shadow .2s;
}
.url-form-card .form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(74, 78, 105, .15);
}
.btn-shorten {
    background: linear-gradient(135deg, var(--color-accent), #c85a3a);
    border: none;
    color: #fff;
    font-weight: 700;
    padding: .75rem 2.5rem;
    border-radius: 10px;
    font-size: 1rem;
    transition: transform .15s, box-shadow .15s;
    white-space: nowrap;
}
.btn-shorten:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(231, 111, 81, .45);
    color: #fff;
}
.service-badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: rgba(231,111,81,.1);
    color: var(--color-accent);
    border: 1px solid rgba(231,111,81,.25);
    border-radius: 50px;
    padding: .25rem .85rem;
    font-size: .8rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
}

/* ── Section Titles ───────────────────────────────────── */
.section-title {
    font-weight: 800;
    font-size: 1.7rem;
    color: var(--color-primary);
    position: relative;
    padding-bottom: .6rem;
    margin-bottom: 1.5rem;
}
.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 48px;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--color-accent), var(--color-secondary));
}

/* ── URL List Cards ───────────────────────────────────── */
.url-table-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(74, 78, 105, .1);
    overflow: hidden;
}
.url-table-card .table {
    margin: 0;
}
.url-table-card .table thead th {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: #fff;
    font-weight: 600;
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    border: none;
    padding: 1rem 1.25rem;
}
.url-table-card .table tbody tr {
    transition: background .15s;
}
.url-table-card .table tbody tr:hover {
    background: #faf9fd;
}
.url-table-card .table td {
    vertical-align: middle;
    padding: .9rem 1.25rem;
    border-color: #f0eef8;
    font-size: .9rem;
}

.url-short-link {
    font-weight: 700;
    color: var(--color-teal) !important;
    font-size: .9rem;
}
.url-short-link:hover { color: var(--color-accent) !important; }

.url-original {
    color: #6c757d;
    font-size: .82rem;
    max-width: 280px;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.badge-clicks {
    background: linear-gradient(135deg, var(--color-teal), #007a8f);
    color: #fff;
    font-size: .78rem;
    padding: .3em .7em;
    border-radius: 50px;
    font-weight: 600;
}

/* ── Redirect / Landing Page ──────────────────────────── */
.redirect-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(74, 78, 105, .18);
    overflow: hidden;
}
.redirect-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-plum) 100%);
    padding: 2rem 2.5rem;
    color: #fff;
}
.redirect-header h1 { font-size: 1.35rem; font-weight: 700; line-height: 1.4; margin: 0; }
.redirect-body { padding: 2rem 2.5rem; }
.redirect-description { color: #555; line-height: 1.7; font-size: .95rem; }

.countdown-wrap {
    background: var(--color-light-bg);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    margin-top: 1.5rem;
}
.countdown-number {
    font-size: 3rem;
    font-weight: 900;
    color: var(--color-accent);
    line-height: 1;
    display: block;
    margin-bottom: .25rem;
}
.countdown-label { font-size: .8rem; color: #888; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }

.btn-proceed {
    background: linear-gradient(135deg, var(--color-teal), #007a8f);
    color: #fff;
    border: none;
    font-weight: 700;
    padding: .85rem 2.5rem;
    border-radius: 10px;
    font-size: 1rem;
    width: 100%;
    transition: transform .15s, box-shadow .15s;
    display: block;
    text-align: center;
}
.btn-proceed:hover, .btn-proceed:not([disabled]):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 95, 115, .4);
    color: #fff;
}
.btn-proceed:disabled {
    opacity: .65;
    cursor: not-allowed;
    transform: none;
}

.stat-pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: #f4f2f7;
    border: 1px solid #e4e0f0;
    border-radius: 50px;
    padding: .35rem 1rem;
    font-size: .82rem;
    color: var(--color-primary);
    font-weight: 500;
}
.stat-pill i { color: var(--color-muted); }

/* ── Pagination ───────────────────────────────────────── */
.pagination .page-link {
    color: var(--color-primary);
    border-color: #e4e0f0;
    border-radius: 8px !important;
    margin: 0 2px;
    font-weight: 500;
}
.pagination .page-link:hover,
.pagination .page-item.active .page-link {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

/* ── Admin ────────────────────────────────────────────── */
.admin-sidebar {
    background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-plum) 100%);
    min-height: calc(100vh - var(--navbar-height));
    padding: 2rem 0;
    width: 260px;
    flex-shrink: 0;
    position: sticky;
    top: var(--navbar-height);
    height: calc(100vh - var(--navbar-height));
    overflow-y: auto;
}
.admin-sidebar .nav-link {
    color: rgba(255,255,255,.7);
    padding: .7rem 1.5rem;
    font-weight: 500;
    font-size: .9rem;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: .7rem;
    transition: all .2s;
    border-left: 3px solid transparent;
}
.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,.1);
    border-left-color: var(--color-accent);
}
.admin-sidebar .sidebar-heading {
    color: rgba(255,255,255,.4);
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 1rem 1.5rem .3rem;
}
.admin-content {
    flex: 1;
    padding: 2rem;
    min-width: 0;
    background: #f8f7fc;
    min-height: calc(100vh - var(--navbar-height));
}

.stat-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(74,78,105,.1);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(74,78,105,.18); }
.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.stat-icon.bg-primary-soft { background: rgba(74,78,105,.12); color: var(--color-primary); }
.stat-icon.bg-accent-soft  { background: rgba(231,111,81,.12); color: var(--color-accent); }
.stat-icon.bg-teal-soft    { background: rgba(0,95,115,.12);   color: var(--color-teal); }
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--color-primary); line-height: 1; }
.stat-label { font-size: .82rem; color: #888; font-weight: 500; margin-top: .2rem; }

.admin-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(74, 78, 105, .1);
    overflow: hidden;
}
.admin-card-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: #fff;
    padding: 1rem 1.5rem;
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.admin-card-body { padding: 1.5rem; }

.admin-textarea {
    border: 2px solid #e8e4f0;
    border-radius: 10px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: .88rem;
    resize: vertical;
    min-height: 240px;
    transition: border-color .2s;
}
.admin-textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(74,78,105,.1);
}

/* Result badges */
.result-row { padding: .6rem 1rem; border-radius: 8px; margin-bottom: .4rem; font-size: .87rem; }
.result-row.success { background: #d1f5e0; border-left: 3px solid #28a745; }
.result-row.error   { background: #fde9e7; border-left: 3px solid #dc3545; }
.result-row .slug-link { font-weight: 700; color: var(--color-teal); }

/* ── Login Page ───────────────────────────────────────── */
.login-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(74,78,105,.22);
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 420px;
}
.login-logo { font-size: 2.5rem; font-weight: 900; color: var(--color-primary); letter-spacing: -1px; text-align: center; margin-bottom: .5rem; }
.login-logo span { color: var(--color-accent); }

/* ── Footer ───────────────────────────────────────────── */
.site-footer {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-plum) 100%);
    color: rgba(255,255,255,.6);
    padding: 2rem 0;
    font-size: .85rem;
    margin-top: 4rem;
}
.site-footer a { color: rgba(255,255,255,.7); }
.site-footer a:hover { color: #fff; }

/* ── Alerts / Toasts ──────────────────────────────────── */
.alert-service {
    background: rgba(231,111,81,.1);
    border: 1px solid rgba(231,111,81,.3);
    border-radius: 10px;
    color: #a04428;
    font-weight: 500;
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
    .hero-section { padding: 3rem 0 2.5rem; }
    .hero-section h1 { font-size: 1.8rem; }
    .admin-sidebar { display: none; }
    .redirect-header, .redirect-body { padding: 1.5rem; }
    .countdown-number { font-size: 2.2rem; }
}

/* ── QR Code Panel ────────────────────────────────────── */
.qr-panel {
    background: #f9f8ff;
    border: 1px solid #ede9f8;
    border-radius: 14px;
    padding: 1.2rem;
    text-align: center;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.qr-panel-title {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #555;
    margin-bottom: .9rem;
}
.qr-canvas-wrap {
    background: #fff;
    border-radius: 10px;
    padding: .6rem;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(74,78,105,.10);
    margin-bottom: .8rem;
}
.qr-canvas-wrap img, .qr-canvas-wrap canvas {
    display: block;
    border-radius: 6px;
}
.qr-url-label {
    font-size: .72rem;
    color: #4a4e69;
    font-weight: 600;
    word-break: break-all;
    margin-bottom: .4rem;
    max-width: 180px;
}
.qr-copy-btn {
    font-size: .78rem;
    padding: .3rem .7rem;
    border-radius: 8px;
}
.qr-visit-btn {
    display: block;
    margin-top: .5rem;
    font-size: .75rem;
    color: #005f73;
    text-decoration: none;
    font-weight: 600;
}
.qr-visit-btn:hover { text-decoration: underline; color: #004d5e; }

/* ── Screenshot Card ───────────────────────────────────── */
.screenshot-card {
    background: #fff;
    border: 1px solid #ede9f8;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(74,78,105,.06);
}
.screenshot-card-title {
    font-size: .82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #555;
    padding: .9rem 1.2rem;
    border-bottom: 1px solid #f3f0fb;
    display: flex;
    align-items: center;
}
.screenshot-figure {
    margin: 0;
    overflow: hidden;
}
.screenshot-figure figcaption {
    padding: .55rem 1.2rem .65rem;
    font-size: .82rem;
    color: #555;
    border-top: 1px solid #f3f0fb;
    background: #faf9fd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.screenshot-img {
    width: 100%;
    display: block;
    max-height: 340px;
    object-fit: cover;
    object-position: top;
}
.screenshot-loading {
    padding: 1.2rem 1.4rem;
    color: #888;
    font-size: .85rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* ── Statistics Section ───────────────────────────────── */
.stats-section { margin-top: 0; }

.stats-heading {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-plum) 100%);
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    padding: .9rem 1.5rem;
    border-radius: 16px 16px 0 0;
    display: flex;
    align-items: center;
}

.stats-card {
    background: #fff;
    border: 1px solid #ede9f8;
    border-radius: 14px;
    padding: 1.25rem 1.4rem;
    box-shadow: 0 2px 10px rgba(74,78,105,.06);
}

.stats-section > .stats-heading + .stats-card {
    border-radius: 0 0 14px 14px;
    border-top: none;
}

.stats-section > .stats-heading {
    border-radius: 14px 14px 0 0;
}

.stats-card-title {
    font-size: .82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #555;
    margin-bottom: .9rem;
    padding-bottom: .6rem;
    border-bottom: 2px solid #f3f0fb;
    display: flex;
    align-items: center;
}

.stats-table-wrap { overflow-x: auto; }

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}
.stats-table thead tr th {
    font-weight: 600;
    color: #888;
    font-size: .77rem;
    text-transform: uppercase;
    letter-spacing: .4px;
    padding: .3rem .5rem .5rem;
    border-bottom: 1px solid #ede9f8;
}
.stats-table tbody tr td {
    padding: .5rem .5rem;
    border-bottom: 1px solid #f7f5ff;
    color: #333;
    vertical-align: middle;
}
.stats-table tbody tr:last-child td { border-bottom: none; }
.stats-table tbody tr:hover { background: #faf9ff; }

.bar-inline {
    display: inline-block;
    width: 50px;
    height: 6px;
    background: #ede9f8;
    border-radius: 3px;
    vertical-align: middle;
    margin-right: 4px;
    overflow: hidden;
}
.bar-fill {
    display: block;
    height: 100%;
    border-radius: 3px;
    min-width: 2px;
}
.pct-label { font-size: .75rem; color: #888; }

/* Summary pills */
.summary-pill {
    background: #fff;
    border: 1px solid #ede9f8;
    border-radius: 14px;
    padding: 1rem 1rem .9rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(74,78,105,.05);
    height: 100%;
}
.summary-pill-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    margin: 0 auto .6rem;
}
.summary-pill-val {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--color-primary);
    line-height: 1.1;
}
.summary-pill-lbl {
    font-size: .73rem;
    color: #888;
    font-weight: 600;
    margin-top: .25rem;
    text-transform: uppercase;
    letter-spacing: .4px;
}

/* Time info cells */
.time-info-cell {
    background: #f9f8ff;
    border: 1px solid #ede9f8;
    border-radius: 10px;
    padding: .75rem 1rem;
}
.time-info-label {
    font-size: .73rem;
    color: #999;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: .25rem;
}
.time-info-val {
    font-size: .92rem;
    font-weight: 700;
    color: #333;
}

/* ── Utilities ────────────────────────────────────────── */
.text-primary-brand { color: var(--color-primary) !important; }
.text-accent        { color: var(--color-accent)  !important; }
.text-teal          { color: var(--color-teal)    !important; }
.bg-primary-brand   { background: var(--color-primary) !important; }
.border-brand       { border-color: var(--color-primary) !important; }

.copy-btn {
    background: transparent;
    border: 1px solid var(--color-muted);
    border-radius: 6px;
    color: var(--color-muted);
    padding: .15rem .5rem;
    font-size: .75rem;
    cursor: pointer;
    transition: all .2s;
}
.copy-btn:hover {
    background: var(--color-teal);
    border-color: var(--color-teal);
    color: #fff;
}

.page-loader {
    position: fixed; inset: 0; background: var(--color-primary);
    z-index: 9999; display: flex; align-items: center; justify-content: center;
    transition: opacity .4s; pointer-events: none;
}
.page-loader.hidden { opacity: 0; }
