* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--bg-page);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  color: var(--text-main);
}

/* ===== LAYOUT PRINCIPAL ===== */
.office-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ===== SIDEBAR STANGA ===== */
.sidebar {
  width: 280px;
  background: var(--glass-bg);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
  box-shadow: none;
}

.sidebar-header {
  height: 82px;
  min-height: 82px;

  display: flex;
  align-items: center;

  padding: 0 20px;

  border-bottom: 1px solid var(--glass-border);

  box-sizing: border-box;
}

.sidebar-header h2 {
  color: var(--accent);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 12px;
}

.nav-section {
  margin-bottom: 24px;
}

.nav-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-soft);
  padding: 8px 12px;
  margin-bottom: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-soft);
  margin-bottom: 4px;
}

.nav-item i {
  width: 20px;
  color: var(--accent);
}

.nav-item:hover {
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
}

.nav-item.active {
  background: rgba(var(--accent-rgb), 0.10);
  color: var(--accent);
  border-left: none;
  position: relative;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  width: 4px;
  height: 18px;
  border-radius: 999px;
  background: var(--accent);
}

/* Collections */
.collections-list {
  margin-top: 8px;
}

.collection-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-soft);
}

.collection-item:hover {
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
}

.collection-item i {
  font-size: 0.7rem;
  color: var(--accent);
}

.add-collection {
  margin-top: 12px;
  padding: 8px 16px;
  font-size: 0.8rem;
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== ZONA CENTRALA ===== */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Top Bar */
.top-bar {
  height: 82px;
  min-height: 82px;

  padding: 0 24px;

  background: var(--glass-bg);
  border-bottom: 1px solid var(--glass-border);

  display: flex;
  justify-content: space-between;
  align-items: center;

  box-shadow: none;

  box-sizing: border-box;
}

.back-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.top-bar-actions {
  display: flex;
  gap: 12px;
}

.autosave-indicator {
  font-size: 0.7rem;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Workspace */
.workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Content Area (Cards Grid) */
.content-area {
  flex: 3;
  padding: 24px;
  overflow-y: auto;
}

/* Right Panel */
.right-panel {
  width: 320px;
  background: var(--glass-bg);
  border-left: 1px solid var(--glass-border);
  padding: 20px;
  overflow-y: auto;
  flex-shrink: 0;
  box-shadow: none;
}

.panel-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--glass-border);
}

.panel-section h4 {
  color: var(--accent);
  font-size: 0.85rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 0.85rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  background: rgba(var(--accent-rgb), 0.12);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.7rem;
  cursor: pointer;
}

.ai-tools {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-btn {
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px solid rgba(var(--accent-rgb), 0.16);
  border-radius: 14px;
  padding: 10px 14px;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.ai-btn:hover {
  background: rgba(var(--accent-rgb), 0.16);
  color: var(--accent);
  transform: translateY(-1px);
}

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.workspace-card {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(var(--accent-rgb), 0.12);
  border-radius: 20px;
  padding: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: none;
}

.workspace-card:hover {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(var(--accent-rgb), 0.38);
  transform: translateY(-1px);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.card-icon {
  font-size: 1.5rem;
  color: var(--accent);
}

.card-actions {
  display: flex;
  gap: 8px;
}

.card-actions button {
  background: transparent;
  border: none;
  color: var(--text-soft);
  cursor: pointer;
}

.card-title {
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
  font-size: 1rem;
}

.card-preview {
  font-size: 0.8rem;
  color: var(--text-soft);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.65rem;
  color: var(--text-soft);
  padding-top: 10px;
  border-top: 1px solid rgba(var(--accent-rgb), 0.12);
}

.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.card-tag {
  background: rgba(var(--accent-rgb), 0.12);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.6rem;
}

.pinned {
  border-left: 3px solid var(--accent);
}

/* Editor Modal */
.editor-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}

.editor-container {
  width: 90%;
  max-width: 1000px;
  height: 85vh;
  background: var(--glass-bg);
  border-radius: 28px;
  border: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: none;
}

.editor-toolbar {
  padding: 16px 20px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.editor-toolbar button {
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px solid rgba(var(--accent-rgb), 0.16);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--text-main);
  cursor: pointer;
}

.editor-title-input {
  padding: 16px 20px;
  font-size: 1.2rem;
  background: transparent;
  border: none;
  color: var(--accent);
  font-weight: 600;
  border-bottom: 1px solid var(--glass-border);
}

.editor-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.editor-content {
  min-height: 100%;
  outline: none;
  line-height: 1.7;
}

.editor-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Focus Mode */
.focus-mode .sidebar,
.focus-mode .right-panel,
.focus-mode .top-bar {
  display: none;
}

.focus-mode .editor-container {
  width: 100%;
  height: 100vh;
  border-radius: 0;
}

/* Hidden */
.hidden {
  display: none !important;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
  width: 100%;
}

.stat-card {
  background: var(--glass-bg);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  min-width: 0;
}

.stat-card i {
  font-size: 1.5rem;
  color: var(--accent);
}

.stat-number {
  font-size: 1.8rem;
  font-weight: 700;
}

.stat-label {
  font-size: 0.7rem;
}

.main-area,
.workspace,
.content-area {
  min-width: 0;
}

/* ===== PREMIUM THEMED SCROLLBAR ===== */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 20px;
}

*::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 20px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  background-clip: padding-box;
}

