/* Library Page Styles */

/* Layout */
.main-container {
    display: flex;
    height: calc(100vh - 60px);
    background-color: #f5f5f5;
}

/* Header */
.main-header {
    height: 60px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    padding: 0 20px;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.header-left {
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.logo-icon {
    font-size: 1.5rem;
}

.header-center {
    flex: 1;
    max-width: 500px;
    margin: 0 20px;
}

.search-bar {
    display: flex;
    background: #f5f5f5;
    border-radius: 8px;
    overflow: hidden;
}

.search-input {
    flex: 1;
    border: none;
    background: none;
    padding: 10px 15px;
    font-size: 14px;
}

.search-btn {
    background: none;
    border: none;
    padding: 0 15px;
    color: #666;
    cursor: pointer;
}

.search-btn:hover {
    color: #333;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-name {
    font-weight: 500;
    color: #333;
}

.user-role {
    font-size: 12px;
    color: #666;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 2px;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: white;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.btn-refresh {
    background: none;
    border: 1px solid #ddd;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #666;
}

.btn-refresh:hover {
    background: #f5f5f5;
}

/* Folder Tree - Windows Explorer Style */
.folder-tree {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    padding: 4px 0;
    background: #ffffff !important;
}

.tree-node {
    user-select: none;
    background: #ffffff !important;
}

.tree-node-content {
    display: flex;
    align-items: center;
    padding: 2px 4px;
    cursor: pointer;
    white-space: nowrap;
    font-size: 13px;
    background: transparent;
    border: 1px solid transparent;
    position: relative;
}

.tree-node-content:hover:not(.selected) {
    background: #e8f4fd !important;
    border: 1px solid #0078d4 !important;
    color: #000000 !important;
    padding: 1px 3px !important;
}

.tree-node-content.selected {
    background: #0078d4 !important;
    border: 1px solid #005a9e !important;
    color: #ffffff !important;
    padding: 1px 3px;
}

/* 호버시 모든 하위 요소 검정색 */
.tree-node-content:hover:not(.selected) * {
    color: #000000 !important;
}

/* 선택된 노드의 모든 하위 요소 흰색 */
.tree-node-content.selected .tree-expand,
.tree-node-content.selected .tree-icon,
.tree-node-content.selected .tree-label,
.tree-node-content.selected .tree-badge {
    color: #ffffff !important;
}

.tree-expand {
    width: 12px;
    height: 12px;
    margin-right: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #000000;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.tree-icon {
    margin-right: 4px;
    font-size: 14px;
}

.tree-label {
    flex: 1;
    font-size: 13px;
    color: #000000;
}

.tree-badge {
    margin-left: 5px;
    font-size: 11px;
}

.tree-children {
    display: none;
    overflow: hidden;
    transition: height 0.2s ease-out;
    background: #ffffff !important;
    margin-left: 12px;
}

.tree-children.expanded {
    display: block;
    background: #ffffff !important;
}

/* 레벨별 들여쓰기 */
.tree-node[data-level="0"] > .tree-children {
    margin-left: 2px;
}

.tree-node[data-level="1"] > .tree-children {
    margin-left: 10px;
}

.tree-node[data-level="2"] > .tree-children,
.tree-node[data-level="3"] > .tree-children,
.tree-node[data-level="4"] > .tree-children {
    margin-left: 12px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fafafa;
    overflow: hidden;
}

/* Navigation Bar */
.nav-bar {
    background: white;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.breadcrumb {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 14px;
}

.breadcrumb-item {
    color: #666;
}

.breadcrumb-item:not(:last-child)::after {
    content: '>';
    margin-left: 10px;
    color: #999;
}

.breadcrumb-item:last-child {
    color: #333;
    font-weight: 500;
}

.view-options {
    display: flex;
    gap: 5px;
}

.view-btn {
    background: white;
    border: 1px solid #ddd;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.view-btn:hover {
    background: #f5f5f5;
}

.view-btn.active {
    background: #1976d2;
    color: white;
    border-color: #1976d2;
}

/* File Container */
.file-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Grid View */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.file-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

.file-card:hover {
    border-color: #1976d2;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.file-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.file-name {
    font-size: 14px;
    color: #333;
    font-weight: 500;
    margin-bottom: 5px;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.file-size {
    font-size: 12px;
    color: #999;
}

.file-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #4caf50;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
}

.file-badge.private {
    background: #f44336;
}

/* List View */
.file-list {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.file-list table {
    width: 100%;
    border-collapse: collapse;
}

.file-list th {
    background: #f5f5f5;
    padding: 12px 15px;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    border-bottom: 1px solid #e0e0e0;
}

.file-list td {
    padding: 12px 15px;
    font-size: 14px;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
}

.file-list tr:hover {
    background: #fafafa;
}

.file-list tr:last-child td {
    border-bottom: none;
}

.file-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    background: none;
    border: 1px solid #ddd;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.action-btn:hover {
    background: #f5f5f5;
    border-color: #1976d2;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: #999;
}

.empty-state svg {
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 16px;
}

/* Pagination */
.pagination {
    background: white;
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.page-btn {
    padding: 8px 16px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.page-btn:hover:not(:disabled) {
    background: #f5f5f5;
    border-color: #1976d2;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    font-size: 14px;
    color: #666;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.pdf-modal {
    max-width: 1200px;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* File Info Grid */
.file-info-grid {
    display: grid;
    gap: 15px;
}

.info-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 10px;
}

.info-row label {
    font-weight: 600;
    color: #666;
}

.info-row span {
    color: #333;
}

/* Loading */
.loading {
    text-align: center;
    padding: 20px;
    color: #999;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: #1976d2;
    color: white;
}

.btn-primary:hover {
    background: #1565c0;
}

.btn-secondary {
    background: #757575;
    color: white;
}

.btn-secondary:hover {
    background: #616161;
}

.btn-logout {
    background: #f44336;
    color: white;
}

.btn-logout:hover {
    background: #d32f2f;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        max-height: 200px;
    }
    
    .file-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    
    .modal-content {
        width: 95%;
    }
}
