/* style.css */
:root {
    --bg: #f5f5f7;
    --panel: #ffffff;
    --text: #1d1d1f;
    --text-muted: #86868b;
    --primary: #0071e3;
    --primary-hover: #005cbf;
    --danger: #ff3b30;
    --warning: #ff9500;
    --success: #34c759;
    --border: #d2d2d7;
    --radius: 12px;
    --shadow: 0 4px 14px rgba(0,0,0,0.05);
}

body.dark-mode {
    --bg: #121212;
    --panel: #1e1e1e;
    --text: #e0e0e0;
    --text-muted: #888888;
    --border: #333333;
    --shadow: 0 4px 14px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
body { background: var(--bg); color: var(--text); padding-top: 60px; transition: background 0.3s, color 0.3s; }
a { text-decoration: none; color: var(--primary); }

/* Header */
.main-header { position: fixed; top: 0; left: 0; right: 0; height: 60px; background: var(--panel); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 30px; z-index: 100; box-shadow: var(--shadow); transition: background 0.3s, border-color 0.3s; }
.header-logo { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 8px; color: var(--text); }
.header-right { display: flex; align-items: center; gap: 20px; }
.header-profile { display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--text); }
.avatar-small { width: 32px; height: 32px; background: var(--primary); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: bold; }
.logout-btn { color: var(--danger); font-weight: 500; }
.theme-toggle { background: none; border: none; color: var(--text); cursor: pointer; display: flex; align-items: center; }

/* Auth & Profile Containers */
.auth-container, .profile-container { max-width: 400px; margin: 60px auto; background: var(--panel); padding: 30px; border-radius: var(--radius); box-shadow: var(--shadow); }
.profile-container { max-width: 600px; }
.auth-container h2, .profile-container h2 { margin-bottom: 20px; text-align: center; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-size: 14px; font-weight: 500; }
.form-group input { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--text); }
.btn { display: inline-block; padding: 10px 20px; border-radius: 6px; border: none; cursor: pointer; font-weight: 600; text-align: center; width: 100%; transition: 0.2s; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: white; }

/* Profile specific */
.credit-box { background: rgba(0, 113, 227, 0.1); border: 1px solid var(--primary); padding: 15px; border-radius: var(--radius); text-align: center; margin-bottom: 20px; }
.credit-box h3 { color: var(--primary); margin-bottom: 5px; }
.credit-box p { font-size: 14px; color: var(--text-muted); margin-bottom: 10px; }

/* Dashboard */
.dashboard { padding: 30px; max-width: 1200px; margin: 0 auto; }
.storage-box { background: var(--panel); padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; transition: background 0.3s, border-color 0.3s; }
.storage-title { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 14px; font-weight: 600; }
.storage-bar-bg { background: var(--border); height: 8px; border-radius: 4px; overflow: hidden; }
.storage-bar-fill { background: var(--primary); height: 100%; transition: width 0.4s ease; min-width: 4px; }

/* Actions */
.action-bar, .search-sort-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 15px; }
.btn-action { padding: 8px 16px; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; color: var(--text); font-weight: 500; transition: 0.2s; }
.btn-action:hover { background: var(--border); }
.search-wrapper { position: relative; display: flex; align-items: center; }
.search-input { padding: 8px 30px 8px 12px; border: 1px solid var(--border); border-radius: 20px; width: 250px; background: var(--panel); color: var(--text); }
.btn-sort { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 14px; }

/* Drop Zone */
.drop-zone { min-height: 350px; border-radius: var(--radius); }

/* Files Grid */
.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 20px; }
.files-grid.list-view { display: flex; flex-direction: column; gap: 10px; }
.file-item { background: var(--panel); padding: 15px; border-radius: var(--radius); border: 1px solid var(--border); text-align: center; cursor: pointer; position: relative; transition: all 0.2s; user-select: none; }
.file-item:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--primary); }
.file-item.item-selected { border-color: var(--primary); background: rgba(0, 113, 227, 0.05); }
.files-grid.list-view .file-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 15px; text-align: left; }
.files-grid.list-view .file-main-info { display: flex; align-items: center; gap: 15px; flex: 1; }
.file-icon svg { width: 50px; height: 50px; margin-bottom: 10px; }
.files-grid.list-view .file-icon svg { width: 30px; height: 30px; margin-bottom: 0; }
.file-name { font-size: 14px; font-weight: 500; word-break: break-all; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-details { font-size: 12px; color: var(--text-muted); margin-top: 5px; }

/* Context Menu */
.context-menu { position: absolute; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.15); padding: 5px 0; min-width: 160px; z-index: 1000; display: none; }
.context-menu-item { padding: 8px 15px; font-size: 14px; cursor: pointer; color: var(--text); }
.context-menu-item:hover { background: var(--primary); color: white; }
.context-menu-item.delete:hover { background: var(--danger); }
.color-picker-wrapper { display: flex; gap: 8px; padding: 10px 15px; border-top: 1px solid var(--border); }
.color-dot { width: 20px; height: 20px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.color-dot:hover { transform: scale(1.2); }

/* Modals */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 2000; display: none; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.modal.active { display: flex; }
.modal-content { background: var(--panel); padding: 30px; border-radius: var(--radius); width: 90%; max-width: 600px; max-height: 90vh; overflow-y: auto; position: relative; box-shadow: 0 20px 40px rgba(0,0,0,0.2); border: 1px solid var(--border); }
.modal-close { position: absolute; top: 15px; right: 15px; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); }
.editor-textarea { width: 100%; height: 400px; padding: 15px; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 15px; font-family: monospace; font-size: 14px; resize: vertical; background: var(--bg); color: var(--text); }
.zip-list { list-style: none; padding: 0; }
.zip-list li { padding: 8px; border-bottom: 1px solid var(--border); font-size: 14px; display: flex; justify-content: space-between; }

/* Mass actions */
.mass-action-panel { background: var(--primary); color: white; padding: 10px 20px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; display: none; }
.mass-btn { background: white; color: var(--primary); border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-weight: bold; margin-left: 10px; }
.mass-delete-btn { color: var(--danger); }

/* Drag & Drop */
#drag-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 113, 227, 0.8); color: white; z-index: 9999; display: none; align-items: center; justify-content: center; font-size: 32px; font-weight: bold; }

/* Toasts */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { background: var(--text); color: var(--panel); padding: 12px 20px; border-radius: 8px; font-size: 14px; font-weight: 500; box-shadow: 0 4px 12px rgba(0,0,0,0.15); animation: toastFade 0.3s ease-out; }
.toast.error { border-left: 4px solid var(--danger); }
.toast.success { border-left: 4px solid var(--success); }
@keyframes toastFade { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }