:root {
  --primary: #1a73e8; /* Google Blue */
  --primary-hover: #1765cc;
  --bg-body: #f7f9fc;
  --bg-surface: #ffffff;
  --text-main: #202124;
  --text-sub: #5f6368;
  --border: #dadce0;
  --hover-bg: #f1f3f4;
  --selection: #e8f0fe;
  --danger: #d93025;
  --success: #188038;
  --sidebar-width: 256px;
  --header-height: 64px;
  --shadow-card: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
  --shadow-menu: 0 2px 6px 2px rgba(60,64,67,0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Google Sans', 'Roboto', 'Segoe UI', Arial, sans-serif;
}

body {
  background-color: var(--bg-body);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Icons SVG reset */
svg {
  fill: currentColor;
  width: 24px;
  height: 24px;
}

/* --- HEADER --- */
.header {
  height: var(--header-height);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  justify-content: space-between;
  z-index: 100;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 230px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-text {
  font-size: 22px;
  color: var(--text-sub);
  font-weight: 400;
}

.search-bar {
  flex: 1;
  max-width: 720px;
  background: #f1f3f4;
  border-radius: 8px;
  height: 46px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  transition: background 0.2s, box-shadow 0.2s;
}

.search-bar:focus-within {
  background: var(--bg-surface);
  box-shadow: 0 1px 1px 0 rgba(65,69,73,0.3), 0 1px 3px 1px rgba(65,69,73,0.15);
}

.search-input {
  border: none;
  background: transparent;
  flex: 1;
  font-size: 16px;
  color: var(--text-main);
  outline: none;
}

.header-profile {
  display: flex;
  gap: 16px;
  align-items: center;
  min-width: 100px;
  justify-content: flex-end;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: rgba(0,0,0,0.04);
}

/* --- LAYOUT --- */
.main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* --- SIDEBAR --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  padding: 16px 0;
}

.new-btn-wrapper {
  padding: 0 16px 16px 16px;
}

.btn-new {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px 0 rgba(60,64,67,0.3);
  border-radius: 24px;
  padding: 0 24px 0 16px;
  height: 48px;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 120px;
}

.btn-new:hover {
  box-shadow: 0 4px 8px 3px rgba(60,64,67,0.15);
  background: #f8fafe;
}

.btn-new-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
}

.btn-new-plus {
  width: 24px;
  height: 24px;
}

/* Sidebar dropdown for "New" */
.new-dropdown {
  position: absolute;
  top: 120px;
  left: 20px;
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow-menu);
  width: 200px;
  display: none;
  flex-direction: column;
  padding: 8px 0;
  z-index: 200;
}

.new-dropdown.active {
  display: flex;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  color: var(--text-main);
  font-size: 14px;
}

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

.nav-menu {
  display: flex;
  flex-direction: column;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 24px;
  cursor: pointer;
  color: var(--text-main);
  font-size: 14px;
  border-radius: 0 24px 24px 0;
  margin-right: 16px;
}

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

.nav-item.active {
  background: #e8f0fe;
  color: var(--primary);
  font-weight: 500;
}

/* --- CONTENT AREA --- */
.content-area {
  flex: 1;
  background: var(--bg-surface);
  margin: 16px 16px 16px 0;
  border-radius: 16px;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Breadcrumbs */
.toolbar-top {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid transparent;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb-item {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text-sub);
  text-decoration: none;
  font-size: 18px;
  cursor: pointer;
}

.breadcrumb-item:hover {
  background: var(--hover-bg);
  color: var(--text-main);
}

.breadcrumb-item.active {
  color: var(--text-main);
  font-weight: 400;
  cursor: default;
}

.breadcrumb-item.active:hover {
  background: transparent;
}

/* File Grid */
.file-container {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 40px;
}

.section-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-sub);
  margin: 16px 0 12px 0;
}

.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.grid-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  height: 200px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: background 0.1s, box-shadow 0.1s;
  position: relative;
}

.grid-item:hover {
  background: #f8fafe;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.grid-item.selected {
  background: #e8f0fe;
  border-color: var(--primary);
}

.item-preview {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f3f4;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
  font-size: 64px;
}

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

.item-footer {
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 12px;
  background: white;
  border-radius: 0 0 8px 8px;
  border-top: 1px solid transparent;
}

.item-icon {
  font-size: 20px;
  width: 24px;
  text-align: center;
}

.item-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
}

.item-menu-btn {
  opacity: 0;
  padding: 4px;
  border-radius: 50%;
  cursor: pointer;
}

.grid-item:hover .item-menu-btn {
  opacity: 1;
}

.item-menu-btn:hover {
  background: rgba(0,0,0,0.1);
}

/* Context Menu */
.context-menu {
  position: fixed;
  background: white;
  border-radius: 4px;
  box-shadow: var(--shadow-menu);
  padding: 6px 0;
  z-index: 1000;
  min-width: 200px;
  display: none;
}

.context-menu.active {
  display: block;
}

.context-item {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-main);
  cursor: pointer;
}

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

.context-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

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

/* Modals */
.modal-overlay {
  background: rgba(0,0,0,0.4);
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: 0.2s;
}

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

.modal {
  background: white;
  border-radius: 8px;
  width: 400px;
  padding: 24px;
  box-shadow: 0 24px 38px 3px rgba(0,0,0,0.14);
}

.modal-title {
  font-size: 22px;
  margin-bottom: 16px;
  color: var(--text-main);
}

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

.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text-sub);
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--primary);
  border-radius: 4px;
  font-size: 16px;
  outline: none;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.btn {
  padding: 8px 24px;
  border-radius: 4px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: 0.2s;
}

.btn-text {
  background: transparent;
  color: var(--primary);
}

.btn-text:hover {
  background: #f6fafe;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 1px 2px rgba(60,64,67,0.3);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-sub);
}

.empty-img {
  width: 200px;
  margin-bottom: 24px;
  opacity: 0.6;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 3000;
}

.toast {
  background: #323232;
  color: white;
  padding: 14px 24px;
  border-radius: 4px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .content-area { margin: 0; padding: 10px; border-radius: 0; }
  .search-bar { display: none; } /* Simplify for mobile */
  .header-mobile-menu { display: block; }
}

/* Preview & Loader styles reused but simplified */
.loading-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.8);
  display: flex; justify-content: center; align-items: center;
  z-index: 5000;
}
.spinner {
  border: 4px solid #f3f3f3; border-top: 4px solid var(--primary);
  border-radius: 50%; width: 40px; height: 40px;
  animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Login Specific */
.login-container {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
}

.login-card {
  width: 100%;
  max-width: 450px;
  padding: 48px 40px 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
}

.login-logo {
  color: var(--text-main);
  font-size: 24px;
  margin-bottom: 40px;
}

.form-input-clean {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 20px;
  font-size: 16px;
  transition: 0.2s;
}

.form-input-clean:focus {
  border: 2px solid var(--primary);
  padding: 12px 14px; /* compensate border */
  outline: none;
}
