/* --- Global & Reset --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f4f5;
    margin: 0;
    display: flex;
    justify-content: center;
    color: #333;
}

.hidden { display: none !important; }
.error { color: #d32f2f; margin-top: 10px; font-size: 0.9em; text-align: center; }

/* --- Login View --- */
#login-view {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.card {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 350px;
    text-align: center;
}

.card h2 { margin-top: 0; margin-bottom: 1.5rem; color: #111; }

input {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 16px;
    transition: border-color 0.2s;
}

input:focus { border-color: #0070f3; outline: none; }

/* --- Buttons --- */
button {
    background-color: #0070f3;
    color: white;
    border: none;
    padding: 12px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    width: 100%;
    font-size: 16px;
    transition: background-color 0.2s;
}

button:hover { background-color: #005bb5; }
button:disabled { background-color: #a0c9f0; cursor: wait; }

button.secondary {
    background-color: #f3f4f6;
    color: #374151;
}
button.secondary:hover { background-color: #e5e7eb; }

/* --- App Layout --- */
#app-view {
    width: 100%;
    max-width: 900px;
    padding: 40px 20px;
}

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

header h1 { margin: 0; font-size: 1.5rem; color: #111; }
header button { width: auto; background-color: #4b5563; font-size: 14px; padding: 8px 16px; }
header button:hover { background-color: #374151; }

/* --- Toolbar & Breadcrumbs --- */
.toolbar {
    background: white;
    padding: 12px 20px;
    border-radius: 8px 8px 0 0;
    display: flex;
    gap: 12px;
    align-items: center;
    border-bottom: 1px solid #f3f4f6;
}

.breadcrumbs {
    flex-grow: 1;
    font-weight: 500;
    color: #6b7280;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.breadcrumb-item { cursor: pointer; color: #0070f3; }
.breadcrumb-item:hover { text-decoration: underline; }
.current-path { color: #111; font-weight: 600; }

#new-folder-btn { width: auto; background-color: #10b981; font-size: 13px; padding: 8px 12px; }
#new-folder-btn:hover { background-color: #059669; }

#file-input { display: none; }

.upload-label {
    background-color: #0070f3;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    display: inline-block;
    transition: background-color 0.2s;
}
.upload-label:hover { background-color: #005bb5; }

/* --- File Table --- */
.file-list-container {
    background: white;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

table { width: 100%; border-collapse: collapse; }

th, td {
    padding: 12px 20px;
    text-align: left;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #4b5563;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Icons & Previews */
.thumbnail-img {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    background: #f3f4f6;
}

/* File/Folder Names */
.file-name { font-weight: 500; color: #111; cursor: pointer; font-size: 14px; }
.file-name:hover { color: #0070f3; }

.folder-name { color: #0070f3; font-weight: 700; cursor: pointer; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.folder-name:hover { text-decoration: underline; }

.size-col { color: #6b7280; font-size: 13px; font-variant-numeric: tabular-nums; }

/* Actions */
.actions { display: flex; gap: 12px; align-items: center; }

.action-btn {
    text-decoration: none;
    color: #4b5563;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.1s;
}
.action-btn:hover { background-color: #f3f4f6; color: #111; }

.delete-btn { color: #ef4444; }
.delete-btn:hover { background-color: #fef2f2; color: #dc2626; }

/* --- Editor Modal --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal {
    background: white;
    width: 90%; height: 85%;
    max-width: 800px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    padding: 24px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-weight: 600;
    font-size: 1.1rem;
    color: #111;
}

#editor-textarea {
    flex-grow: 1;
    width: 100%;
    resize: none;
    border: 1px solid #e5e7eb;
    padding: 16px;
    font-family: "Menlo", "Consolas", monospace;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 16px;
    border-radius: 8px;
    outline: none;
}
#editor-textarea:focus { border-color: #0070f3; }

.modal-footer { display: flex; justify-content: flex-end; gap: 12px; }
.modal-footer button { width: auto; padding: 10px 20px; }