/* --- Global Reset & Fonts --- */
:root {
    --primary-color: #007bff; --primary-hover: #0056b3;
    --secondary-color: #6c757d; --danger-color: #dc3545;
    --success-color: #28a745; --info-color: #17a2b8; --warning-color: #ffc107;
    --bg-light: #f8f9fa; --bg-white: #ffffff;
    --border-color: #dee2e6; --text-dark: #212529; --text-muted: #6c757d;
    --sidebar-width: 240px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background-color: var(--bg-light); color: var(--text-dark); font-size: 16px; line-height: 1.6; }

/* --- Components & Badges --- */
.btn { display: inline-block; padding: 0.6rem 1.2rem; border: none; border-radius: 5px; text-decoration: none; cursor: pointer; font-weight: 500; transition: background-color 0.2s, box-shadow 0.2s; white-space: nowrap; text-align: center; }
.btn-primary { background: var(--primary-color); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--secondary-color); color: #fff; }
.btn-danger { background: var(--danger-color); color: #fff; }
.btn-info { background: var(--info-color); color: #fff; }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.875rem; }
.btn-copy { background: var(--secondary-color); color: #fff; }
.btn-copy.copied { background: var(--success-color); }
.btn:active { transform: translateY(1px); }

.badge { padding: .3em .65em; font-size: 75%; font-weight: 700; line-height: 1; text-align: center; white-space: nowrap; vertical-align: baseline; border-radius: .25rem; color: #fff; }
.badge.page { background-color: var(--primary-color); }
.badge.link { background-color: var(--info-color); }
.badge.active { background-color: var(--success-color); }
.badge.inactive { background-color: var(--secondary-color); }
.badge.permanent { background-color: var(--warning-color); color: #212529; }
.badge.default { background-color: #343a40; }

/* --- Layout --- */
.admin-wrapper { display: flex; }
.sidebar { width: var(--sidebar-width); height: 100vh; background: #212529; color: #fff; position: fixed; display: flex; flex-direction: column; }
.sidebar .logo { padding: 1.5rem; font-size: 1.5rem; text-align: center; font-weight: bold; background-color: rgba(0,0,0,0.2); }
.sidebar .logo a { color: #fff; text-decoration: none; }
.sidebar ul { list-style: none; flex-grow: 1; padding-top: 1rem; }
.sidebar ul a { display: block; padding: 1rem 1.5rem; color: #adb5bd; text-decoration: none; transition: background 0.2s; border-left: 3px solid transparent; }
.sidebar ul a:hover, .sidebar ul a.active { background: #343a40; color: #fff; border-left-color: var(--primary-color); }
.sidebar .nav-footer { padding: 1.5rem; text-align: center; }
.main-content { margin-left: var(--sidebar-width); width: calc(100% - var(--sidebar-width)); padding: 2rem; }

/* --- Containers & Tables --- */
.content-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding-bottom: 1rem; margin-bottom: 2rem; }
.content-header div { display: flex; gap: 0.5rem; }
table { width: 100%; border-collapse: collapse; background: var(--bg-white); box-shadow: 0 2px 4px rgba(0,0,0,0.05); border-radius: 8px; overflow: hidden; }
th, td { padding: 1rem; text-align: left; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
th { background: var(--bg-light); font-weight: 600; font-size: 0.9em; text-transform: uppercase; color: var(--text-muted); }
tr:last-child td { border-bottom: none; }
tr:hover { background-color: #f5f5f5; }
td.actions { white-space: nowrap; width: 1%; } /* Fix alignment issue */
td.actions > * { display: inline-flex; gap: 0.5rem; align-items: center; }
td.actions form { margin: 0; }
.share-actions { display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-start; }

/* --- Forms & Cards --- */
.stats-card, .page-form { background: var(--bg-white); padding: 2.5rem; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.05); }
.stats-card { margin-bottom: 2rem; }
.stats-card h3 { margin-top:0; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border-color); padding-bottom: 1rem; }
.form-group { margin-bottom: 1.5rem; }
label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
input[type="text"], input[type="password"], input[type="url"], textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, textarea:focus { border-color: var(--primary-color); box-shadow: 0 0 0 2px rgba(0,123,255,0.25); outline: none; }
textarea { resize: vertical; }

.error-message { color: var(--danger-color); background-color: #f8d7da; padding: 1rem; border-radius: 4px; margin-bottom: 1rem; border: 1px solid #f5c6cb; }
.success-message { color: var(--success-color); background-color: #d4edda; padding: 1rem; border-radius: 4px; margin-bottom: 1rem; border: 1px solid #c3e6cb; }

/* --- Login & Password Prompt --- */
.login-container, .password-prompt-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
    background-color: var(--bg-light);
}
.login-box, .password-prompt-box {
    width: 100%;
    max-width: 400px;
    background: var(--bg-white);
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 25px rgba(0,0,0,0.1);
}
.login-box h1, .password-prompt-box h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    text-align: center;
    word-break: break-all;
}
.login-box p, .password-prompt-box p {
    margin-bottom: 1.5rem;
    color: var(--text-muted);
    text-align: center;
}
.login-box .form-group, .password-prompt-box .form-group {
    margin-bottom: 1rem;
}
.login-box button, .password-prompt-box button {
    width: 100%;
}

/* --- Stats Page Specific --- */
.permanent-link-widget {
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.permanent-link-widget h3 {
    margin-top: 0;
    margin-bottom: 1rem;
}
.permanent-link-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--bg-light);
    border-radius: 6px;
    margin-bottom: 1rem;
}
.permanent-link-info strong {
    font-family: monospace;
    font-size: 1.1em;
    word-break: break-all;
}
.permanent-link-actions {
    display: flex;
    gap: 0.5rem;
}