/* Basic Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Document Type Selection Styles */
.document-type-selection {
    padding: 20px 0;
}

.document-type-selection h3 {
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 500;
    color: #e8eaed;
}

body.light-mode .document-type-selection h3 {
    color: #202124;
}

.document-type-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.document-type-option {
    display: flex;
    align-items: center;
    padding: 16px;
    border: 2px solid #3c4043;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #2d2d2d;
}

body.light-mode .document-type-option {
    border-color: #dadce0;
    background-color: #fff;
}

.document-type-option:hover {
    border-color: #1a73e8;
    background-color: rgba(26, 115, 232, 0.05);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.light-mode .document-type-option:hover {
    background-color: rgba(26, 115, 232, 0.05);
}

.document-type-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background-color: #1a73e8;
    border-radius: 8px;
    margin-right: 16px;
    flex-shrink: 0;
}

.document-type-icon i {
    color: white;
    font-size: 24px;
}

.document-type-info {
    flex: 1;
}

.document-type-info h4 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
    color: #e8eaed;
}

body.light-mode .document-type-info h4 {
    color: #202124;
}

.document-type-info p {
    font-size: 14px;
    color: #9aa0a6;
    margin: 0;
}

body.light-mode .document-type-info p {
    color: #5f6368;
}

/* Drag and Drop Styles */
.file-area.drag-over {
    background-color: rgba(26, 115, 232, 0.1);
    border: 2px dashed #1a73e8;
    border-radius: 8px;
    position: relative;
}

.file-area.drag-over::before {
    content: "Drop files here to upload";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(26, 115, 232, 0.9);
    color: white;
    padding: 20px 40px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 500;
    z-index: 1000;
    pointer-events: none;
}

body.light-mode .file-area.drag-over {
    background-color: rgba(26, 115, 232, 0.05);
}

/* Upload Progress Styles */
.upload-progress {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #2d2d2d;
    border: 1px solid #3c4043;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    min-width: 300px;
    transition: background-color 0.3s, border-color 0.3s;
}

body.light-mode .upload-progress {
    background-color: #fff;
    border-color: #dadce0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.upload-progress-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.upload-progress-content i {
    color: #1a73e8;
    font-size: 24px;
}

.upload-progress-content span {
    font-size: 14px;
    font-weight: 500;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background-color: #3c4043;
    border-radius: 2px;
    overflow: hidden;
}

body.light-mode .progress-bar {
    background-color: #e8eaed;
}

.progress-fill {
    height: 100%;
    background-color: #1a73e8;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

#progressPercent {
    font-size: 12px;
    font-weight: 500;
    color: #1a73e8;
    text-align: center;
    margin-top: 4px;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: #1e1e1e;
    color: #e8eaed;
    transition: background-color 0.3s, color 0.3s;
}

