*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --primary-light: #e8f0fe;
    --danger: #d93025;
    --danger-light: #fce8e6;
    --bg: #f8f9fa;
    --surface: #ffffff;
    --border: #dadce0;
    --text: #202124;
    --text-secondary: #5f6368;
    --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
    --radius: 8px;
    --sidebar-width: 260px;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* Login */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a73e8 0%, #4285f4 50%, #34a853 100%);
}

.login-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-logo {
    margin-bottom: 8px;
}

.login-logo i {
    font-size: 48px;
    color: var(--primary);
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 500;
    margin-top: 12px;
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 14px;
}

.input-group {
    position: relative;
    margin-bottom: 16px;
}

.input-group i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.input-group input {
    width: 100%;
    padding: 12px 12px 12px 42px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.error-msg {
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 12px;
    text-align: left;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #b3261e;
}

.btn-text {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 16px;
}

.btn-text:hover {
    background: var(--bg);
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-icon {
    padding: 8px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 16px;
}

.btn-icon:hover {
    background: var(--bg);
}

/* Header */
.header {
    display: flex;
    align-items: center;
    height: 64px;
    padding: 0 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: var(--sidebar-width);
}

.logo-icon {
    font-size: 28px;
    color: var(--primary);
}

.logo-text {
    font-size: 22px;
    font-weight: 400;
    color: var(--text-secondary);
}

.header-center {
    flex: 1;
    max-width: 720px;
    margin: 0 auto;
}

.search-box {
    position: relative;
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-box input {
    width: 100%;
    padding: 10px 16px 10px 42px;
    border: none;
    border-radius: 24px;
    background: var(--bg);
    font-size: 14px;
    outline: none;
}

.search-box input:focus {
    background: var(--surface);
    box-shadow: var(--shadow);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Layout */
.main-layout {
    display: flex;
    min-height: calc(100vh - 64px);
}

.sidebar {
    width: var(--sidebar-width);
    padding: 16px;
    flex-shrink: 0;
}

.btn-new {
    width: 100%;
    justify-content: flex-start;
    margin-bottom: 8px;
    border-radius: 24px;
    padding: 12px 24px;
}

.sidebar-nav {
    margin-top: 16px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 0 24px 24px 0;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.nav-item:hover,
.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.disk-space {
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
}

.disk-space-bar {
    height: 4px;
    background: var(--bg);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 10px;
}

.disk-space-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s;
}

.disk-space-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0;
}

.disk-space-label {
    color: var(--text-secondary);
}

.disk-space-value {
    color: var(--text);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.storage-info {
    position: absolute;
    bottom: 24px;
    left: 16px;
    width: calc(var(--sidebar-width) - 32px);
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Content */
.content {
    flex: 1;
    padding: 8px 24px 24px;
    position: relative;
    min-width: 0;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    margin-bottom: 4px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 14px;
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
}

.breadcrumb a:hover {
    background: var(--bg);
    color: var(--text);
}

.breadcrumb .sep {
    color: var(--text-secondary);
    font-size: 12px;
}

/* File list */
.file-list-header {
    display: grid;
    grid-template-columns: 1fr 160px 100px 48px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    align-items: center;
}

.file-list-header .sortable {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 4px 0;
    margin: 0;
    font: inherit;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    text-align: left;
    border-radius: 4px;
}

.file-list-header .sortable:hover {
    color: var(--text);
}

.file-list-header .sortable.active {
    color: var(--primary);
}

.file-list-header .sortable .sort-icon {
    font-size: 11px;
    opacity: 0.55;
}

.file-list-header .sortable.active .sort-icon {
    opacity: 1;
}

.file-list-header .col-size.sortable {
    justify-self: start;
}

.file-list {
    min-height: 200px;
}

.file-item {
    display: grid;
    grid-template-columns: 1fr 160px 100px 48px;
    align-items: center;
    padding: 4px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}

.file-item:hover {
    background: var(--primary-light);
}

.file-item .col-name {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.file-item .col-name i {
    font-size: 20px;
    flex-shrink: 0;
}

.file-item .col-name i.fa-folder {
    color: #f9ab00;
}

.file-item .col-name i.fa-file {
    color: var(--text-secondary);
}

.file-item .col-name span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.file-item .col-modified,
.file-item .col-size {
    font-size: 13px;
    color: var(--text-secondary);
}

.file-item .col-actions {
    opacity: 0;
    transition: opacity 0.15s;
}

.file-item:hover .col-actions {
    opacity: 1;
}

.context-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 14px;
}

.context-menu-btn:hover {
    background: rgba(0,0,0,0.08);
}

/* Context menu */
.context-menu {
    position: fixed;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 1000;
    padding: 8px 0;
    border: 1px solid var(--border);
}

.context-menu button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: none;
    font-size: 14px;
    cursor: pointer;
    text-align: left;
    color: var(--text);
}

.context-menu button:hover {
    background: var(--bg);
}

.context-menu button.danger {
    color: var(--danger);
}

.context-menu button i {
    width: 16px;
    text-align: center;
}

/* Upload progress */
.upload-progress-area {
    margin-bottom: 12px;
}

.upload-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 8px;
}

.upload-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
}

.upload-item-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    margin-right: 12px;
}

.upload-item-status {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.upload-item-time {
    min-width: 3.5em;
    text-align: right;
    color: var(--text-secondary);
}

.upload-bar {
    height: 4px;
    background: var(--bg);
    border-radius: 2px;
    overflow: hidden;
}

.upload-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.3s;
    width: 0%;
}

.upload-item.done .upload-bar-fill {
    background: #34a853;
}

.upload-item.error .upload-bar-fill {
    background: var(--danger);
}

.upload-item-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: 4px;
    word-break: break-word;
}

/* Drop overlay */
.drop-overlay {
    position: absolute;
    inset: 0;
    background: rgba(26, 115, 232, 0.1);
    border: 2px dashed var(--primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    pointer-events: none;
}

.drop-message {
    text-align: center;
    color: var(--primary);
}

.drop-message i {
    font-size: 48px;
    margin-bottom: 12px;
}

.drop-message p {
    font-size: 18px;
    font-weight: 500;
}

/* Zip download overlay */
.zip-download-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
}

.zip-download-panel {
    background: var(--surface);
    border-radius: 12px;
    padding: 32px 40px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    max-width: 360px;
    width: calc(100% - 32px);
}

.zip-download-icon {
    font-size: 36px;
    color: var(--primary);
    margin-bottom: 16px;
}

.zip-download-message {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 24px;
    color: var(--text);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
}

.modal-content {
    position: relative;
    background: var(--surface);
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.modal-content h3 {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    outline: none;
    margin-bottom: 16px;
}

.modal-content input:focus {
    border-color: var(--primary);
}

.modal-content p {
    margin-bottom: 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Loading & empty */
.loading,
.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--border);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .header-left {
        min-width: auto;
    }

    .file-list-header {
        display: none;
    }

    .file-item {
        grid-template-columns: 1fr 48px;
    }

    .file-item .col-modified,
    .file-item .col-size {
        display: none;
    }

    .file-item .col-actions {
        opacity: 1;
    }
}
