/* EuroBureau — Global Styles */

@font-face {
  font-family: 'Caslon OS';
  src: url('/static-fonts/CaslonOS-Regular.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

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

body {
  font-family: 'Caslon OS', 'Libre Baskerville', Georgia, serif;
  background: #fff;
  color: #111;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ========================================
   Auth pages (login, register, set-password)
   ======================================== */

body.auth-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  padding: 48px 40px;
}

.auth-card .wordmark {
  display: block;
  text-align: center;
  font-size: 18px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 48px;
  color: #111;
  text-decoration: none;
}

.auth-card h1 {
  font-size: 22px;
  font-weight: normal;
  margin-bottom: 28px;
  text-align: center;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: #444;
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-family: inherit;
  font-size: 15px;
  color: #111;
  transition: border-color 0.15s ease;
}

.form-group input:focus {
  outline: none;
  border-color: #111;
}

.btn {
  display: block;
  width: 100%;
  padding: 14px;
  background: #111;
  color: #fff;
  border: 2px solid #111;
  border-radius: 3px;
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
  margin-top: 12px;
  transition: all 0.15s ease;
}

.btn:hover {
  background: #333;
  border-color: #333;
}

.error {
  background: #fff5f5;
  color: #900;
  padding: 12px 14px;
  border: 1px solid #fdd;
  border-radius: 3px;
  margin-bottom: 20px;
  font-size: 14px;
}

.message {
  text-align: center;
  font-size: 15px;
  line-height: 1.7;
  color: #444;
  margin-bottom: 24px;
}

.link {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
}

.link a {
  color: #111;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link a:hover {
  color: #444;
}

/* ========================================
   App pages (landing / file manager)
   ======================================== */

.navbar {
  background: #111;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #fff;
  text-decoration: none;
}

.navbar-brand:hover { opacity: 0.8; }

.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.navbar-user {
  font-size: 14px;
  color: rgba(255,255,255,0.8);
}

.navbar-logout {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  padding: 6px 14px;
  border-radius: 3px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.navbar-logout:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.4);
}

.main-content {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 24px;
}

.section {
  margin-bottom: 48px;
}

.section-heading {
  font-size: 18px;
  font-weight: normal;
  margin-bottom: 20px;
  color: #111;
}

/* Cards */
.card {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  transition: border-color 0.15s ease;
}

.card:hover {
  border-color: #ccc;
}

/* Create Grid */
.create-grid {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.create-card {
  width: 150px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  border-top: 3px solid #111;
}

.create-card-icon { font-size: 32px; margin-bottom: 8px; }
.create-card-label { font-size: 14px; color: #333; }

/* Recent Grid */
.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.document-card {
  padding: 16px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.document-card-icon { font-size: 24px; margin-bottom: 8px; }
.document-card-name {
  font-size: 14px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.document-card-date { font-size: 12px; color: #888; }

/* Browser Toolbar */
.browser-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.browser-heading {
  font-size: 18px;
  font-weight: normal;
  color: #111;
  flex: 1;
}

.btn-toolbar {
  background: #111;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 3px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-toolbar:hover { background: #333; }

/* File Tree */
.file-tree-container {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  overflow: hidden;
}

.file-tree {
  padding: 8px 0;
  min-height: 100px;
}

.file-tree-node {
  user-select: none;
}

.file-tree-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  gap: 8px;
  font-size: 14px;
  position: relative;
  border-bottom: 1px solid #f5f5f5;
}

.file-tree-item:hover { background: #fafafa; }
.file-tree-item.active { background: #f0f0f0; }
.file-tree-item.drag-over {
  background: #f0f0f0;
  outline: 2px dashed #111;
  outline-offset: -2px;
}

.file-tree-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 10px;
  flex-shrink: 0;
  transition: transform 0.15s ease;
  color: #666;
}

.file-tree-arrow.expanded { transform: rotate(90deg); }
.file-tree-arrow.hidden { visibility: hidden; }
.file-tree-icon { font-size: 18px; flex-shrink: 0; }
.file-tree-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-tree-name.folder-name { font-weight: 500; }
.file-tree-meta { font-size: 12px; color: #888; flex-shrink: 0; margin-right: 4px; }

.file-tree-actions {
  opacity: 0;
  transition: opacity 0.15s;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 18px;
  color: #666;
  flex-shrink: 0;
}

.file-tree-item:hover .file-tree-actions { opacity: 1; }
.file-tree-actions:hover { background: #eee; }

.epub-export-btn { font-size: 14px; padding: 2px 6px; color: #111; }
.epub-export-btn:hover { background: #f0f0f0; }

.file-tree-children { padding-left: 20px; }
.file-tree-loading { padding: 8px 12px 8px 48px; font-size: 13px; color: #999; }
.file-tree-empty { padding: 8px 12px 8px 48px; font-size: 13px; color: #999; font-style: italic; }

/* Context Menu */
.context-menu {
  position: absolute;
  background: #fff;
  border-radius: 4px;
  border: 1px solid #e8e8e8;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 300;
  min-width: 140px;
  padding: 4px 0;
  display: none;
}

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

.context-menu-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  color: #333;
}

.context-menu-item:hover { background: #f5f5f5; }
.context-menu-item.danger { color: #900; }
.context-menu-item.danger:hover { background: #fff5f5; }

/* Shared With Me */
.shared-list {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  overflow: hidden;
}

.shared-list-header {
  display: grid;
  grid-template-columns: 1fr 150px 140px 120px;
  padding: 10px 16px;
  font-size: 12px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #eee;
}

.shared-item {
  display: grid;
  grid-template-columns: 1fr 150px 140px 120px;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #f5f5f5;
  transition: background 0.15s;
}

.shared-item:last-child { border-bottom: none; }
.shared-item:hover { background: #fafafa; }

.shared-item-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.shared-item-icon { font-size: 20px; flex-shrink: 0; }
.shared-item-name {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shared-item-owner {
  font-size: 13px;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shared-item-permissions {
  font-size: 12px;
  color: #555;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.perm-badge {
  background: #f0f0f0;
  color: #333;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
}

.shared-item-date { font-size: 13px; color: #666; }

/* Placeholder Section */
.placeholder-grid {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.placeholder-card {
  width: 180px;
  padding: 24px 16px;
  text-align: center;
  opacity: 0.5;
  cursor: not-allowed;
}

.placeholder-card:hover { border-color: #e8e8e8; }
.placeholder-badge {
  display: inline-block;
  background: #f0f0f0;
  color: #888;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 3px;
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.placeholder-label { font-size: 14px; color: #666; }

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #888;
  font-size: 14px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 68px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.toast {
  padding: 12px 16px;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  animation: slideIn 0.3s ease;
  cursor: pointer;
}

.toast-error { background: #900; color: #fff; }
.toast-success { background: #1a5c1a; color: #fff; }

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

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}

.modal {
  background: #fff;
  border-radius: 4px;
  padding: 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.modal-title {
  font-size: 18px;
  font-weight: normal;
  margin-bottom: 16px;
}

.modal-folder-list {
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: 16px;
}

.modal-folder-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
}

.modal-folder-item:hover { background: #f5f5f5; }
.modal-folder-item.selected { background: #f0f0f0; border: 1px solid #111; }
.modal-folder-item.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.modal-folder-item.current-location { background: #fffbe6; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-btn {
  padding: 8px 16px;
  border-radius: 3px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  border: none;
}

.modal-btn-cancel { background: #f0f0f0; color: #333; }
.modal-btn-cancel:hover { background: #e5e5e5; }
.modal-btn-confirm { background: #111; color: #fff; }
.modal-btn-confirm:hover { background: #333; }

/* Rename Input */
.rename-input {
  font-family: inherit;
  font-size: 14px;
  padding: 4px 8px;
  border: 2px solid #111;
  border-radius: 3px;
  width: 100%;
  outline: none;
}

/* Upload Progress */
.upload-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
}

.upload-progress {
  background: #fff;
  border-radius: 4px;
  padding: 32px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.upload-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #eee;
  border-top-color: #111;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 768px) {
  .main-content { padding: 24px 16px; }
  .create-grid { flex-direction: column; }
  .create-card { width: 100%; }
  .recent-grid { grid-template-columns: 1fr; }
  .placeholder-grid { flex-direction: column; }
  .placeholder-card { width: 100%; }
  .navbar { padding: 0 12px; }
  .toast-container { right: 12px; left: 12px; max-width: none; }
  .shared-list-header { display: none; }
  .shared-item { grid-template-columns: 1fr; gap: 4px; }
}

@media (max-width: 480px) {
  .auth-card { padding: 32px 24px; }
}
