/* RTL Support and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    direction: rtl;
    overflow-x: hidden;
}

/* Login Page Styles */
.login-page {
    display: flex;
    justify-content: center;
    align-items: 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: 16px;
    padding: 40px 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
}

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

.login-header .material-icons {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 10px;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 500;
    color: #333;
}

.login-form {
    text-align: right;
}

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

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

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

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

.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
}

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

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

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

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

.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 12px;
    border-radius: 8px;
    margin-top: 20px;
    text-align: center;
}

/* App Header */
.app-header {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.menu-btn {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    margin-left: 16px;
    transition: background 0.3s ease;
}

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

.app-title {
    font-size: 20px;
    font-weight: 500;
    flex: 1;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s ease;
}

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

.breadcrumb {
    padding: 8px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    font-size: 14px;
    overflow-x: auto;
    white-space: nowrap;
}

.breadcrumb-item {
    color: #667eea;
    cursor: pointer;
    transition: color 0.3s ease;
}

.breadcrumb-item:hover {
    color: #5a6fd8;
}

.breadcrumb-item.active {
    color: #333;
    cursor: default;
}

.breadcrumb-item:not(:last-child)::after {
    content: ' / ';
    color: #999;
    margin: 0 8px;
}

/* Side Menu */
.side-menu {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1600;
    transition: right 0.3s ease;
    padding-top: 80px;
}

.side-menu.open {
    right: 0;
}

.menu-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

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

.menu-items {
    padding: 20px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 16px 20px;
    background: none;
    border: none;
    text-align: right;
    cursor: pointer;
    transition: background 0.3s ease;
}

.menu-item:hover {
    background: #f5f5f5;
}

.menu-item .material-icons {
    margin-left: 16px;
    color: #666;
}

.menu-item span {
    font-size: 16px;
    color: #333;
}

/* Main Content */
.main-content {
    margin-top: 120px;
    padding: 20px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.content-container {
    min-height: 60vh;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state .material-icons {
    font-size: 80px;
    margin-bottom: 20px;
    color: #ddd;
}

.empty-state h3 {
    font-size: 24px;
    margin-bottom: 10px;
}

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

/* Files Grid */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    padding: 20px 0;
}

.file-item {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

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

.file-icon {
    width: 100%;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    border-radius: 8px;
    background: #f8f9fa;
    position: relative;
}

.file-icon .material-icons {
    font-size: 48px;
    color: #667eea;
}

.file-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

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

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

.file-actions {
    position: absolute;
    top: 8px;
    left: 8px;
}

.file-actions .action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.file-actions .action-btn .material-icons {
    font-size: 20px;
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    border: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 999;
    transition: all 0.3s ease;
}

.fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.fab .material-icons {
    font-size: 24px;
}

/* Modal Styles */
.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: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    transform: scale(0.7);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

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

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

.close-btn {
    background: none;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s ease;
}

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

.modal-body {
    padding: 20px;
}

.modal-body input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 20px;
    transition: border-color 0.3s ease;
}

.modal-body input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Upload Modal */
.upload-area {
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

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

.upload-area .material-icons {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 16px;
}

.upload-area p {
    font-size: 16px;
    color: #666;
    margin-bottom: 16px;
}

.upload-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-progress {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}

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

/* Context Menu */
.context-menu {
    position: fixed;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 3000;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.9);
    transition: all 0.2s ease;
}

.context-menu.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.context-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.context-item:hover {
    background: #f5f5f5;
}

.context-item .material-icons {
    margin-left: 12px;
    font-size: 20px;
    color: #666;
}

.context-item span {
    font-size: 14px;
    color: #333;
}

/* Media Modal */
.media-modal .modal-content {
    max-width: 80vw;
    max-height: 80vh;
}

#noteEditorModal .modal-content {
    width: 80%;
    max-width: 800px;
}

.media-container {
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 60vh;
}

.media-container img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
}

.media-container video {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
}

.media-container audio {
    width: 100%;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1550;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        margin-top: 100px;
        padding: 16px;
    }
    
    .files-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    
    .file-item {
        padding: 12px;
    }
    
    .file-icon {
        height: 80px;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .side-menu {
        width: 280px;
    }
}

@media (max-width: 480px) {
    .files-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }
    
    .file-item {
        padding: 8px;
    }
    
    .file-icon {
        height: 60px;
    }
    
    .file-name {
        font-size: 12px;
    }
    
    .file-info {
        font-size: 10px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-item {
    animation: fadeIn 0.3s ease;
}

/* Trash styles */
.trash-view .file-item {
    opacity: 0.7;
}

.trash-view .file-item:hover {
    opacity: 1;
}

/* Share link styles */
.share-link {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    margin-top: 16px;
    word-break: break-all;
}

.share-link input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.share-options {
    margin-top: 16px;
}

.share-options label {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    cursor: pointer;
}

.share-options input[type="checkbox"] {
    margin-left: 8px;
}

.share-options input[type="number"] {
    width: 80px;
    margin-right: 8px;
    padding: 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Move Modal */
#moveFolderList {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #eee;
    margin-bottom: 20px;
}

.move-folder-item {
    display: flex;
    align-items: center;
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.move-folder-item:hover {
    background-color: #f5f5f5;
}

.move-folder-item.selected {
    background-color: #e0f7ff;
}

.move-folder-item i {
    margin-left: 10px;
}

#moveFolderList {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 20px;
}

/* List View */
.files-grid.list-view {
    grid-template-columns: 1fr;
}

.files-grid.list-view .file-item {
    display: flex;
    align-items: center;
    padding: 12px;
}

.files-grid.list-view .file-icon {
    width: 40px;
    height: 40px;
    margin-left: 16px;
}

.files-grid.list-view .file-name {
    flex: 1;
}

.files-grid.list-view .file-info {
    width: 100px;
    text-align: left;
}