/* ===== TABLET ===== */
@media (max-width: 1024px) {
  .office-layout {
    height: 100dvh;
  }

  .right-panel {
    display: none;
  }

  .content-area {
    padding: 18px;
  }

  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
  body {
    overflow: hidden;
  }

  .office-layout {
    flex-direction: column;
    height: 100dvh;
  }

  .sidebar {
    width: 100%;
    height: auto;
    max-height: 82px;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
  }

  .sidebar-header {
    min-width: 72px;
    padding: 16px;
    border-bottom: none;
    border-right: 1px solid var(--glass-border);
  }

  .sidebar-header h2 span,
  .nav-section-title,
  .collection-item span,
  .add-collection span {
    display: none;
  }

  .sidebar-nav {
    display: flex;
    flex-direction: row;
    gap: 8px;
    padding: 12px;
    overflow-x: auto;
  }

  .nav-section {
    display: flex;
    margin-bottom: 0;
    gap: 8px;
  }

  .nav-item,
  .collection-item,
  .add-collection {
    min-width: 46px;
    height: 46px;
    justify-content: center;
    padding: 0;
    margin-bottom: 0;
  }

  .nav-item span {
    display: none;
  }

  .main-area {
    flex: 1;
    min-height: 0;
  }

  .top-bar {
    padding: 12px;
    gap: 10px;
    align-items: center;
  }

  .premium-back-btn {
    padding: 9px 12px;
    font-size: 0.8rem;
  }

  .autosave-indicator {
    display: none;
  }

  .workspace {
    display: block;
    overflow: hidden;
  }

  .content-area {
    height: calc(100dvh - 140px);
    padding: 14px;
    overflow-y: auto;
  }

  .right-panel {
    display: none;
  }

  .cards-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .dashboard-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .editor-container {
    width: 100%;
    height: 100dvh;
    border-radius: 0;
  }
}

/* ===== SMALL PHONES ===== */
@media (max-width: 420px) {
  .dashboard-stats {
    grid-template-columns: 1fr;
  }

  .top-bar-actions {
    gap: 6px;
  }

  #focusModeBtn {
    padding: 8px 10px !important;
    font-size: 0.75rem;
  }
}

/* ===== PREMIUM FILE UPLOAD ===== */
.premium-file-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.premium-file-upload:hover {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
  transform: translateY(-1px);
}

.premium-file-name {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text-soft);
  text-align: center;
}

/* ===== OFFICE SEARCH ===== */
.office-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 260px;
  padding: 8px 12px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  color: var(--text-soft);
}

.office-search input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 0.85rem;
}

.office-search input::placeholder {
  color: var(--text-soft);
}

@media (max-width: 768px) {
  .office-search {
    min-width: 0;
    width: 100%;
  }
}

/* ===== TAG INPUT ROW ===== */
.tag-input-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.tag-input-row input {
  flex: 1;
  min-width: 0;
  background: var(--bg-page);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 0.8rem;
  outline: none;
}

.tag-input-row input:focus {
  border-color: var(--accent);
}

.tag-remove {
  margin-left: 6px;
  opacity: 0.65;
  cursor: pointer;
}



.panel-section {
  padding-bottom: 24px;
  margin-bottom: 24px;
}

/* Drop Zone */
.drop-zone {
  border: 1px dashed var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 20px;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-weight: 600;
}

.drop-zone.active {
  background: rgba(var(--accent-rgb), 0.16);
}

