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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background: #f5f7fa;
}

/* Login Page Styles */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-icon {
    color: #667eea;
    margin-bottom: 15px;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-hint {
    margin-top: 20px;
    text-align: center;
    color: #666;
}

/* Header Styles */
.header {
    background: white;
    border-bottom: 1px solid #e1e8ed;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

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

.logo-icon {
    color: #667eea;
}

.header h1 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

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

/* Search Box */
.search-box {
    position: relative;
}

.search-input {
    padding: 8px 35px 8px 12px;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    width: 300px;
    font-size: 14px;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

/* Container & Layout */
.container {
    display: flex;
    min-height: calc(100vh - 61px);
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: white;
    border-right: 1px solid #e1e8ed;
    padding: 20px;
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: 25px;
}

.sidebar-section h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #999;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-item-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
}

.category-item {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s;
}

.category-item:hover {
    background: #f5f7fa;
}

.category-item.active {
    background: #667eea;
    color: white;
}

.category-item svg {
    flex-shrink: 0;
}

.category-actions {
    display: none;
    gap: 2px;
}

.category-item-wrapper:hover .category-actions {
    display: flex;
}

.file-type-filter {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.radio-label:hover {
    background: #f5f7fa;
}

.radio-label input[type="radio"] {
    cursor: pointer;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.checkbox-label:hover {
    background: #f5f7fa;
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.checkbox-label span {
    font-size: 14px;
    font-weight: 500;
}

.per-page-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.per-page-selector label {
    font-size: 14px;
    color: #666;
}

.form-control-small {
    padding: 6px 10px;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.form-control-small:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.selected-count {
    color: #666;
    font-weight: 500;
    margin-right: 10px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5568d3;
}

.btn-secondary {
    background: #e1e8ed;
    color: #333;
}

.btn-secondary:hover:not(:disabled) {
    background: #d1d8dd;
}

.btn-danger {
    background: #f56565;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #e53e3e;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-icon {
    background: none;
    border: none;
    padding: 5px;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
    border-radius: 4px;
}

.btn-icon:hover {
    color: #667eea;
    background: #f5f7fa;
}

.btn-add-category {
    margin-bottom: 15px;
}

.btn-edit-category,
.btn-delete-category {
    padding: 4px;
}

.btn-delete-category:hover {
    color: #f56565;
}

.btn-share-category.active {
    color: #48bb78;
    background: #f0fff4;
}

.btn-share-category:hover {
    color: #667eea;
}

/* File Grid */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.file-item {
    position: relative;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
    cursor: pointer;
}

.file-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.file-item.selected {
    box-shadow: 0 0 0 3px #667eea;
}

.file-checkbox {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    z-index: 10;
}

.file-thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #f5f7fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-thumbnail.video {
    position: relative;
}

.file-thumbnail.video::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-left: 30px solid rgba(255, 255, 255, 0.9);
    border-top: 20px solid transparent;
    border-bottom: 20px solid transparent;
}

.file-thumbnail.no-thumb {
    background: #f5f7fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
}

.file-info {
    padding: 12px;
}

.file-name {
    font-weight: 500;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-meta {
    font-size: 12px;
    color: #999;
    display: flex;
    justify-content: space-between;
}

.file-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: none;
    gap: 5px;
}

.file-item:hover .file-actions {
    display: flex;
}

.file-action-btn {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
}

.file-action-btn:hover {
    background: white;
    color: #667eea;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 30px;
}

.pagination button {
    padding: 8px 12px;
    border: 1px solid #e1e8ed;
    background: white;
    color: #333;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    background: #f5f7fa;
    border-color: #667eea;
}

.pagination button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

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

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-content.modal-small {
    max-width: 500px;
}

.modal-content.modal-large {
    max-width: 900px;
}

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

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

.modal-body {
    padding: 25px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-hint {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #999;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
}

/* Upload Area */
.upload-area {
    border: 2px dashed #e1e8ed;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 20px;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: #667eea;
    background: #f5f7fa;
}

.upload-area svg {
    color: #667eea;
    margin-bottom: 15px;
}

.upload-area p {
    font-weight: 500;
    margin-bottom: 8px;
}

.upload-area small {
    color: #999;
    font-size: 12px;
}

.upload-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.upload-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f5f7fa;
    border-radius: 6px;
}

.upload-item-info {
    flex: 1;
}

.upload-item-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.upload-progress {
    height: 4px;
    background: #e1e8ed;
    border-radius: 2px;
    overflow: hidden;
}

.upload-progress-bar {
    height: 100%;
    background: #667eea;
    transition: width 0.3s;
}

.upload-item-status {
    font-size: 12px;
    color: #999;
}

.upload-item.success .upload-item-status {
    color: #48bb78;
}

.upload-item.error .upload-item-status {
    color: #f56565;
}

/* Alert */
.alert {
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.alert-error {
    background: #fff5f5;
    color: #c53030;
    border: 1px solid #feb2b2;
}

.alert-success {
    background: #f0fff4;
    color: #22543d;
    border: 1px solid #9ae6b4;
}

/* Preview Content */
#previewContent {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.preview-image,
.preview-video {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
    position: relative;
    z-index: 2;
    display: block;
    margin: 0 auto;
}

/* Preview Navigation */
.preview-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 10;
    backdrop-filter: blur(10px);
}

.preview-nav:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.preview-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.preview-prev {
    left: 20px;
}

.preview-next {
    right: 20px;
}

.preview-nav svg {
    width: 24px;
    height: 24px;
}

/* Responsive */
@media (max-width: 1024px) {
    .file-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }

    .sidebar {
        width: 250px;
    }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e1e8ed;
    }

    .header {
        flex-direction: column;
        gap: 15px;
    }

    .search-input {
        width: 100%;
    }

    .toolbar {
        flex-direction: column;
        gap: 15px;
    }

    .toolbar-left,
    .toolbar-right {
        width: 100%;
        flex-wrap: wrap;
    }

    .file-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
}
