/* ==========================================================================
   Server File Repository - Modern Dark Dashboard Theme
   Accent: #d4ff3d
   ========================================================================== */

:root {
  --bg-primary: #0a0b0e;
  --bg-secondary: #111317;
  --bg-card: #16181f;
  --bg-card-hover: #1e212b;
  --bg-input: #1b1e26;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(212, 255, 61, 0.5);

  --accent: #d4ff3d;
  --accent-glow: rgba(212, 255, 61, 0.25);
  --accent-muted: rgba(212, 255, 61, 0.12);
  --accent-text: #0a0b0e;

  --text-primary: #f0f2f5;
  --text-secondary: #9aa0a9;
  --text-muted: #5e6470;

  --danger: #ff4d6d;
  --danger-muted: rgba(255, 77, 109, 0.15);
  --warning: #ffb703;
  --warning-muted: rgba(255, 183, 3, 0.15);
  --success: #38b000;
  --success-muted: rgba(56, 176, 0, 0.15);
  --info: #00b4d8;

  --font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --sidebar-width: 260px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.35);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: #252932;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #353b47;
}

/* Layout */
.app-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

.logo-badge {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent) 0%, #b2e617 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-text);
  font-weight: 800;
  font-size: 1.15rem;
  box-shadow: 0 0 15px var(--accent-glow);
}

.logo-text h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.logo-text span {
  font-size: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.sidebar-nav {
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.8;
  transition: var(--transition);
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
  color: var(--accent);
  background: var(--accent-muted);
  border-color: rgba(212, 255, 61, 0.2);
  font-weight: 600;
}

.nav-item.active svg {
  color: var(--accent);
}

.nav-badge {
  margin-left: auto;
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.nav-item.active .nav-badge {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #252833;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid rgba(212, 255, 61, 0.25);
}

.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.btn-icon-ghost {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-icon-ghost:hover {
  color: var(--danger);
  background: var(--danger-muted);
}

/* Main Content Area */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

/* Top Navigation Bar */
.topbar {
  height: 70px;
  padding: 0 32px;
  background-color: rgba(17, 19, 23, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mobile-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(212, 255, 61, 0.7); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 6px rgba(212, 255, 61, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(212, 255, 61, 0); }
}

/* Page Container */
.page-container {
  padding: 32px;
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.page-section {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.page-section.active {
  display: block;
}

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

/* Grid & Cards */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.card-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.card-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 8px;
}

.card-subtext {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Progress bar in card */
.progress-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 10px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #b2e617, var(--accent));
  border-radius: 4px;
  transition: width 0.4s ease;
  box-shadow: 0 0 10px var(--accent-glow);
}

/* Action Banner */
.action-banner {
  background: linear-gradient(135deg, rgba(212, 255, 61, 0.08) 0%, rgba(22, 24, 31, 0.8) 100%);
  border: 1px solid rgba(212, 255, 61, 0.25);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.banner-content h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--accent);
}

.banner-content p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  max-width: 650px;
}

.banner-actions {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 0 15px var(--accent-glow);
}

.btn-primary:hover {
  background: #e2ff66;
  transform: translateY(-1px);
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: var(--danger-muted);
  color: var(--danger);
  border-color: rgba(255, 77, 109, 0.3);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

/* Tables */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  margin-bottom: 28px;
}

.table-header-bar {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.table-title {
  font-size: 1rem;
  font-weight: 700;
}

.table-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-input-wrapper {
  position: relative;
  min-width: 240px;
}

.search-input-wrapper svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}

.search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  transition: var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.select-input {
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
}

.select-input:focus {
  outline: none;
  border-color: var(--accent);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 16px 20px;
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: var(--transition);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

/* File Cell */
.file-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.file-info-name {
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-info-id {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.badge-active {
  background: rgba(212, 255, 61, 0.12);
  color: var(--accent);
  border: 1px solid rgba(212, 255, 61, 0.25);
}

.badge-document {
  background: rgba(0, 180, 216, 0.12);
  color: #00b4d8;
  border: 1px solid rgba(0, 180, 216, 0.25);
}

.badge-image {
  background: rgba(255, 183, 3, 0.12);
  color: #ffb703;
  border: 1px solid rgba(255, 183, 3, 0.25);
}

.badge-data {
  background: rgba(181, 23, 158, 0.12);
  color: #f72585;
  border: 1px solid rgba(181, 23, 158, 0.25);
}

/* Table Actions */
.action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-table-action {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-family: inherit;
  transition: var(--transition);
}

.btn-table-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-table-download {
  color: var(--accent);
  border-color: rgba(212, 255, 61, 0.2);
  background: rgba(212, 255, 61, 0.06);
}

.btn-table-download:hover {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.btn-table-copy {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.25);
  background: rgba(56, 189, 248, 0.08);
}

.btn-table-copy:hover {
  background: rgba(56, 189, 248, 0.2);
  color: #7dd3fc;
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.btn-table-delete:hover {
  background: var(--danger-muted);
  color: var(--danger);
  border-color: rgba(255, 77, 109, 0.3);
}

/* Pagination */
.pagination-bar {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.pagination-controls {
  display: flex;
  gap: 8px;
}

/* Drag and Drop Upload Zone */
.dropzone {
  border: 2px dashed rgba(212, 255, 61, 0.3);
  background: rgba(212, 255, 61, 0.02);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: rgba(212, 255, 61, 0.06);
  box-shadow: 0 0 25px var(--accent-glow);
}

.dropzone-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: rgba(212, 255, 61, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.dropzone-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.dropzone-text {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 20px;
}

.dropzone-file-input {
  display: none;
}

/* Upload Queue & Progress */
.upload-queue {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.upload-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.upload-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.upload-item-name {
  font-size: 0.88rem;
  font-weight: 600;
}

.upload-item-status {
  font-size: 0.8rem;
  color: var(--accent);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  transform: translateY(15px);
  transition: transform 0.2s ease;
  overflow: hidden;
}

.modal-backdrop.active .modal {
  transform: translateY(0);
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-body {
  padding: 24px;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: rgba(0, 0, 0, 0.2);
}

/* Preview Box */
.preview-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.82rem;
  max-height: 250px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: #b0b8c4;
}

/* Form inputs in settings / modals */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

/* Storage breakdown visualizer */
.storage-bars-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 14px;
}

.category-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}

/* Empty state */
.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

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

/* Mobile Responsive */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .mobile-toggle {
    display: block;
  }

  .page-container {
    padding: 20px 16px;
  }

  .action-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .banner-actions {
    width: 100%;
  }

  .banner-actions .btn {
    flex: 1;
    justify-content: center;
  }
}
