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

:root {
    --primary: #635bff;
    --primary-dark: #5148e5;
    --background: #f7f8fc;
    --text: #172033;
    --muted: #68738a;
    --border: #e2e6ef;
    --white: #ffffff;
    --success: #15803d;
    --danger: #dc2626;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: var(--background);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.navbar {
    height: 76px;
    padding: 0 8%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.brand {
    font-size: 25px;
    font-weight: 800;
    color: var(--text);
    text-decoration: none;
}

.brand span {
    color: var(--primary);
}

.nav-login {
    text-decoration: none;
    color: var(--primary);
    font-weight: 600;
}

.hero {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 65px 20px;
}

.hero-content {
    width: 100%;
    max-width: 650px;
    text-align: center;
}

.eyebrow {
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
}

h1 {
    font-size: clamp(40px, 7vw, 64px);
    line-height: 1.1;
    margin: 18px 0;
    letter-spacing: -2px;
}

h1 span {
    color: var(--primary);
}

.subtitle {
    color: var(--muted);
    font-size: 16px;
    line-height: 1.7;
    margin-bottom: 32px;
}

.shortener-form {
    text-align: left;
    background: var(--white);
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(20, 30, 60, 0.06);
}

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

input {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    background: #fff;
    color: var(--text);
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.1);
}

.optional-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 20px;
}

button {
    border: none;
    cursor: pointer;
    border-radius: 8px;
    font-weight: 600;
    transition: background 0.2s;
}

#shortenButton {
    width: 100%;
    margin-top: 24px;
    padding: 14px;
    color: white;
    background: var(--primary);
    font-size: 15px;
}

#shortenButton:hover {
    background: var(--primary-dark);
}

#shortenButton:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.message {
    margin-top: 16px;
    font-size: 14px;
}

.message.error {
    color: var(--danger);
}

.message.success {
    color: var(--success);
}

.result-card {
    background: var(--white);
    padding: 22px;
    margin-top: 20px;
    border: 1px solid var(--border);
    border-radius: 12px;
    text-align: left;
}

.result-card p {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 12px;
}

.result-link {
    display: flex;
    align-items: center;
    gap: 10px;
}

.result-link a {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--primary);
    font-weight: 600;
}

.copy-button {
    background: #eeedff;
    color: var(--primary);
    padding: 10px 16px;
}

.hidden {
    display: none;
}

footer {
    padding: 22px;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
}

@media (max-width: 600px) {
    .navbar {
        padding: 0 5%;
    }

    .optional-fields {
        grid-template-columns: 1fr;
    }

    .shortener-form {
        padding: 20px;
    }

    h1 {
        letter-spacing: -1px;
    }
}

/* =========================
   ADMIN LOGIN
========================= */

.auth-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 35px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(20, 30, 60, 0.06);
}

.auth-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #eeedff;
    color: var(--primary);
    border-radius: 14px;
    font-weight: 800;
}

.auth-card h1 {
    text-align: center;
    font-size: 28px;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.auth-subtitle {
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 28px;
}

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

.form-group input {
    margin-top: 2px;
}

.password-input-wrapper {
    position: relative;
    width: 100%;
}

.password-input-wrapper input {
    padding-right: 52px;
}

.password-toggle {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 42px;
    height: calc(100% - 4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--muted);
    background: transparent;
    border-radius: 6px;
}

.password-toggle:hover {
    color: var(--primary);
    background: #f5f4ff;
}

.password-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -3px;
}

.password-toggle svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.password-toggle [hidden] {
    display: none !important;
}

.primary-button {
    width: 100%;
    padding: 14px;
    color: white;
    background: var(--primary);
    font-size: 15px;
}

.primary-button:hover {
    background: var(--primary-dark);
}

.primary-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.security-note {
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    margin-top: 22px;
}

/* =====================================
   DASHBOARD LAYOUT
===================================== */

.dashboard-body {
    background: #f7f8fc;
    min-height: 100vh;
    display: block;
}

.dashboard-layout {
    display: flex;
    min-height: 100vh;
}


/* SIDEBAR */

.sidebar {
    width: 250px;
    flex-shrink: 0;
    background: #111827;
    color: #ffffff;
    padding: 28px 18px;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    color: #ffffff;
    display: inline-block;
    padding: 0 12px;
    margin-bottom: 50px;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-label {
    font-size: 10px;
    letter-spacing: 1.5px;
    color: #9ca3af;
    font-weight: 700;
    padding: 0 12px;
    margin-bottom: 8px;
}

.sidebar-link {
    text-decoration: none;
    color: #cbd5e1;
    padding: 13px 14px;
    border-radius: 8px;
    font-size: 14px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: #312e81;
    color: #ffffff;
}

.sidebar-link span {
    font-size: 18px;
}

.sidebar-bottom {
    margin-top: auto;
    padding-top: 25px;
    border-top: 1px solid #374151;
}

.sidebar-admin {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 0 5px;
}

.admin-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #635bff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.admin-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.admin-info strong {
    font-size: 13px;
    overflow-wrap: anywhere;
}

.admin-info span {
    color: #9ca3af;
    font-size: 11px;
}

.logout-button {
    width: 100%;
    background: #374151;
    color: #ffffff;
    padding: 12px;
}

.logout-button:hover {
    background: #4b5563;
}


/* MAIN */

.dashboard-main {
    flex: 1;
    min-width: 0;
    padding: 38px 42px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 32px;
}

.breadcrumb {
    color: #8b93a5;
    font-size: 12px;
    margin-bottom: 10px;
}

