/* CSS Variables for Light & Dark Theme */
:root {
    /* Light Theme (White & Gray) */
    --bg-body: #f4f4f5;
    --bg-surface: #ffffff;
    --text-main: #18181b;
    --text-muted: #71717a;
    --border-color: #e4e4e7;
    --hover-bg: #f4f4f5;
    --primary-color: #3f3f46;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    
    --nav-height: 64px;
}

[data-theme="dark"] {
    /* Dark Theme */
    --bg-body: #0f0f11;
    --bg-surface: #18181b;
    --text-main: #f4f4f5;
    --text-muted: #a1a1aa;
    --border-color: #27272a;
    --hover-bg: #27272a;
    --primary-color: #e4e4e7;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5);
}

/* Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: background-color 0.3s ease, color 0.3s ease;
    line-height: 1.5;
    overflow-x: hidden;
}

/* Navigation Bar */
nav {
    height: var(--nav-height);
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 10;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Buttons */
.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

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

.btn-back {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-back:hover {
    background-color: var(--hover-bg);
}

/* Main Container */
#app-container {
    min-height: calc(100vh - var(--nav-height));
    display: flex;
    flex-direction: column;
}

/* View: Document List */
#list-view {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 24px;
    width: 100%;
}

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

.header-text h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.search-container {
    display: flex;
    align-items: center;
    flex: 1;
    max-width: 300px;
    min-width: 200px;
}

#search-input {
    width: 100%;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#search-input:focus {
    border-color: var(--text-muted);
    box-shadow: 0 0 0 2px var(--border-color);
}

.doc-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.doc-list-item {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px 20px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.doc-list-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
    border-color: var(--text-muted);
}

.doc-list-item .doc-icon {
    color: var(--primary-color);
    display: flex;
    align-items: center;
}

.doc-list-item .doc-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-main);
}

/* View: PDF Viewer */
#viewer-view {
    display: none;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 100;
    background-color: var(--bg-body);
}

.viewer-header {
    padding: 12px 24px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.viewer-title {
    font-weight: 500;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pdf-container {
    flex: 1;
    width: 100%;
    background-color: #525659; /* Standard PDF viewer background */
    position: relative;
}

iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Utilities */
.hidden {
    display: none !important;
}
