/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', 'Courier', monospace;
    background-color: #1f1d20;
    color: #cccdcf;
    height: 100vh;
    overflow: hidden;
}

/* Toolbar styles */
.toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: #222;
    border-bottom: 1px solid #333;
    z-index: 1000;
    padding: 0.5rem 0;
}

.toolbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.nav-controls {
    display: flex;
    gap: 0.5rem;
}

.page-info {
    font-size: 0.9rem;
    font-weight: 500;
    color: #ccc;
}

.fullscreen-controls {
    display: flex;
    gap: 0.5rem;
}

/* Button styles */
.btn {
    background-color: #333;
    border: 1px solid #444;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 40px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    background-color: #444;
    border-color: #555;
}

.btn:active {
    background-color: #555;
    transform: translateY(1px);
}

.btn:disabled {
    background-color: #222;
    border-color: #333;
    color: #666;
    cursor: not-allowed;
}

/* Viewer container */
.viewer-container {
    position: fixed;
    top: 60px; /* Height of toolbar */
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.viewer-area {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* Canvas styles */
.pdf-canvas {
    background-color: #222;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Message styles */
.loading-message,
.error-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #333;
    padding: 1rem 2rem;
    border-radius: 8px;
    border: 1px solid #444;
    font-size: 1rem;
    text-align: center;
    z-index: 10;
}

.error-message {
    background-color: #4a1a1a;
    border-color: #6a2a2a;
    color: #ff6b6b;
}

/* Fullscreen styles */
.viewer-container:fullscreen {
    top: 0;
    background-color: #000;
}

.viewer-container:fullscreen .toolbar {
    background-color: rgba(34, 34, 34, 0.95);
    backdrop-filter: blur(10px);
}

/* Responsive design */
@media (max-width: 768px) {
    .toolbar-content {
        padding: 0 0.5rem;
    }
    
    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
        min-width: 36px;
        height: 32px;
    }
    
    .page-info {
        font-size: 0.8rem;
    }
    
    .viewer-area {
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .toolbar-content {
        gap: 0.5rem;
    }
    
    .nav-controls {
        gap: 0.25rem;
    }
    
    .btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
        min-width: 32px;
        height: 28px;
    }
}

/* Animation for page transitions */
.pdf-canvas {
    transition: opacity 0.2s ease;
}

.pdf-canvas.loading {
    opacity: 0.7;
}

/* Focus styles for accessibility */
.btn:focus {
    outline: 2px solid #4a9eff;
    outline-offset: 2px;
}

/* Hide scrollbars */
body::-webkit-scrollbar {
    display: none;
}

body {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* DOS-style Directory View */
.directory-view {
    width: 100vw;
    height: 100vh;
    background-color: #1f1d20;
    color: #cccdcf;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    font-family: 'Courier New', 'Courier', monospace;
}

.dos-header {
    margin-bottom: 2rem;
    border-bottom: 2px solid #c6af99;
    padding-bottom: 1rem;
}

.dos-title {
    font-size: 2rem;
    font-weight: bold;
    letter-spacing: 0.2em;
    margin-bottom: 0.5rem;
    color: #c6af99;
}

.dos-subtitle {
    font-size: 1rem;
    color: #af9a8b;
}

.dos-content {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 0.5rem;
}

.dos-footer {
    padding: 0.5rem 0;
    text-align: left;
    border-top: 1px solid #755f56;
    color: #af9a8b;
    font-size: 0.9rem;
    margin-top: auto;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    line-height: 1.4;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 0.4rem 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    border-radius: 4px;
}

.file-item:hover {
    background-color: #2f3924;
    border: 1px solid #755f56;
}

.file-item:active {
    background-color: #191d13;
}

.file-dash {
    margin-right: 0.5rem;
    color: #755f56;
    font-weight: bold;
}

.file-icon {
    margin-right: 0.75rem;
    font-size: 1.1rem;
    color: #755f56;
}

.file-name {
    font-size: 1.1rem;
    letter-spacing: 0.05em;
    color: #cccdcf;
}

.lock-icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    margin-left: 0.35em;
    color: #c6af99;
}

.file-ext {
    color: #c6af99;
}

/* PDF View wrapper */
.pdf-view {
    width: 100vw;
    height: 100vh;
    background-color: #111;
}

/* Back button styling */
.back-btn {
    background-color: #2f3924;
    border-color: #594035;
    color: #c6af99;
    font-weight: bold;
}

.back-btn:hover {
    background-color: #594035;
    color: #cccdcf;
    border-color: #755f56;
}

/* Restore modern font for PDF viewer */
.pdf-view {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.pdf-view .toolbar {
    background-color: #222;
}

.pdf-view .btn {
    color: #fff;
}

.pdf-view .back-btn {
    color: #c6af99;
}

/* Document viewer styles */
.document-viewer-container {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #2b2b2b;
    overflow: hidden;
}

.document-loading-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: #cccdcf;
    font-size: 1.1rem;
}

.document-loading-message p {
    margin: 0.5rem 0;
}

.document-loading-message p:first-child {
    font-size: 1.2rem;
    color: #c6af99;
}

/* Folder item styles */
.folder-item .file-name {
    color: #8ab4f8;
    font-weight: bold;
}

.folder-item:hover {
    background-color: #2d3845;
    border-color: #4a9eff;
}

.back-item {
    margin-bottom: 1rem;
    border-bottom: 1px solid #755f56;
    padding-bottom: 0.5rem;
}

.back-item .file-name {
    color: #af9a8b;
    font-style: italic;
}

.back-item:hover {
    background-color: #2f2924;
}

/* Authentication Modal */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.auth-container {
    background-color: #2a2a2a;
    border: 2px solid #755f56;
    border-radius: 8px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

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

.auth-header h2 {
    color: #c6af99;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.auth-header p {
    color: #af9a8b;
    font-size: 0.9rem;
}

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

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

.form-group label {
    color: #c6af99;
    font-size: 0.9rem;
    font-weight: bold;
}

.form-group input {
    background-color: #1f1d20;
    border: 1px solid #755f56;
    border-radius: 4px;
    padding: 0.75rem;
    color: #cccdcf;
    font-family: 'Courier New', 'Courier', monospace;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #c6af99;
}

.auth-error {
    background-color: #4a1a1a;
    border: 1px solid #6a2a2a;
    border-radius: 4px;
    padding: 0.75rem;
    color: #ff6b6b;
    font-size: 0.9rem;
    text-align: center;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.form-actions .btn {
    flex: 1;
}

.btn-primary {
    background-color: #594035;
    border-color: #755f56;
    color: #c6af99;
}

.btn-primary:hover {
    background-color: #755f56;
    color: #cccdcf;
}

.btn-secondary {
    background-color: #333;
    border-color: #444;
    color: #999;
}

.btn-secondary:hover {
    background-color: #444;
    color: #ccc;
}

/* Responsive directory view */
@media (max-width: 768px) {
    .directory-view {
        padding: 1rem;
    }

    .dos-title {
        font-size: 1.5rem;
    }

    .dos-subtitle {
        font-size: 0.9rem;
    }

    .file-item {
        padding: 0.5rem 0.75rem;
    }

    .file-name {
        font-size: 1rem;
    }

    .auth-container {
        padding: 1.5rem;
    }

    .auth-header h2 {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .directory-view {
        padding: 0.75rem;
    }

    .dos-title {
        font-size: 1.2rem;
    }

    .file-icon {
        margin-right: 0.5rem;
    }

    .file-name {
        font-size: 0.9rem;
    }

    .auth-container {
        padding: 1rem;
    }

    .form-actions {
        flex-direction: column;
    }
}
