/* assets/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=DM+Sans:wght@300;400;500&display=swap');

:root {
  --bg:          #0c0b09;
  --bg2:         #141210;
  --bg3:         #1c1916;
  --surface:     #211f1b;
  --border:      #2e2b25;
  --border2:     #3d3930;
  --gold:        #c8a96e;
  --gold-light:  #e2c896;
  --gold-dim:    #7a6540;
  --text:        #e8e2d9;
  --text-muted:  #9a9080;
  --text-dim:    #5a5248;
  --danger:      #d44;
  --success:     #5aa;
  --radius:      6px;
  --radius-lg:   12px;
  --shadow:      0 4px 24px rgba(0,0,0,.5);
  --shadow-sm:   0 2px 10px rgba(0,0,0,.3);
  --font-serif:  'Cormorant Garamond', Georgia, serif;
  --font-sans:   'DM Sans', system-ui, sans-serif;
  --transition:  0.2s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── Login Page ───────────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 480px;
}

.login-left {
  background: var(--bg2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  position: relative;
  overflow: hidden;
}

.login-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse at 30% 40%, rgba(200,169,110,.07) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(200,169,110,.04) 0%, transparent 50%);
  pointer-events: none;
}

.login-left-content {
  max-width: 420px;
  position: relative;
  z-index: 1;
}

.brand-logo {
  margin-bottom: 48px;
}

.brand-wordmark {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 300;
  letter-spacing: 0.12em;
  color: var(--gold);
  text-transform: uppercase;
}

.brand-sub {
  font-size: 11px;
  letter-spacing: 0.25em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 4px;
}

.login-headline {
  font-family: var(--font-serif);
  font-size: clamp(36px, 5vw, 52px);
  font-weight: 300;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 16px;
}

.login-headline em {
  font-style: italic;
  color: var(--gold);
}

.login-subtext {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 320px;
}

.login-divider {
  width: 48px;
  height: 1px;
  background: var(--gold-dim);
  margin: 32px 0;
}

.login-right {
  background: var(--bg3);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 48px;
  border-left: 1px solid var(--border);
}

.login-form-header {
  margin-bottom: 36px;
}

.login-form-title {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 400;
  color: var(--text);
}

.login-form-title span {
  color: var(--text-muted);
  font-weight: 300;
}

/* ─── Forms ─────────────────────────────────────────────────── */

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

.form-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(200,169,110,.08);
}

.form-input::placeholder { color: var(--text-dim); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.05em;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gold);
  color: var(--bg);
  width: 100%;
  padding: 14px;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.btn-primary:hover {
  background: var(--gold-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(200,169,110,.25);
}

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

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

.btn-danger {
  background: rgba(221,68,68,.15);
  color: #f88;
  border: 1px solid rgba(221,68,68,.3);
}
.btn-danger:hover { background: rgba(221,68,68,.25); }

.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-icon { padding: 8px; border-radius: var(--radius); }

/* Alert messages */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-error   { background: rgba(221,68,68,.12); border: 1px solid rgba(221,68,68,.25); color: #f88; }
.alert-success { background: rgba(85,170,170,.12); border: 1px solid rgba(85,170,170,.25); color: #8ee; }
.alert-info    { background: rgba(200,169,110,.08); border: 1px solid rgba(200,169,110,.2);  color: var(--gold-light); }

/* ─── App Shell ──────────────────────────────────────────────── */

.app-wrapper {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────────── */

.sidebar {
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

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

.sidebar-wordmark {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--gold);
  text-transform: uppercase;
  text-decoration: none;
  display: block;
}

.sidebar-tag {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-top: 2px;
}

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

.sidebar-user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-email {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
}

.sidebar-nav-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0 12px;
  margin-bottom: 8px;
  margin-top: 16px;
}
.sidebar-nav-label:first-child { margin-top: 4px; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  transition: all var(--transition);
}

.sidebar-nav a:hover { background: var(--surface); color: var(--text); }
.sidebar-nav a.active { background: rgba(200,169,110,.1); color: var(--gold); }

.sidebar-nav a svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .7; }
.sidebar-nav a.active svg { opacity: 1; }

.sidebar-bottom {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

/* ─── Main Content ───────────────────────────────────────────── */

.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

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

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

.topbar-breadcrumb .sep { color: var(--text-dim); font-size: 12px; }
.topbar-breadcrumb .current { color: var(--text); font-weight: 500; }

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

/* ─── Page body ──────────────────────────────────────────────── */

.page-body {
  padding: 32px;
  flex: 1;
}

.page-header {
  margin-bottom: 28px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.page-title {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.2;
}

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

/* ─── File Grid ──────────────────────────────────────────────── */

.section-label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

/* Folder card */
.folder-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

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

.folder-icon {
  width: 40px;
  height: 40px;
  background: rgba(200,169,110,.1);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.folder-icon svg { width: 20px; height: 20px; color: var(--gold); }

.folder-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
}

.folder-meta {
  font-size: 11px;
  color: var(--text-dim);
}

/* File card */
.file-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

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

.file-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.icon-pdf    { background: rgba(220,80,80,.12); }
.icon-cad    { background: rgba(100,180,220,.12); }
.icon-image  { background: rgba(120,200,140,.12); }
.icon-archive{ background: rgba(200,150,80,.12); }
.icon-doc    { background: rgba(80,120,220,.12); }
.icon-sheet  { background: rgba(80,180,120,.12); }
.icon-text   { background: rgba(150,150,150,.12); }
.icon-generic{ background: rgba(150,100,200,.12); }

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

.file-card-meta {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.file-download-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: rgba(200,169,110,.08);
  border: 1px solid rgba(200,169,110,.2);
  border-radius: var(--radius);
  color: var(--gold);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
  justify-content: center;
}

.file-download-btn:hover {
  background: rgba(200,169,110,.16);
  border-color: rgba(200,169,110,.4);
}

/* File table view */
.file-table {
  width: 100%;
  border-collapse: collapse;
}

.file-table th {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 400;
}

.file-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}

.file-table tr:last-child td { border-bottom: none; }
.file-table tbody tr:hover td { background: var(--surface); }

.file-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 500;
}

/* ─── Stats cards ────────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.stat-value {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 400;
  color: var(--gold);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  letter-spacing: 0.05em;
}

/* ─── Empty state ────────────────────────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.empty-state h3 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state p { font-size: 13px; max-width: 280px; }

/* ─── View toggle ────────────────────────────────────────────── */

.view-toggle {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  gap: 3px;
}

.view-toggle button {
  padding: 5px 9px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
}

.view-toggle button.active,
.view-toggle button:hover {
  background: var(--bg3);
  color: var(--text);
}

/* ─── Responsive ─────────────────────────────────────────────── */

@media (max-width: 768px) {
  .login-page {
    grid-template-columns: 1fr;
  }
  .login-left { display: none; }
  .login-right { padding: 40px 24px; min-height: 100vh; }

  .app-wrapper { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .page-body { padding: 20px 16px; }
  .topbar { padding: 0 16px; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

/* ─── Scrollbar ──────────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ─── Loading spinner ────────────────────────────────────────── */

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

/* ─── Toast notification ─────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  font-size: 13px;
  color: var(--text);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  animation: toastIn .3s ease;
}

.toast.success { border-color: rgba(85,170,170,.3); }
.toast.error   { border-color: rgba(221,68,68,.3); }

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