/* Toast Container */
.toast-container {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  min-width: 240px;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(12px);
  font-size: 0.85rem;
  animation: toastIn 0.25s ease;
}

.toast.success {
  border-color: var(--success);
}

.toast.error {
  border-color: #ff6b6b;
}

.toast.info {
  border-color: var(--accent);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


.theme-dark {
  --scrollbar-thumb: rgba(212, 175, 55, 0.65);
  --scrollbar-thumb-hover: rgba(212, 175, 55, 0.9);
  --scrollbar-track: rgba(255,255,255,0.03);
}

.theme-grey {
  --scrollbar-thumb: rgba(180, 180, 180, 0.55);
  --scrollbar-thumb-hover: rgba(220, 220, 220, 0.8);
  --scrollbar-track: rgba(255,255,255,0.025);
}


/* ===== SIDEBAR BACK BUTTON ===== */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sidebar-back-btn {
  width: 42px;
  height: 42px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px solid rgba(var(--accent-rgb), 0.16);

  color: var(--accent);
  text-decoration: none;

  transition: all 0.2s ease;
}

.sidebar-back-btn:hover {
  background: rgba(var(--accent-rgb), 0.16);
  transform: translateX(-2px);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;

  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 700;
}

.top-bar-title {
  display: flex;
  align-items: center;
  gap: 10px;

  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 700;
}


/* ===== PERFECT HEADER ALIGNMENT ===== */

.sidebar-header,
.top-bar {
  height: 82px;
  min-height: 82px;
  box-sizing: border-box;
}

/* sidebar */
.sidebar-header {
  display: flex;
  align-items: center;
  padding: 0 20px;
}

/* topbar */
.top-bar {
  display: flex;
  align-items: center;
  padding: 0 24px;
}



/* ===== MOBILE: MY OFFICE AS APP MODAL ===== */
@media (max-width: 768px) {
  body {
    overflow: hidden;
    background: var(--bg-page);
  }

  .office-layout {
    width: calc(100vw - 20px);
    height: calc(100dvh - 20px);

    margin: 10px auto;

    display: flex;
    flex-direction: column;

    border: 1px solid var(--glass-border);
    border-radius: 28px;

    background: var(--glass-bg);
    overflow: hidden;

    box-shadow: 0 18px 50px rgba(0,0,0,0.35);
  }

  .sidebar {
    width: 100%;
    height: 74px;
    min-height: 74px;

    flex-direction: row;
    align-items: center;

    border-right: none;
    border-bottom: 1px solid var(--glass-border);

    overflow-x: auto;
    overflow-y: hidden;
  }

  .sidebar-header {
    width: 74px;
    min-width: 74px;
    height: 74px;
    min-height: 74px;

    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border-bottom: none;
    border-right: 1px solid var(--glass-border);
  }

  .sidebar-header span,
  .nav-section-title,
  .nav-item span,
  .collection-item span,
  .add-collection span {
    display: none;
  }

  .sidebar-nav {
    flex: 1;

    display: flex;
    flex-direction: row;
    align-items: center;

    gap: 8px;
    padding: 0 12px;

    overflow-x: auto;
    overflow-y: hidden;
  }

  .nav-section {
    display: flex;
    flex-direction: row;
    gap: 8px;
    margin: 0;
  }

  .nav-item,
  .collection-item,
  .add-collection {
    width: 48px;
    min-width: 48px;
    height: 48px;

    padding: 0;
    margin: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 16px;
  }

  .main-area {
    flex: 1;
    min-height: 0;
  }

  .top-bar {
    height: auto;
    min-height: auto;

    padding: 12px;

    flex-direction: column;
    align-items: stretch;

    gap: 10px;
  }

  .top-bar-title {
    justify-content: center;
    font-size: 1rem;
  }

  .top-bar-actions {
    width: 100%;
    display: flex;
    gap: 8px;
  }

  .office-search {
    flex: 1;
    min-width: 0;
    height: 44px;
    border-radius: 14px;
  }

  #focusModeBtn {
    height: 44px;
    padding: 0 12px !important;
    border-radius: 14px;
  }

  .workspace {
    display: block;
    min-height: 0;
  }

  .content-area {
    height: calc(100dvh - 190px);
    padding: 14px;
    overflow-y: auto;
  }

  .right-panel {
    display: none;
  }

  .cards-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .workspace-card {
    border-radius: 18px;
    padding: 16px;
  }

  .dashboard-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}