/* ═══ CloudVault — Apple iCloud Dark Mode Design ═══ */

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* Apple Dark Mode Palette */
    --bg-primary: #000000;
    --bg-elevated: #1c1c1e;
    --bg-secondary: #2c2c2e;
    --bg-tertiary: #3a3a3c;
    --bg-quaternary: #48484a;

    --separator: rgba(84,84,88,0.65);
    --separator-light: rgba(84,84,88,0.35);

    --label-primary: #ffffff;
    --label-secondary: #ebebf599;
    --label-tertiary: #ebebf54d;
    --label-quaternary: #ebebf52e;

    --blue: #0a84ff;
    --green: #30d158;
    --red: #ff453a;
    --orange: #ff9f0a;
    --yellow: #ffd60a;
    --purple: #bf5af2;
    --pink: #ff375f;
    --teal: #64d2ff;
    --indigo: #5e5ce6;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
    --r: 12px;
    --r-lg: 16px;
    --tr: 0.18s ease;
}

/* Base */
html { font-size: 15px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { font-family: var(--font); background: var(--bg-primary); color: var(--label-primary); line-height: 1.5; min-height: 100vh; }
::selection { background: rgba(10,132,255,0.3); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 3px; }

/* ═══ Layout ═══ */
.app { max-width: 1200px; margin: 0 auto; padding: 0 24px 40px; }

/* ═══ Login ═══ */
.login-screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; background: var(--bg-primary); }
.login-card { width: 100%; max-width: 380px; text-align: center; }
.login-icon { font-size: 3rem; color: var(--blue); margin-bottom: 20px; }
.login-card h1 { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 4px; }
.login-card p { color: var(--label-secondary); font-size: 0.9rem; margin-bottom: 32px; }
.login-error { background: rgba(255,69,58,0.12); border: 1px solid rgba(255,69,58,0.3); color: var(--red); padding: 10px 14px; border-radius: 10px; font-size: 0.82rem; margin-bottom: 16px; display: none; text-align: left; }
.login-error.show { display: block; animation: shake 0.35s ease; }
.login-card .form-group { text-align: left; }
.login-btn { width: 100%; justify-content: center; padding: 12px; font-size: 0.9rem; margin-top: 8px; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }

/* ═══ Header ═══ */
.header { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--separator-light); margin-bottom: 0; position: sticky; top: 0; background: rgba(0,0,0,0.85); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); z-index: 100; }
.header-brand { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; font-weight: 700; letter-spacing: -0.3px; color: var(--label-primary); flex-shrink: 0; }
.header-brand i { color: var(--blue); font-size: 1.3rem; }
.header-search { flex: 1; max-width: 320px; position: relative; margin: 0 auto; }
.header-search input { width: 100%; padding: 8px 14px 8px 34px; background: var(--bg-secondary); border: 1px solid transparent; border-radius: 10px; color: var(--label-primary); font-family: var(--font); font-size: 0.85rem; outline: none; transition: all var(--tr); }
.header-search input:focus { border-color: var(--blue); background: var(--bg-elevated); }
.header-search input::placeholder { color: var(--label-tertiary); }
.header-search > i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--label-tertiary); font-size: 0.78rem; pointer-events: none; }
.header-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

/* ═══ Buttons ═══ */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: none; border-radius: 8px; background: var(--bg-secondary); color: var(--label-primary); font-family: var(--font); font-size: 0.82rem; font-weight: 500; cursor: pointer; transition: all var(--tr); white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--bg-tertiary); }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #0977e6; }
.btn-danger { background: rgba(255,69,58,0.15); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-icon { width: 36px; height: 36px; padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 8px; }

/* ═══ Breadcrumb ═══ */
.breadcrumb { display: flex; align-items: center; gap: 6px; padding: 14px 0; font-size: 0.85rem; overflow-x: auto; border-bottom: 1px solid var(--separator-light); }
.breadcrumb a { color: var(--blue); text-decoration: none; cursor: pointer; padding: 2px 4px; border-radius: 4px; transition: background var(--tr); }
.breadcrumb a:hover { background: rgba(10,132,255,0.1); }
.breadcrumb .sep { color: var(--label-quaternary); font-size: 0.7rem; }
.breadcrumb .current { color: var(--label-primary); font-weight: 600; }

/* ═══ Stats Bar ═══ */
.stats-bar { display: flex; align-items: center; gap: 16px; padding: 12px 0; font-size: 0.82rem; color: var(--label-secondary); border-bottom: 1px solid var(--separator-light); }
.stats-bar .stat-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--label-quaternary); }

