@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;600&family=Sora:wght@300;400;500;600&display=swap');

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

:root {
  --bg:         #0d0d12;
  --surface:    #14141c;
  --surface-2:  #1c1c28;
  --surface-3:  #242434;
  --border:     #2c2c40;
  --border-2:   #3a3a52;
  --text:       #dddde8;
  --text-muted: #7070a0;
  --text-dim:   #4a4a6a;
  --accent:     #c8a96e;
  --accent-h:   #dfc08a;
  --accent-dim: rgba(200,169,110,0.12);
  --red:        #e06060;
  --green:      #60c896;
  --blue:       #608ee0;
  --purple:     #a860e0;
  --sidebar-w:  270px;
  --radius:     10px;
  --radius-sm:  6px;
  --shadow:     0 4px 24px rgba(0,0,0,0.4);
  --transition: 0.18s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Sora', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  font-size: 14px;
  line-height: 1.6;
  overflow: hidden;
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ─── SIDEBAR ─── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  position: sticky;
  top: 0;
}

.sidebar-header {
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--border);
}

.site-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.site-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 300;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 3px;
}

/* Search */
.sidebar-search {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-wrap svg {
  position: absolute;
  left: 10px;
  color: var(--text-dim);
  pointer-events: none;
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px 8px 34px;
  color: var(--text);
  font-family: 'Sora', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}

.search-input::placeholder { color: var(--text-dim); }
.search-input:focus { border-color: var(--accent); }

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0 16px;
}

.nav-section {
  margin-bottom: 4px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 10px 24px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 24px;
  cursor: pointer;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 400;
  border-left: 3px solid transparent;
  user-select: none;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
}

.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.nav-count {
  margin-left: auto;
  font-size: 11px;
  background: var(--surface-3);
  color: var(--text-muted);
  padding: 1px 7px;
  border-radius: 99px;
}

.nav-item.active .nav-count {
  background: var(--accent-dim);
  color: var(--accent);
}

/* Sidebar bottom stats */
.sidebar-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 16px;
}

.sidebar-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-stat-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  font-family: 'Cormorant Garamond', serif;
}

.sidebar-stat-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ─── MAIN ─── */
.main {
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  padding: 20px 32px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

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

.breadcrumb span { cursor: pointer; }
.breadcrumb span:hover { color: var(--text); }
.breadcrumb .sep { color: var(--text-dim); }
.breadcrumb .current { color: var(--text); font-weight: 500; }

.view-toggle {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.view-btn {
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text-dim);
  transition: all var(--transition);
  background: none;
  border: none;
  display: flex;
  align-items: center;
}

.view-btn:hover { color: var(--text); background: var(--surface-2); }
.view-btn.active { color: var(--accent); background: var(--accent-dim); }

.content-area {
  padding: 20px 32px 40px;
  flex: 1;
}

/* ─── PAGE HEADER ─── */
.page-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.page-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.page-title {
  font-size: 22px;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

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

/* ─── DASHBOARD ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color var(--transition), transform var(--transition);
}

.stat-card:hover {
  border-color: var(--border-2);
  transform: translateY(-1px);
}

.stat-card-value {
  font-size: 32px;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  line-height: 1;
}

.stat-card-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

/* ─── FILE CARDS GRID ─── */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.file-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all var(--transition);
  cursor: default;
}

.file-card:hover {
  border-color: var(--border-2);
  background: var(--surface-2);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.file-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.file-type-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.file-type-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 99px;
  align-self: flex-start;
}

.type-pdf  { background: rgba(224,96,96,0.15); color: var(--red); }
.type-docx { background: rgba(96,142,224,0.15); color: var(--blue); }
.type-xlsx { background: rgba(96,200,150,0.15); color: var(--green); }
.type-img  { background: rgba(168,96,224,0.15); color: var(--purple); }
.type-txt  { background: rgba(200,169,110,0.15); color: var(--accent); }
.type-other{ background: rgba(112,112,160,0.15); color: var(--text-muted); }

.file-card-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
  line-height: 1.4;
}

.file-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.file-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: auto;
}

.file-card-meta .dot { opacity: 0.4; }

.file-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: 'Sora', sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(200,169,110,0.25);
}
.btn-primary:hover { background: rgba(200,169,110,0.2); border-color: var(--accent); }

.btn-ghost {
  background: var(--surface-3);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-2); }

.btn svg { width: 13px; height: 13px; }

/* ─── FILES LIST VIEW ─── */
.files-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all var(--transition);
  cursor: default;
}

.file-row:hover {
  background: var(--surface);
  border-color: var(--border);
}

.file-row-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.file-row-info { flex: 1; min-width: 0; }
.file-row-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-row-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-row-meta {
  display: flex;
  gap: 18px;
  font-size: 12px;
  color: var(--text-dim);
  flex-shrink: 0;
  min-width: 200px;
  justify-content: flex-end;
}
.file-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ─── GALLERY ─── */
.albums-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.album-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
}

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

.album-cover {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  background: var(--surface-2);
  position: relative;
}

.album-cover-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 40px;
}

.album-info {
  padding: 14px;
}

.album-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}

.album-meta {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Photos grid */
.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface-2);
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.photo-thumb:hover img { transform: scale(1.05); }

.photo-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  display: flex;
  align-items: flex-end;
  padding: 10px;
  transition: background 0.2s ease;
}

.photo-thumb:hover .photo-overlay { background: rgba(0,0,0,0.45); }

.photo-caption {
  font-size: 12px;
  color: white;
  opacity: 0;
  transform: translateY(4px);
  transition: all 0.2s ease;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.photo-thumb:hover .photo-caption {
  opacity: 1;
  transform: translateY(0);
}

/* ─── EMPTY STATE ─── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 20px;
  color: var(--text-dim);
}

.empty-state-icon { font-size: 40px; opacity: 0.4; }
.empty-state-text { font-size: 14px; text-align: center; }

/* ─── SEARCH RESULTS ─── */
.search-results-title {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

mark {
  background: rgba(200,169,110,0.25);
  color: var(--accent);
  border-radius: 2px;
  padding: 0 2px;
}

/* ─── MODAL VIEWER ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 14px;
  width: 90vw;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96) translateY(8px);
  transition: transform 0.2s ease;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}

.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: none;
  border: none;
  color: var(--text-muted);
  transition: all var(--transition);
  flex-shrink: 0;
}

.modal-close:hover { background: var(--surface-2); color: var(--text); }

.modal-body {
  flex: 1;
  overflow: hidden;
  display: flex;
}

.modal-body iframe {
  width: 100%;
  height: 100%;
  min-height: 70vh;
  border: none;
  background: white;
}

.modal-body img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  margin: auto;
  display: block;
  padding: 20px;
}

.modal-body pre {
  padding: 24px;
  overflow: auto;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  font-family: 'Sora', sans-serif;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 70vh;
}

/* ─── LIGHTBOX ─── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.lightbox.open { opacity: 1; pointer-events: all; }

.lightbox-img {
  max-width: calc(100vw - 160px);
  max-height: calc(100vh - 120px);
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
}

.lightbox-close:hover { background: rgba(255,255,255,0.15); }

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
  font-size: 20px;
}

.lightbox-nav:hover { background: rgba(255,255,255,0.15); }
.lightbox-prev { left: 24px; }
.lightbox-next { right: 24px; }

.lightbox-info {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.lightbox-caption {
  font-size: 14px;
  color: rgba(255,255,255,0.85);
}

.lightbox-counter {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}

/* ─── ANIMATIONS ─── */
.fade-in {
  animation: fadeIn 0.25s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .content-area { padding: 16px; }
  .files-grid { grid-template-columns: 1fr 1fr; }
  .file-row-meta { display: none; }
}