.dashboard-header h1 {
    font-size: 30px;
    letter-spacing: -0.7px;
    margin: 0 0 8px;
}

.dashboard-subtitle {
    color: #68738a;
    font-size: 14px;
}

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

.secondary-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    background: #ffffff;
    border: 1px solid #e2e6ef;
    color: #263149;
    padding: 11px 15px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}

.secondary-button:hover {
    background: #f1f2f8;
}

.icon-button {
    background: #635bff;
    color: #ffffff;
    padding: 12px 15px;
}

.icon-button:hover {
    background: #5148e5;
}


/* STATISTICS */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 30px;
}

.stat-card {
    background: #ffffff;
    border: 1px solid #e8eaf1;
    border-radius: 13px;
    padding: 22px;
    box-shadow: 0 3px 12px rgba(20, 30, 60, 0.025);
}

.stat-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    color: #68738a;
    font-size: 13px;
    font-weight: 600;
}

.stat-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
}

.stat-icon.purple {
    background: #eeedff;
    color: #635bff;
}

.stat-icon.green {
    background: #dcfce7;
    color: #15803d;
}

.stat-icon.orange {
    background: #fef3c7;
    color: #b45309;
}

.stat-icon.red {
    background: #fee2e2;
    color: #dc2626;
}

.stat-card h2 {
    font-size: 32px;
    letter-spacing: -1px;
    margin: 20px 0 8px;
}

.stat-description {
    color: #8b93a5;
    font-size: 12px;
}


/* URL MANAGEMENT */

.management-card {
    background: #ffffff;
    border: 1px solid #e8eaf1;
    border-radius: 13px;
    padding: 25px;
    box-shadow: 0 3px 12px rgba(20, 30, 60, 0.025);
}

.credential-form {
    max-width: 480px;
    margin-top: 20px;
}

.credential-form small {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
}

.credential-submit {
    max-width: 240px;
}

.management-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 24px;
}

.management-header h2 {
    font-size: 18px;
    margin-bottom: 7px;
}

.management-header p {
    color: #8b93a5;
    font-size: 13px;
}

.table-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.search-box {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #e2e6ef;
    border-radius: 8px;
    padding: 0 12px;
}

.search-box span {
    color: #8b93a5;
    font-size: 21px;
}

.search-box input {
    border: none;
    box-shadow: none;
    padding: 12px 0;
    min-width: 0;
}

.search-box input:focus {
    box-shadow: none;
}

.table-toolbar select {
    width: auto;
    min-width: 125px;
    border: 1px solid #e2e6ef;
    border-radius: 8px;
    padding: 0 12px;
    background: #ffffff;
    color: #263149;
    font-size: 13px;
}


/* TABLE */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.url-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    white-space: nowrap;
}

.url-table th {
    padding: 14px 12px;
    background: #f8f9fc;
    color: #8b93a5;
    font-size: 10px;
    letter-spacing: 0.6px;
    font-weight: 700;
}

.url-table td {
    padding: 17px 12px;
    border-bottom: 1px solid #edf0f5;
    font-size: 12px;
    color: #465168;
}

.url-table tbody tr:hover {
    background: #fafaff;
}

.short-link {
    color: #635bff;
    font-weight: 700;
    text-decoration: none;
}

.destination-link {
    display: inline-block;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    color: #68738a;
    text-decoration: none;
}

.destination-link:hover {
    color: #635bff;
}

.status-badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.status-active {
    color: #15803d;
    background: #dcfce7;
}

.status-inactive {
    color: #b45309;
    background: #fef3c7;
}

.status-expired {
    color: #dc2626;
    background: #fee2e2;
}

.action-group {
    display: flex;
    gap: 6px;
}

.action-button {
    padding: 7px 9px;
    border-radius: 6px;
    font-size: 11px;
    background: #f1f2f8;
    color: #374151;
}

.action-button:hover {
    background: #e5e7eb;
}

.action-button.danger {
    color: #dc2626;
    background: #fee2e2;
}

.action-button.danger:hover {
    background: #fecaca;
}

.loading-cell,
.empty-cell {
    text-align: center;
    padding: 45px !important;
    color: #8b93a5 !important;
}

.table-message {
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 8px;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 13px;
}

.hidden {
    display: none !important;
}


/* PAGINATION */

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding-top: 20px;
    color: #8b93a5;
    font-size: 12px;
}

.pagination-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pagination-buttons button {
    background: #ffffff;
    border: 1px solid #e2e6ef;
    padding: 9px 12px;
    color: #374151;
    font-size: 12px;
}

.pagination-buttons button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#pageIndicator {
    color: #374151;
    font-weight: 600;
}

.dashboard-footer {
    text-align: center;
    color: #9ca3af;
    font-size: 11px;
    padding: 25px 0;
}


/* RESPONSIVE */

@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-main {
        padding: 28px 24px;
    }
}

@media (max-width: 750px) {
    .dashboard-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        padding: 16px;
    }

    .sidebar-brand {
        margin-bottom: 20px;
    }

    .sidebar-section {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sidebar-label {
        width: 100%;
    }

    .sidebar-bottom {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-top: 18px;
        padding-top: 15px;
    }

    .sidebar-admin {
        margin-bottom: 0;
    }

    .logout-button {
        width: auto;
    }

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

    .table-toolbar {
        flex-direction: column;
    }

    .table-toolbar select {
        width: 100%;
        min-height: 42px;
    }

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

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

    .dashboard-main {
        padding: 22px 14px;
    }

    .management-card {
        padding: 15px;
    }

    .header-actions {
        width: 100%;
        flex-wrap: wrap;
    }
}
