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

:root {
    --bg-color: #f4f7f6;
    --paper-bg: #ffffff;
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --primary-color: #3498db;
    --primary-hover: #2980b9;
    --success-color: #2ecc71;
    --success-hover: #27ae60;
    --danger-color: #e74c3c;
    --danger-hover: #c0392b;
    --border-color: #e0e6ed;
    --line-color: #d1e2f3;
    --margin-line: #ff7675;
    
    --nav-btn-hover-border: #cbd5e1;
    --btn-primary-bg: #eef2ff;
    --btn-primary-text: #4f46e5;
    --btn-primary-border: #c7d2fe;
    --btn-primary-hover-bg: #e0e7ff;
    
    --placeholder-color: #cbd5e1;
    --table-th-bg: #f8fafc;
    --table-th-color: #64748b;
    --table-tr-hover: #f1f5f9;
    
    --lines-bg: #fdfdfd;
    --line-focus-border: #3b82f6;
    --line-focus-bg: rgba(59, 130, 246, 0.03);
    --bottom-nav-bg: #f8fafc;
    
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --transition-fast: 0.2s ease;
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --paper-bg: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary-color: #3b82f6;
    --primary-hover: #60a5fa;
    --success-color: #22c55e;
    --success-hover: #4ade80;
    --danger-color: #ef4444;
    --danger-hover: #f87171;
    --border-color: #334155;
    --line-color: #334155;
    --margin-line: #b91c1c;

    --nav-btn-hover-border: #475569;
    --btn-primary-bg: rgba(59, 130, 246, 0.15);
    --btn-primary-text: #60a5fa;
    --btn-primary-border: #3b82f6;
    --btn-primary-hover-bg: rgba(59, 130, 246, 0.25);
    
    --placeholder-color: #475569;
    --table-th-bg: #0f172a;
    --table-th-color: #94a3b8;
    --table-tr-hover: #334155;
    
    --lines-bg: #1e293b;
    --line-focus-border: #60a5fa;
    --line-focus-bg: rgba(96, 165, 250, 0.1);
    --bottom-nav-bg: #0f172a;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

/* Master Layouts */
.master-container {
    max-width: 960px;
    margin: 30px auto; 
    padding: 0 15px; 
}

.master-container.full-width {
    max-width: 100%;
}

/* Notebook Page Container */
.notebook-ui {
    background: var(--paper-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.notebook-ui:hover {
    box-shadow: var(--shadow-lg);
}

/* Top Navigation Bar */
.top-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px; 
    background: var(--paper-bg);
    border-bottom: 1px solid var(--border-color);
}

.nav-center strong {
    font-size: 1.05rem; 
    font-weight: 600;
    color: var(--text-main);
}

.nav-btn {
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-main);
    padding: 6px 12px; 
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem; 
    transition: all var(--transition-fast);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px; 
}

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

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

/* Create Form */
.create-form {
    display: flex;
    justify-content: center;
    gap: 10px; 
    margin: 15px 0; 
}

.create-form input {
    width: 400px;
    padding: 8px 12px; 
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem; 
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.create-form input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--line-focus-bg);
}

.create-form button {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 0 15px; 
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem; 
    cursor: pointer;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.create-form button:hover {
    background: var(--success-hover);
    transform: translateY(-1px);
}

/* Notebook Header (View Page) */
.notebook-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px; 
    border-bottom: 2px solid var(--border-color);
    background: var(--paper-bg);
}

.title-input {
    border: none;
    font-size: 1.3rem; 
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    width: 100%;
    outline: none;
    padding: 5px 0; 
    background: transparent;
    transition: color var(--transition-fast);
}

.title-input::placeholder {
    color: var(--placeholder-color);
}

.page-meta {
    font-size: 0.8rem; 
    color: var(--text-muted);
    text-align: right;
    line-height: 1.4; 
}

.page-meta strong {
    color: var(--text-main);
}

#save-status {
    display: inline-block;
    background: var(--bg-color);
    padding: 3px 8px; 
    border-radius: 12px;
    margin-top: 5px; 
    font-size: 0.7rem; 
    font-weight: 600;
    color: var(--text-muted);
}

/* Compact Table (Dashboard / Index) */
.compact-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--paper-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-top: 10px;
}

.compact-table th, 
.compact-table td {
    padding: 10px 14px; 
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    font-size: 0.9rem; 
}

.compact-table th {
    background: var(--table-th-bg);
    font-weight: 600;
    color: var(--table-th-color);
    text-transform: uppercase;
    font-size: 0.7rem; 
    letter-spacing: 0.05em;
}

.compact-table tr:last-child td {
    border-bottom: none;
}

.compact-table tbody tr {
    transition: background var(--transition-fast);
}

.compact-table tbody tr:hover {
    background: var(--table-tr-hover);
}

.table-input {
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.9rem; 
    font-weight: 500;
    color: var(--text-main);
    width: 100%;
    outline: none;
    padding: 3px 0; 
    border-bottom: 1px dashed transparent;
    transition: border-bottom-color var(--transition-fast);
}

.table-input:focus {
    border-bottom-color: var(--primary-color);
}

/* The Lined Paper Layout (View Page) */
.notebook-body {
    padding: 0;
}

.lines-container {
    padding: 15px 20px; 
    background: var(--lines-bg);
}

.line-row {
    display: flex;
    align-items: flex-end;
    margin-bottom: 4px; 
}

.notebook-line-left,
.notebook-line-right {
    border: none;
    border-bottom: 2px solid var(--line-color);
    background: transparent;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem; 
    outline: none;
    padding: 3px 6px; 
    color: var(--text-main);
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.notebook-line-left {
    width: 110px; 
    flex-shrink: 0;
}

.notebook-line-right {
    flex-grow: 1;
    width: auto;
}

.notebook-line-left:focus,
.notebook-line-right:focus {
    border-bottom-color: var(--line-focus-border);
    background: var(--line-focus-bg);
}

.vertical-partition {
    width: 2px; 
    height: 28px; 
    background-color: var(--margin-line);
    margin: 0 10px; 
    opacity: 0.7;
    border-radius: 2px;
}

/* Bottom Nav */
.bottom-nav {
    display: flex;
    justify-content: space-between;
    padding: 15px 20px; 
    border-top: 1px solid var(--border-color);
    background: var(--bottom-nav-bg);
}

/* Typographic sections */
.section-title {
    font-size: 1rem; 
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 10px; 
    display: flex;
    align-items: center;
    gap: 6px; 
}

.section-title.muted {
    color: var(--text-muted);
    margin-top: 30px; 
}

.empty-state {
    text-align: center;
    padding: 24px!important; 
    color: var(--text-muted);
    font-size: 0.9rem; 
}