/* ═══ File List ═══ */
.file-list-header { display: grid; grid-template-columns: 1fr 160px 100px 80px; gap: 12px; padding: 10px 16px; font-size: 0.75rem; font-weight: 500; color: var(--label-tertiary); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--separator-light); }
.file-list-body { }
.file-row { display: grid; grid-template-columns: 1fr 160px 100px 80px; gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--separator-light); cursor: pointer; transition: background var(--tr); position: relative; }
.file-row:hover { background: var(--bg-elevated); }
.file-row:last-child { border-bottom: none; }

/* Row cells */
.file-row .col-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.file-row .item-icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 8px; font-size: 1.1rem; flex-shrink: 0; background: var(--bg-secondary); }
.file-row .item-thumb { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.file-row .item-name { font-size: 0.88rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .col-date { font-size: 0.82rem; color: var(--label-secondary); white-space: nowrap; }
.file-row .col-size { font-size: 0.82rem; color: var(--label-secondary); white-space: nowrap; }
.file-row .col-actions { display: flex; gap: 2px; justify-content: flex-end; opacity: 0; transition: opacity var(--tr); }
.file-row:hover .col-actions { opacity: 1; }
.file-row .col-actions button { width: 30px; height: 30px; border: none; background: transparent; color: var(--label-secondary); border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 0.72rem; transition: all var(--tr); }
.file-row .col-actions button:hover { background: var(--bg-tertiary); color: var(--label-primary); }
.file-row .col-actions button.act-delete:hover { color: var(--red); }

/* Icon colors */
.ic-folder { color: var(--blue); }
.ic-image { color: var(--pink); }
.ic-video { color: var(--orange); }
.ic-audio { color: var(--purple); }
.ic-code { color: var(--teal); }
.ic-doc { color: var(--indigo); }
.ic-archive { color: var(--yellow); }
.ic-pdf { color: var(--red); }
.ic-file { color: var(--label-secondary); }

/* ═══ Empty State ═══ */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 80px 20px; }
.empty-state i { font-size: 3rem; color: var(--label-quaternary); margin-bottom: 16px; }
.empty-state h3 { font-size: 1.1rem; color: var(--label-secondary); font-weight: 600; margin-bottom: 4px; }
.empty-state p { font-size: 0.85rem; color: var(--label-tertiary); }

/* ═══ Modal ═══ */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; visibility: hidden; transition: all 0.2s ease; }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal { background: var(--bg-elevated); border: 1px solid var(--separator); border-radius: var(--r-lg); width: 100%; max-width: 440px; overflow: hidden; transform: scale(0.95); transition: transform 0.25s cubic-bezier(0.32,0.72,0,1); }
.modal-overlay.active .modal { transform: scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--separator-light); }
.modal-header h2 { font-size: 1rem; font-weight: 600; }
.modal-close { width: 28px; height: 28px; border: none; background: var(--bg-tertiary); color: var(--label-secondary); cursor: pointer; font-size: 1rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all var(--tr); line-height: 1; }
.modal-close:hover { background: var(--bg-quaternary); color: var(--label-primary); }
.modal-body { padding: 20px 22px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--separator-light); }
.delete-message { font-size: 0.88rem; margin-bottom: 6px; }
.delete-warning { font-size: 0.78rem; color: var(--label-tertiary); }
.move-label { font-size: 0.88rem; margin-bottom: 12px; }

/* ═══ Forms ═══ */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.78rem; font-weight: 500; color: var(--label-secondary); margin-bottom: 6px; }
.form-input { width: 100%; padding: 10px 14px; background: var(--bg-secondary); border: 1px solid transparent; border-radius: 10px; color: var(--label-primary); font-family: var(--font); font-size: 0.88rem; outline: none; transition: all var(--tr); }
.form-input:focus { border-color: var(--blue); background: var(--bg-elevated); }
.form-input::placeholder { color: var(--label-tertiary); }

/* ═══ Upload Zone ═══ */
.upload-zone { border: 2px dashed var(--separator); border-radius: var(--r); padding: 40px 20px; text-align: center; cursor: pointer; transition: all var(--tr); }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--blue); background: rgba(10,132,255,0.06); }
.upload-zone i { font-size: 2rem; color: var(--blue); margin-bottom: 12px; display: block; }
.upload-zone h3 { font-size: 0.92rem; font-weight: 500; margin-bottom: 4px; }
.upload-zone p { font-size: 0.78rem; color: var(--label-tertiary); }
.upload-zone input[type="file"] { display: none; }
.upload-status { margin-top: 8px; font-size: 0.8rem; color: var(--label-secondary); }

