* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --secondary: #64748b;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

.container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.card h1 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary);
}

form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

input[type="text"],
input[type="password"] {
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: var(--bg);
    border-color: var(--primary);
}

.link {
    text-align: center;
    margin-top: 20px;
    color: var(--text-light);
    cursor: pointer;
}

.link:hover {
    color: var(--primary);
}

header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 {
    font-size: 24px;
    color: var(--primary);
}

.header-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

.storage-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.storage-bar {
    width: 150px;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.storage-bar-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s, background 0.3s;
}

.storage-bar-fill.warning {
    background: #ff9800;
}

.storage-bar-fill.danger {
    background: var(--danger);
}

.storage-text {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

.toolbar {
    background: var(--card-bg);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.toolbar-left,
.toolbar-right {
    display: flex;
    gap: 12px;
    align-items: center;
}

#current-path {
    padding: 8px 16px;
    background: var(--bg);
    border-radius: 8px;
    font-weight: 500;
    color: var(--text-light);
}

#search-input {
    width: 250px;
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

.file-list {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.file-item:hover {
    background: var(--bg);
}

.file-item:last-child {
    border-bottom: none;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.file-icon {
    font-size: 32px;
}

.file-details {
    flex: 1;
}

.file-name {
    font-weight: 600;
    font-size: 16px;
}

.file-meta {
    color: var(--text-light);
    font-size: 14px;
    margin-top: 4px;
}

.file-actions {
    display: flex;
    gap: 8px;
}

.file-actions button {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-edit {
    background: var(--warning);
    color: white;
}

.btn-delete {
    background: var(--error);
    color: white;
}

.btn-download {
    background: var(--success);
    color: white;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--card-bg);
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
}

.modal-close:hover {
    color: var(--error);
}

.modal-body {
    padding: 24px;
}

.modal-body input,
.modal-body textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    margin-bottom: 16px;
}

.modal-body input:focus,
.modal-body textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.modal-body textarea {
    min-height: 300px;
    resize: vertical;
    font-family: 'Courier New', monospace;
}

.code-editor {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace !important;
    font-size: 14px;
    line-height: 1.5;
    tab-size: 4;
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 16px !important;
    min-height: 400px !important;
    border: 1px solid var(--border) !important;
}

.file-viewer {
    max-height: 70vh;
    overflow: auto;
    background: #f5f5f5;
    border-radius: 8px;
    padding: 4px;
}

.code-viewer {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 20px;
    margin: 0;
    border-radius: 4px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.file-info {
    cursor: pointer;
    flex: 1;
}

.image-preview {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 8px;
    max-height: 70vh;
    overflow: auto;
}

.image-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 16px;
}

.btn-success {
    background: var(--success);
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-success:hover {
    background: #059669;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

.error-message {
    background: #fee2e2;
    color: var(--error);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.success-message {
    background: #d1fae5;
    color: var(--success);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-left,
    .toolbar-right {
        width: 100%;
    }

    #search-input {
        width: 100%;
    }

    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .file-actions {
        width: 100%;
        justify-content: flex-end;
    }
}
