/* 
    HCPD Handbook Portal - Minimalist Design System
    Focus: Simplicity, Clarity, Accessibility
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Light Theme (Default) */
    --bg-main: #fcfcfc;
    --bg-card: #ffffff;
    --text-main: #1a1a1a;
    --text-muted: #666666;
    --accent: #000000;
    --accent-primary: #111827;
    --border: #f3f4f6;
    --border-strong: #e5e7eb;
    --radius: 2px;
    --shadow: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-hover: 0 10px 25px rgba(0,0,0,0.1);
    --input-bg: #ffffff;
    --nav-bg: #ffffff;
    --header-border: #eeeeee;
}

[data-theme="dark"] {
    /* Dark Theme */
    --bg-main: #0a0a0c;
    --bg-card: #141417;
    --text-main: #f1f1f1;
    --text-muted: #a1a1aa;
    --accent: #ffffff;
    --accent-primary: #10b981;
    --border: #1f2937;
    --border-strong: #374151;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --input-bg: #1a1a1e;
    --nav-bg: #111114;
    --header-border: #1a1a1e;
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body.editor-active {
    overflow: hidden;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Header & Nav */
.header {
    border-bottom: 1px solid var(--header-border);
    background: var(--nav-bg);
    padding: 1rem 0;
}

.nav {
    border-bottom: 1px solid var(--header-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 70px;
    display: flex;
    align-items: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.container.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1400px;
}

.nav-brand {
    font-size: 1.1rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main);
    text-decoration: none;
}

.nav-brand span {
    color: #059669;
    font-weight: 400;
    opacity: 0.8;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0.5rem 1rem;
    border-radius: 2px;
    transition: all 0.2s;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--text-main);
    background: rgba(255,255,255,0.03);
}

.nav-links a.active {
    border-bottom: 2px solid #059669;
}

/* User Controls Zone (Right Side) */
.user-tools {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding-left: 1.5rem;
    border-left: 1px solid var(--border);
    margin-left: auto;
}

.nav-avatar-link {
    display: flex;
    align-items: center;
}

.nav-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border-strong);
    background: var(--bg-card);
    transition: transform 0.2s;
}

.nav-avatar:hover {
    transform: scale(1.1);
    border-color: #059669;
}

.theme-toggle-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.5rem;
    transition: color 0.2s;
}

.theme-toggle-btn:hover {
    color: var(--accent-primary);
}

/* Typography */
h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.5rem; }
h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 1rem; }
p { color: var(--text-muted); margin-bottom: 1rem; }

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

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: background 0.1s;
}

.list-item:hover {
    background: var(--bg-main);
    opacity: 0.8;
}

.list-item:last-child {
    border-bottom: none;
}

/* Handbook styling */
.handbook-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 4px;
    background: var(--border-strong);
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid var(--border-strong);
    background: var(--bg-card);
    color: var(--text-main);
    transition: all 0.2s;
}

.btn:hover {
    background: var(--bg-main);
    border-color: var(--text-muted);
}

.btn-primary {
    background: #10b981;
    color: white;
}

[data-theme="dark"] .btn-primary {
    background: #10b981;
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
}

/* Profile Section */
.profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.avatar-large {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--border);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.input, .textarea, .select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    background-color: var(--input-bg);
    color: var(--text-main);
}

.input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Login box */
.login-box {
    max-width: 400px;
    margin: 10vh auto;
    text-align: center;
}

/* Footer */
.footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
}

/* Toast Notifications System */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-end;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    color: var(--text-main);
    padding: 1rem 1.75rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 320px;
    max-width: 450px;
    animation: slideIn 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.toast-success i { color: #10b981; }
.toast-error i { color: #ef4444; }
.toast-info i { color: #10b981; }

.toast.fade-out {
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.5s ease-in;
}

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

/* Dashboard Enhancements */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.admin-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.admin-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-hover);
}

.admin-card i {
    font-size: 2rem;
    color: var(--accent-primary);
}

.admin-card h3 {
    font-size: 1.1rem;
    margin: 0;
}

.admin-card p {
    font-size: 0.85rem;
    margin: 0;
    color: var(--text-muted);
}

/* Editor Overlay */
.editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-main);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.editor-header {
    background: var(--bg-card);
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-strong);
    position: sticky;
    top: 0;
    z-index: 1001;
}

.editor-title-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.editor-title-input {
    font-size: 1.25rem;
    font-weight: 600;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    width: 300px;
    background: transparent;
    color: var(--text-main);
}

.editor-title-input:hover {
    background: var(--bg-main);
}

.editor-title-input:focus {
    outline: 2px solid var(--accent);
    background: var(--bg-card);
}

.editor-body {
    flex: 1;
    padding: 2rem;
    display: flex;
    justify-content: center;
}

.document-page {
    width: 850px;
    min-height: 1100px;
    background: #ffffff;
    color: #1a1a1a;
    padding: 50px 70px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    margin-bottom: 100px;
}

/* Custom TinyMCE Overrides */
.tox-tinymce {
    border: none !important;
}

.tox .tox-edit-area__iframe {
    background-color: transparent !important;
}

.editor-sidebar {
    width: 300px;
    background: var(--bg-card);
    border-left: 1px solid var(--border-strong);
    padding: 1.5rem;
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
}

.editor-layout {
    display: flex;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Theme Toggle Button */
.theme-toggle-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.theme-toggle-btn:hover {
    background: var(--bg-main);
    transform: rotate(15deg);
}

/* Handbook List View */
.handbook-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.handbook-list-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

.handbook-list-item:hover {
    border-color: var(--accent-primary);
    transform: translateX(4px);
    box-shadow: var(--shadow-hover);
}

.handbook-main-info {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.handbook-main-info > i {
    font-size: 1.5rem;
    color: var(--accent-primary);
}

.handbook-title-group h3 {
    font-size: 1.05rem;
    margin: 0 0 0.25rem 0;
    color: var(--text-main);
}

.handbook-sub-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.meta-divider {
    color: var(--border-strong);
}

.handbook-action-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: var(--text-muted);
}

.handbook-action-info .badge {
    min-width: 60px;
    text-align: center;
}
/* Notification Bell & Dropdown */
.notification-bell-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    position: relative;
    padding: 0.5rem;
    transition: color 0.2s;
}

.notification-bell-btn:hover {
    color: var(--accent-primary);
}

.notification-bell-btn .badge-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 17px;
    height: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--nav-bg);
    box-shadow: 0 2px 5px rgba(239, 68, 68, 0.4);
    z-index: 2;
    pointer-events: none;
    line-height: 1; /* Reset line height for perfect vertical centering */
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 350px;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-hover);
    border-radius: var(--radius);
    z-index: 1000;
    margin-top: 1rem;
    display: none;
    max-height: 500px;
    overflow-y: auto;
}

.notification-dropdown::-webkit-scrollbar {
    width: 6px;
}
.notification-dropdown::-webkit-scrollbar-track {
    background: transparent;
}
.notification-dropdown::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 4px;
}
.notification-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.notification-dropdown.active {
    display: block;
    animation: slideDown 0.2s ease-out;
}

.notification-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    font-weight: 800;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.notification-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
    text-decoration: none;
    display: block;
    color: var(--text-main);
}

.notification-item:hover {
    background: rgba(255,255,255,0.02);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-content {
    font-size: 0.85rem;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