body.light-mode {
    background-color: #f9f9f9;
    color: #202124;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
header {
    background-color: #2d2d2d;
    box-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.3s, box-shadow 0.3s;
}

body.light-mode header {
    background-color: #fff;
}

header .logo {
    font-size: 24px;
    font-weight: 500;
    color: #9aa0a6;
    transition: color 0.3s;
}

body.light-mode header .logo {
    color: #5f6368;
}

header .search {
    flex-grow: 1;
    margin: 0 20px;
    max-width: 720px;
}

header .search input {
    width: 100%;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: 24px;
    background-color: #3c4043;
    color: #e8eaed;
    outline: none;
    transition: background-color 0.3s, color 0.3s;
}

body.light-mode header .search input {
    background-color: #f1f3f4;
    color: #202124;
}

header .search input:focus {
    background-color: #45474a;
    border-color: #5f6368;
    box-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
    transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

body.light-mode header .search input:focus {
    background-color: #fff;
    border-color: #dadce0;
}

header .header-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Sidebar */
.sidebar {
    width: 256px;
    background-color: #2d2d2d;
    border-right: 1px solid #3c4043;
    padding: 15px 0;
    overflow-y: auto;
    transition: background-color 0.3s, border-color 0.3s;
}

body.light-mode .sidebar {
    background-color: #fff;
    border-right: 1px solid #dadce0;
}

.sidebar .nav-item {
    padding: 10px 24px;
    color: #9aa0a6;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background-color 0.3s, color 0.3s;
}

body.light-mode .sidebar .nav-item {
    color: #5f6368;
}

.sidebar .nav-item:hover, .sidebar .nav-item.active {
    background-color: #3c4043;
    color: #e8eaed;
    transition: background-color 0.3s, color 0.3s;
}

body.light-mode .sidebar .nav-item:hover, body.light-mode .sidebar .nav-item.active {
    background-color: #f8f9fa;
    color: #202124;
}

.sidebar .nav-item i {
    margin-right: 16px;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    display: flex;
    overflow: hidden;
}

.file-area {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
}

/* File View Modes */
.view-mode {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.view-mode button {
    background: none;
    border: none;
    cursor: pointer;
    margin-left: 10px;
    color: #9aa0a6;
    transition: color 0.3s;
}

body.light-mode .view-mode button {
    color: #5f6368;
}

.view-mode button.active {
    color: #e8eaed;
    transition: color 0.3s;
}

body.light-mode .view-mode button.active {
    color: #202124;
}

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

.file-card {
    background-color: #2d2d2d;
    border: 1px solid #3c4043;
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: box-shadow 0.2s, background-color 0.3s, border-color 0.3s;
    position: relative;
}

body.light-mode .file-card {
    background-color: #fff;
    border: 1px solid #dadce0;
}

.file-card:hover {
    box-shadow: 0 1px 3px 0 rgba(60, 64, 67, 0.3);
}

.file-card .file-icon {
    width: 48px;
    height: 48px;
    background-color: #3c4043;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    margin-bottom: 8px;
    transition: background-color 0.3s;
}

body.light-mode .file-card .file-icon {
    background-color: #f1f3f4;
}

.file-card .file-thumbnail {
    width: 48px;
    height: 48px;
    background-color: #3c4043;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    margin-bottom: 8px;
    overflow: hidden;
    position: relative;
    transition: background-color 0.3s;
}

body.light-mode .file-card .file-thumbnail {
    background-color: #f1f3f4;
}

.file-card .file-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    transition: transform 0.2s ease;
}

.file-card:hover .file-thumbnail img {
    transform: scale(1.05);
}

.file-card .file-thumbnail .fallback-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.file-card .file-name {
    font-size: 14px;
    color: #e8eaed;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s;
}

body.light-mode .file-card .file-name {
    color: #202124;
}

.file-card .file-info {
    font-size: 12px;
    color: #9aa0a6;
    transition: color 0.3s;
}

body.light-mode .file-card .file-info {
    color: #5f6368;
}

.file-card .lock-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    color: #f29900;
}

/* List View */
.list-view {
    width: 100%;
    border-collapse: collapse;
}

.list-view thead {
    border-bottom: 1px solid #3c4043;
    transition: border-color 0.3s;
}

body.light-mode .list-view thead {
    border-bottom: 1px solid #dadce0;
}

.list-view th {
    text-align: left;
    padding: 8px 16px;
    color: #9aa0a6;
    font-size: 12px;
    font-weight: 500;
    transition: color 0.3s;
}

body.light-mode .list-view th {
    color: #5f6368;
}

.list-view tbody tr {
    border-bottom: 1px solid #3c4043;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.3s;
}

body.light-mode .list-view tbody tr {
    border-bottom: 1px solid #dadce0;
}

.list-view tbody tr:hover {
    background-color: #3c4043;
    transition: background-color 0.2s;
}

body.light-mode .list-view tbody tr:hover {
    background-color: #f8f9fa;
}

.list-view td {
    padding: 12px 16px;
    font-size: 14px;
    color: #e8eaed;
    transition: color 0.3s;
}

body.light-mode .list-view td {
    color: #202124;
}

.list-view .file-icon {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    vertical-align: middle;
}

.list-view .file-thumbnail {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    vertical-align: middle;
    overflow: hidden;
    border-radius: 2px;
    display: inline-block;
}

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

/* Breadcrumbs */
.breadcrumbs {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.breadcrumbs a {
    color: #9aa0a6;
    text-decoration: none;
    font-size: 14px;
    margin-right: 8px;
    transition: color 0.3s;
}

body.light-mode .breadcrumbs a {
    color: #5f6368;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.breadcrumbs span {
    color: #9aa0a6;
    font-size: 14px;
    margin-right: 8px;
    transition: color 0.3s;
}

body.light-mode .breadcrumbs span {
    color: #5f6368;
}

/* Action Buttons */
.action-buttons {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background-color: #1a73e8;
    color: #fff;
    transition: background-color 0.3s;
}

.btn-secondary {
    background-color: #3c4043;
    border: 1px solid #5f6368;
    color: #e8eaed;
    transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

body.light-mode .btn-secondary {
    background-color: #fff;
    border: 1px solid #dadce0;
    color: #202124;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background-color: #2d2d2d;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    padding: 24px;
    transition: background-color 0.3s;
}

body.light-mode .modal-content {
    background-color: #fff;
}

/* Preview modal specific styles */
.preview-modal-content {
    max-width: 95% !important;
    width: 90% !important;
    min-width: 800px !important;
    max-height: 95% !important;
}

body.light-mode .preview-modal-content {
    background-color: #fff;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 20px;
    font-weight: 500;
    color: #e8eaed;
    transition: color 0.3s;
}

body.light-mode .modal-title {
    color: #202124;
}

.close-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 24px;
    color: #9aa0a6;
    transition: color 0.3s;
}

body.light-mode .close-btn {
    color: #5f6368;
}

.modal-body {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #9aa0a6;
    transition: color 0.3s;
}

body.light-mode .form-group label {
    color: #5f6368;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #5f6368;
    border-radius: 4px;
    font-size: 14px;
    color: #e8eaed;
    background-color: #3c4043;
    outline: none;
    transition: border-color 0.3s, color 0.3s, background-color 0.3s;
}

body.light-mode .form-group input, body.light-mode .form-group select {
    border: 1px solid #dadce0;
    color: #202124;
    background-color: #fff;
}

.form-group input:focus, .form-group select:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* File Preview */
.file-preview {
    max-width: 100%;
    max-height: 400px;
    margin: 0 auto;
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #3c4043;
        transition: border-color 0.3s;
    }

    body.light-mode .sidebar {
        border-bottom: 1px solid #dadce0;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
    }

    header .search {
        margin: 10px 0 0 0;
        width: 100%;
    }
}

/* File Actions */
.file-card {
    position: relative;
    display: flex;
    flex-direction: column;
}

.file-content {
    flex: 1;
    cursor: pointer;
}

.file-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.file-card:hover .file-actions {
    opacity: 1;
}

.action-btn {
    background: rgba(60, 64, 67, 0.9);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

body.light-mode .action-btn {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.action-btn:hover {
    background: rgba(60, 64, 67, 1);
}

body.light-mode .action-btn:hover {
    background: rgba(255, 255, 255, 1);
}

.action-btn i {
    font-size: 16px;
    color: #e8eaed;
    transition: color 0.2s ease;
}

body.light-mode .action-btn i {
    color: #5f6368;
}

.edit-btn:hover i {
    color: #1a73e8;
}

.delete-btn:hover i {
    color: #d93025;
}

.download-btn:hover i {
    color: #34a853;
}

/* Document Editor Styles */
.document-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f8f9fa;
    border: 1px solid #dadce0;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    flex-wrap: wrap;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 4px;
    border-right: 1px solid #dadce0;
}

.toolbar-group:last-child {
    border-right: none;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    color: #5f6368;
    transition: background-color 0.2s ease;
}

.toolbar-btn:hover {
    background-color: #e8eaed;
    color: #202124;
}

.toolbar-btn:active {
    background-color: #dadce0;
}

.toolbar-btn i {
    font-size: 18px;
}

.toolbar-select {
    padding: 4px 8px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    background: white;
    font-size: 13px;
    color: #202124;
    cursor: pointer;
}

.toolbar-select:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

#documentEditor {
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #202124;
    background: white;
    border: 1px solid #dadce0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 20px;
    min-height: 400px;
    outline: none;
    overflow-y: auto;
    flex: 1;
}

#documentEditor:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

#documentEditor h1, #documentEditor h2, #documentEditor h3, #documentEditor h4, #documentEditor h5, #documentEditor h6 {
    margin: 16px 0 8px 0;
    font-weight: 500;
    color: #202124;
}

