:root {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #ef4444;
  --radius-sm: 6px;
  --radius-md: 10px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  display: flex;
  height: 100vh;
  overflow: hidden;
}

#app { display: flex; width: 100vw; height: 100vh; }

#sidebar {
  width: 250px;
  background-color: var(--bg-card);
  border-right: 1px solid var(--border-color);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

#main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-main);
}

#sidebar h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 1.25rem; color: var(--primary); }

#sidebar button {
  width: 100%;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

#btn-upload { background-color: var(--primary); color: #ffffff; border: none; margin-bottom: 0.5rem; }
#btn-upload:hover { background-color: var(--primary-hover); }

#btn-new-folder { background-color: transparent; color: var(--text-main); border: 1px solid var(--border-color); margin-bottom: 1.5rem; }
#btn-new-folder:hover { background-color: #f1f5f9; }

#nav-my-drive, #nav-trash {
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  font-weight: 500;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#dashboard-widget {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.storage-meter {
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  margin: 0.5rem 0;
  overflow: hidden;
}

.storage-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.3s ease;
}

#btn-logout { margin-top: 1rem; background-color: #fee2e2; color: var(--danger); border: none; }
#btn-logout:hover { background-color: #fca5a5; }

header {
  padding: 1rem 1.5rem;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.search-bar {
  flex: 1;
  padding: 0.6rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  font-size: 0.9rem;
  background-color: var(--bg-main);
}

.view-container { padding: 1.5rem; flex: 1; overflow-y: auto; }

/* Grid view card styling */
.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1.25rem;
}

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  position: relative;
  user-select: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.card-preview {
  height: 110px;
  background-color: #f1f5f9;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.card-preview img { width: 100%; height: 100%; object-fit: cover; }

.public-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(37, 99, 235, 0.9);
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  z-index: 2;
}

/* Custom Right-Click Context Menu */
.context-menu {
  position: fixed;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  width: 170px;
  z-index: 2000;
  padding: 4px 0;
  display: none;
}

.context-menu-item {
  padding: 8px 14px;
  font-size: 0.85rem;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s ease;
}

.context-menu-item:hover {
  background-color: #f1f5f9;
}

.context-menu-item.danger {
  color: var(--danger);
}

.context-menu-item.danger:hover {
  background-color: #fee2e2;
}

.modal {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: flex; justify-content: center; align-items: center;
  z-index: 999;
}

.upload-progress-card {
  position: fixed; bottom: 20px; right: 20px; width: 320px;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); box-shadow: var(--shadow-md); z-index: 1000;
}
.progress-header { padding: 0.75rem 1rem; background: #f8fafc; font-weight: 600; font-size: 0.85rem; }
.progress-items-list { max-height: 180px; overflow-y: auto; padding: 0.5rem 1rem; }
.progress-item-name { font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 4px; }
.progress-bar-track { height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--primary); width: 0%; }