/* ═══ Progress ═══ */
.progress-container { width: 100%; height: 4px; background: var(--bg-secondary); border-radius: 2px; margin-top: 12px; overflow: hidden; display: none; }
.progress-container.active { display: block; }
.progress-bar { height: 100%; background: var(--blue); border-radius: 2px; width: 0%; transition: width 0.3s ease; }

/* ═══ Toast ═══ */
.toast-container { position: fixed; top: 16px; right: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 18px; background: var(--bg-elevated); border: 1px solid var(--separator); border-radius: var(--r); font-size: 0.82rem; min-width: 260px; animation: toastSlide 0.3s cubic-bezier(0.32,0.72,0,1); backdrop-filter: blur(20px); }
.toast.success i { color: var(--green); }
.toast.error i { color: var(--red); }
.toast.info i { color: var(--blue); }
@keyframes toastSlide { from { transform: translateY(-12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ═══ Context Menu ═══ */
.context-menu { position: fixed; background: var(--bg-elevated); border: 1px solid var(--separator); border-radius: var(--r); padding: 4px; min-width: 180px; box-shadow: 0 8px 32px rgba(0,0,0,0.5); z-index: 1500; display: none; }
.context-menu.active { display: block; }
.ctx-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; font-size: 0.82rem; color: var(--label-primary); border-radius: 8px; cursor: pointer; transition: background var(--tr); }
.ctx-item:hover { background: var(--bg-tertiary); }
.ctx-item i { width: 16px; text-align: center; color: var(--label-secondary); font-size: 0.78rem; }
.ctx-item.danger { color: var(--red); }
.ctx-item.danger i { color: var(--red); }
.ctx-divider { height: 1px; background: var(--separator-light); margin: 3px 8px; }

/* ═══ Lightbox ═══ */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.92); backdrop-filter: blur(20px); z-index: 3000; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: all 0.25s ease; cursor: zoom-out; }
.lightbox.active { opacity: 1; visibility: visible; }
.lightbox img { max-width: 90vw; max-height: 85vh; border-radius: var(--r); object-fit: contain; }
.lightbox-close { position: absolute; top: 16px; right: 20px; width: 36px; height: 36px; border: none; background: rgba(255,255,255,0.1); color: #fff; border-radius: 50%; cursor: pointer; font-size: 1.1rem; display: flex; align-items: center; justify-content: center; transition: all var(--tr); }
.lightbox-close:hover { background: rgba(255,255,255,0.2); }
.lightbox-info { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); color: rgba(255,255,255,0.7); font-size: 0.82rem; background: rgba(0,0,0,0.5); padding: 6px 16px; border-radius: 20px; }

/* ═══ Spinner ═══ */
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--separator); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══ Folder Tree (Move Modal) ═══ */
.folder-tree { max-height: 240px; overflow-y: auto; background: var(--bg-secondary); border-radius: 10px; padding: 6px; }
.folder-tree-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 0.85rem; transition: background var(--tr); }
.folder-tree-item:hover { background: var(--bg-tertiary); }
.folder-tree-item.selected { background: rgba(10,132,255,0.15); color: var(--blue); }
.folder-tree-item i { color: var(--blue); font-size: 0.9rem; }

/* ═══ Responsive ═══ */
@media (max-width: 768px) {
    .app { padding: 0 14px 30px; }
    .header { gap: 10px; padding: 12px 0; flex-wrap: wrap; }
    .header-search { max-width: 100%; order: 3; flex-basis: 100%; }
    .header-actions { margin-left: auto; }
    .header-actions .btn:not(.btn-icon):not(.btn-primary) { display: none; }
    .file-list-header { grid-template-columns: 1fr 80px 40px; }
    .file-list-header .col-date-head { display: none; }
    .file-row { grid-template-columns: 1fr 80px 40px; }
    .file-row .col-date { display: none; }
    .modal { max-width: calc(100vw - 32px); }
}
@media (max-width: 480px) {
    .header-brand span { display: none; }
    .file-row .col-size { display: none; }
    .file-list-header { grid-template-columns: 1fr 40px; }
    .file-list-header .col-size-head { display: none; }
    .file-row { grid-template-columns: 1fr 40px; }
}