#documentEditor p {
    margin: 8px 0;
}

#documentEditor ul, #documentEditor ol {
    margin: 8px 0;
    padding-left: 24px;
}

#documentEditor li {
    margin: 4px 0;
}

#documentEditor blockquote {
    margin: 16px 0;
    padding: 12px 16px;
    border-left: 4px solid #dadce0;
    background-color: #f8f9fa;
    font-style: italic;
}

#documentEditor code {
    background-color: #f1f3f4;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

#documentEditor pre {
    background-color: #f1f3f4;
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 8px 0;
}

#documentEditor a {
    color: #1a73e8;
    text-decoration: none;
}

#documentEditor a:hover {
    text-decoration: underline;
}

.btn-danger {
    background-color: #d93025;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.btn-danger:hover {
    background-color: #b31412;
}

.btn-warning {
    background-color: #f29900;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.btn-warning:hover {
    background-color: #e68900;
}

/* Multi-select functionality */
.select-all-container {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #3c4043;
    border-radius: 4px;
    border: 1px solid #5f6368;
}

body.light-mode .select-all-container {
    background-color: #f8f9fa;
    border: 1px solid #dadce0;
}

.select-all-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #e8eaed;
}

body.light-mode .select-all-label {
    color: #202124;
}

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

.file-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
    background: rgba(60, 64, 67, 0.9);
    border-radius: 4px;
    padding: 4px;
}

body.light-mode .file-checkbox {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

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

.file-card.multi-select-mode {
    border: 2px solid #1a73e8;
}

.file-card.multi-select-mode.selected {
    border: 2px solid #34a853;
    background-color: rgba(52, 168, 83, 0.1);
}

.file-card.multi-select-mode.selected .file-thumbnail {
    opacity: 0.8;
}

.btn.active {
    background-color: #1a73e8;
    color: white;
}
