:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --success: #10b981;
    --danger: #ef4444;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --border-focus: #818cf8;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 2.5rem 1.25rem;
    width: 100%;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.badge {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 9999px;
    margin-bottom: 0.75rem;
}

.app-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.app-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

/* Form Styling */
.shortener-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.input-wrapper {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    background: #fff;
    transition: all 0.2s ease;
    overflow: hidden;
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.input-icon {
    padding-left: 1rem;
    color: var(--text-muted);
    font-size: 1.1rem;
    user-select: none;
}

.input-wrapper input {
    width: 100%;
    padding: 0.85rem 1rem;
    border: none;
    outline: none;
    font-size: 1rem;
    color: var(--text-main);
    background: transparent;
}

.alias-prefix {
    background: #f1f5f9;
    padding: 0.85rem 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    border-right: 1px solid var(--border);
    white-space: nowrap;
    user-select: none;
}

.hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-main);
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-sm {
    padding: 0.45rem 0.9rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

/* Result Card */
.result-card {
    border-left: 4px solid var(--success);
    animation: fadeIn 0.3s ease-in-out;
}

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

.result-header h3 {
    font-size: 1.15rem;
    color: var(--text-main);
}

.result-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.shortened-link {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    word-break: break-all;
}

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

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

.target-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    word-break: break-all;
}

.qr-container {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px dashed var(--border);
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.qr-code img {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px;
    background: white;
}

/* Recent URLs Table */
.recent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.recent-table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

td a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

td a:hover {
    text-decoration: underline;
}

.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
}

/* API Docs Section */
.api-box {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: var(--radius-md);
    padding: 1.25rem;
    font-family: monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    margin-top: 1rem;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #1e293b;
    color: #fff;
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.toast-error {
    background: var(--danger);
}

.toast.toast-success {
    background: var(--success);
}

/* 404 Error Card */
.error-page {
    justify-content: center;
    align-items: center;
}

.error-card {
    text-align: center;
    max-width: 480px;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Footer */
footer {
    margin-top: auto;
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    background: #fff;
}

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

@media (max-width: 640px) {
    .container {
        padding: 1.5rem 1rem;
    }
    .result-box {
        flex-direction: column;
        align-items: flex-start;
    }
    .result-actions {
        width: 100%;
    }
    .result-actions .btn {
        flex: 1;
    }
}
/* ===================================================
   Dashboard, Authentication & Settings Styling
   =================================================== */

/* Navbar */
.navbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.85rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.15rem;
    color: #0f172a;
}

.nav-brand .brand-icon {
    font-size: 1.4rem;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.15s ease;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary);
    font-weight: 600;
}

.user-pill {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    color: var(--text-main);
    font-weight: 500;
}

/* Dashboard Container */
.dashboard-container {
    max-width: 1100px;
    padding-top: 1.75rem;
}

/* KPI Metrics Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.kpi-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.kpi-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.25rem;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
}

/* Quick Form Grid */
.quick-form-grid {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Table Header & Search */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.search-box input {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
    outline: none;
    min-width: 260px;
    transition: border-color 0.15s ease;
}

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

/* Badges */
.badge-success {
    background: #ecfdf5;
    color: #059669;
}

.badge-muted {
    background: #f1f5f9;
    color: #64748b;
}

.badge-danger {
    background: #fef2f2;
    color: #dc2626;
}

.click-badge {
    background: #e0e7ff;
    color: #4338ca;
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 0.8rem;
}

.action-buttons {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* Alerts */
.alert {
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.alert-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.alert-danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* Auth Pages (Login / Signup) */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 1rem;
    background: #f1f5f9;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 2.5rem;
    margin-bottom: 0;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h2 {
    font-size: 1.75rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.35rem;
}

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

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.btn-block {
    width: 100%;
    margin-top: 0.5rem;
}

.auth-footer {
    margin-top: 1.75rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Settings Page */
.settings-header {
    margin-bottom: 2rem;
}

.settings-header h2 {
    font-size: 1.85rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.35rem;
}

.settings-header p {
    color: var(--text-muted);
    font-size: 1rem;
}

.settings-card {
    margin-bottom: 2rem;
}

.section-title {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}

.section-icon {
    font-size: 1.6rem;
}

.section-title h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.modal-content {
    background: #ffffff;
    max-width: 360px;
    width: 90%;
    position: relative;
    padding: 2rem;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.close-btn:hover {
    color: var(--text-main);
}
