/* === DocVault CSS === */
:root {
  --bg: #0f0f13;
  --bg-card: #1a1a24;
  --bg-hover: #22223a;
  --bg-input: #16161f;
  --border: #2a2a3d;
  --text: #e4e4ef;
  --text-muted: #8888a4;
  --accent: #e94560;
  --accent-hover: #ff5a75;
  --blue: #0f3460;
  --blue-light: #3a86ff;
  --green: #2ecc71;
  --orange: #f39c12;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --transition: 0.2s ease;
  --font: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* Login page */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f0f13 0%, #1a1a2e 50%, #16213e 100%);
}

.login-card {
  text-align: center;
  padding: 48px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.login-logo { margin-bottom: 16px; }

.login-card h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 32px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.login-form input {
  padding: 12px 16px;
  background: var(--bg-input, #1f1f2e);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}

.login-form input:focus {
  border-color: var(--accent, #e94560);
}

.login-btn {
  padding: 12px 28px;
  background: var(--accent, #e94560);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 4px;
}

.login-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.login-error {
  background: rgba(233, 69, 96, 0.15);
  color: #e94560;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 8px;
}

.login-success {
  background: rgba(46, 213, 115, 0.15);
  color: #2ed573;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 8px;
}

.login-link {
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.login-link a {
  color: var(--accent, #e94560);
  text-decoration: none;
}

.login-link a:hover {
  text-decoration: underline;
}

/* Layout */
.app-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: 56px 1fr;
  min-height: 100vh;
}

/* Top bar */
.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  width: 320px;
}

.topbar-search input {
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  width: 100%;
  outline: none;
}

.topbar-search input::placeholder { color: var(--text-muted); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.user-name {
  font-size: 13px;
  color: var(--text-muted);
}

/* Sidebar */
.sidebar {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 16px 0;
  overflow-y: auto;
}

.sidebar-section {
  padding: 0 12px;
  margin-bottom: 8px;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 8px 12px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: var(--transition);
}

.sidebar-item:hover { background: var(--bg-hover); }

.sidebar-item.active {
  background: var(--accent);
  color: white;
}

.sidebar-item .icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  opacity: 0.7;
}

.sidebar-item .badge {
  margin-left: auto;
  font-size: 11px;
  background: var(--border);
  padding: 1px 6px;
  border-radius: 10px;
  color: var(--text-muted);
}

/* Folder tree indent */
.folder-level-1 { padding-left: 24px; }
.folder-level-2 { padding-left: 44px; }
.folder-level-3 { padding-left: 64px; }

/* Main content */
.main-content {
  padding: 24px;
  overflow-y: auto;
}

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb a:hover { color: var(--text); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--border); }

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-icon {
  padding: 6px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  color: var(--text);
  background: var(--bg-hover);
}

/* Document list */
.doc-table {
  width: 100%;
  border-collapse: collapse;
}

.doc-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.doc-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.doc-table tr:hover td { background: var(--bg-hover); }

.doc-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.doc-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.doc-icon.pdf { background: #e9456020; color: var(--accent); }
.doc-icon.doc { background: #3a86ff20; color: var(--blue-light); }
.doc-icon.img { background: #2ecc7120; color: var(--green); }
.doc-icon.other { background: #f39c1220; color: var(--orange); }

.doc-size { color: var(--text-muted); font-size: 12px; }
.doc-date { color: var(--text-muted); font-size: 12px; }

.version-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 6px;
  background: var(--blue);
  color: var(--blue-light);
  border-radius: 4px;
  font-weight: 600;
}

/* Project cards */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
}

.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.project-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.project-card p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.project-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 480px;
  box-shadow: var(--shadow);
}

.modal h3 {
  font-size: 18px;
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(233, 69, 96, 0.05);
}

.upload-zone .icon {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.5;
}

.upload-zone p {
  font-size: 13px;
  color: var(--text-muted);
}

/* Members list */
.member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.member-row:last-child { border-bottom: none; }

.member-info {
  flex: 1;
}

.member-info .name { font-weight: 500; font-size: 14px; }
.member-info .email { font-size: 12px; color: var(--text-muted); }

.role-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.role-badge.admin { background: var(--accent); color: white; }
.role-badge.editor { background: var(--blue); color: var(--blue-light); }
.role-badge.viewer { background: var(--border); color: var(--text-muted); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.3;
}

.empty-state h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text);
}

.empty-state p {
  font-size: 14px;
  margin-bottom: 20px;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow);
  transform: translateY(100px);
  opacity: 0;
  transition: 0.3s ease;
  z-index: 200;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--accent); }

/* Responsive */
@media (max-width: 768px) {
  .app-layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  .topbar-search { width: 200px; }
}

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

/* Client cards */
.client-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
}

.client-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.client-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.client-avatar {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.client-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 2px; }
.client-card p { font-size: 13px; color: var(--text-muted); margin: 0; }

.client-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Color picker */
.color-picker {
  display: flex;
  gap: 8px;
}

.color-option {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
}

.color-option:hover { transform: scale(1.15); }
.color-option.selected { border-color: white; box-shadow: 0 0 0 2px var(--bg); }

/* === Mobile improvements === */
@media (max-width: 768px) {
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 56px auto 1fr;
  }

  .sidebar {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    background: var(--bg-card);
    border-right: none;
    overflow-y: auto;
  }

  .sidebar.mobile-open {
    display: block;
  }

  .topbar {
    padding: 0 12px;
  }

  .topbar-search {
    width: 140px;
  }

  .topbar-search input::placeholder {
    font-size: 11px;
  }

  .hamburger {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: none;
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
    flex-shrink: 0;
  }

  .user-name {
    display: none;
  }

  .main-content {
    padding: 16px 12px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page-header h2 {
    font-size: 18px;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .doc-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .doc-table th,
  .doc-table td {
    white-space: nowrap;
    padding: 8px;
    font-size: 12px;
  }

  .doc-name span {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
  }

  .breadcrumb {
    font-size: 11px;
    flex-wrap: wrap;
  }

  .modal {
    width: 95%;
    padding: 16px;
    max-height: 90vh;
    overflow-y: auto;
  }

  .client-card-header {
    gap: 10px;
  }

  .client-avatar {
    width: 36px;
    height: 36px;
    font-size: 12px;
  }

  .upload-zone {
    padding: 20px;
  }

  .btn {
    padding: 8px 12px;
    font-size: 12px;
  }
}

/* Hamburger hidden on desktop */
.hamburger {
  display: none;
}
