/* =======================
   Nimbus Drive CSS
   ======================= */

/* ===== Theme Variables ===== */
:root {
  --bg: #0b0c10;
  --panel: #0f1115;
  --muted: #9aa3b2;
  --text: #e8ecf1;
  --accent: #4f8cff;
  --accent-2: #8b5cf6; 
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --card: #11131a;
  --border: #1b1f2a;
  --hover: #171a23;
  --hover-link: #4f8cff; 
  --shadow: 0 4px 24px rgba(0,0,0,.25);
  --radius: 9px;
}

.light {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --muted: #5b6576;
  --text: #0b1324;
  --accent: #2962ff;
  --accent-2: #7c4dff;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --card: #ffffff;
  --border: #e6e8ef;
  --hover: #f1f3f9;
  --hover-link: #2962ff; 
  --shadow: 0 6px 28px rgba(14, 23, 38, .08);
}

/* ===== Reset ===== */
* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: sans-serif;
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0.2px;
  overflow-x: hidden;
}

/* ===== App Layout ===== */
.app {
  display: grid;
  grid-template-rows: 58px 1fr;
  grid-template-columns: 1fr;
  grid-template-areas: "topbar" "main";
  height: 100vh;
  overflow: hidden;
}

/* ===== Topbar ===== */
.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  height: 58px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: var(--transition);
}

.brand:hover {
  background: var(--hover);
  transform: translateY(-2px);
}

.brand .material-symbols-outlined {
  font-size: 26px;
  color: var(--accent);
  transition: var(--transition);
}

.brand strong {
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* ===== Search Bar ===== */
.search {
  flex: 1;
  position: relative;
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
}

.search input {
  width: 100%;
  padding: 10px 90px 10px 60px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  outline: none;
  box-shadow: var(--shadow);
  transition: var(--transition);
  font-size: 14px;
}

.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.search .material-symbols-outlined {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: var(--accent);
  pointer-events: none;
}

.search .shortcut {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--hover);
  color: var(--muted);
  border: 1px solid var(--border);
  font-family: monospace;
  white-space: nowrap;
  pointer-events: none;
}

/* ===== Hide browser's default clear button ===== */
input[type="search"]::-webkit-search-cancel-button {
  display: none;
}
input[type="search"]::-moz-clear-button {
  display: none;
}

/* Chrome, Edge, Safari (WebKit) */
::-webkit-scrollbar {
    width: 2px;       
    height: 2px;
}

::-webkit-scrollbar-track {
    background: transparent; 
}

::-webkit-scrollbar-thumb {
    background-color: var(--accent);
    border-radius: var(--radius);
    border: 2px solid transparent; 
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--hover); 
}

/* Firefox */
* {
    scrollbar-width: 2px; 
    scrollbar-color: var(--accent) transparent; 
}

/* ===== Top Actions ===== */
.top-actions {
  display: flex;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn:hover {
  background: var(--hover);
  transform: translateY(-2px);
}

.btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.btn.ghost, .btn.menu {
  background: transparent;
  border-color: var(--border);
}

.btn.icon-only {
  padding: 8px;
}

/* ===== Sidebar ===== */
.sidebar {
  grid-area: sidebar;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--panel);
  margin-top: 0;
  padding-top: 8px;
  box-sizing: border-box;
  position: fixed;
  top: 58px;
  left: 0;
  bottom: 0;
  transform: translateX(-100%);
  transition: transform 0.3s ease-in-out;
  z-index: 10;
}

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

.sidebar-open .main {
  filter: blur(4px) brightness(0.7);
  pointer-events: none; /* prevent clicks behind sidebar */
  transition: filter 0.3s ease;
}

.side-inner {
  padding: 14px;
  display: grid;
  gap: 14px;
}

.side-group {
  background: var(--panel);
  padding: 10px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.side-group h4 {
  margin: 0 0 8px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent);
  text-align: center;
  font-weight: bold;
}

.side-group p {
  margin: 0;
  font-size: 12px;
  color: var(--accent);
}

.storage-card {
  display: flex;               
  align-items: center;          
  justify-content: space-between; 
  background: var(--card); 
  border: 1px solid var(--border); 
  padding: 12px;
  border-radius: var(--radius); 
  box-shadow: var(--shadow); 
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.storage-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.storage-card p {
  font-size: 13px;
  font-weight: bold;
  text-transform: uppercase;
  color: var(--accent);
  margin: 5px;
  display: flex;               
  align-items: center;     
  gap: 6px;
}

.storage-card p .material-symbols-outlined {
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
}

.quota { 
  padding: 14px; 
  background: var(--card); 
  border: 1px solid var(--border); 
  border-radius: var(--radius); 
  box-shadow: var(--shadow); 
}

.quota .bar { 
  height: 8px; 
  border-radius: 999px; 
  background: color-mix(in srgb, var(--card) 70%, #000); 
  overflow: hidden; 
}

.quota .bar span { 
  display: block; height: 100%; 
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); width: 36%; 
}
    
/* ===== Navigation ===== */
.nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.nav ul {
  margin-left: 16px;
  border-left: 1.5px solid var(--accent);
  display: none;
}

.nav .expanded > ul {
  display: block;
}

.nav li {
  list-style: none;
  position: relative;
}

.nav .parent {
  padding-left: 12px;
}

.nav .child {
  padding-left: 24px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid transparent;
  font-size: 13px;
  transition: var(--transition);
}

.nav a:hover {
  background: var(--hover);
  border-color: var(--border);
  transform: translateX(3px);
}

.nav a.active {
  background: color-mix(in srgb, var(--accent) 16%, var(--panel));
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
  font-weight: 600;
}

.nav .parent::before {
  content: '\e5c8'; /* Material Icons: arrow_right */
  font-family: 'Material Icons';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--muted);
}

.nav .child::before {
  content: '';
  position: absolute;
  left: 12px;
  top: -6px;
  height: calc(100% + 12px);
  width: 1px;
  background: var(--muted);
}

.nav .child::after {
  content: '\e5c8'; /* Material Icons: arrow_right */
  font-family: 'Material Icons';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  font-size: 16px;
  color: var(--muted);
}

.folder-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
  border-radius: 6px;
  transition: var(--transition);
  line-height: 1.4;
  cursor: pointer;
}

.folder-label a {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}

.folder-label:hover {
  background: var(--hover);
}

.nav .active > .folder-label {
  background: color-mix(in srgb, var(--accent) 16%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  font-weight: 600;
  border-radius: 6px;
  line-height: 1.4;
}

.toggle {
  font-size: 16px;
  color: var(--muted);
  cursor: pointer;
  transition: transform 0.2s ease, color 0.2s ease;
}

.expanded > .folder-label .toggle {
  transform: rotate(90deg);
}

.nav .active > .folder-label .toggle {
  color: var(--accent);
}

/* ===== Main Content ===== */
.main {
  grid-area: main;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 12px;
  padding: 16px;
  margin-top: 0;
  padding-top: 16px;
  overflow-y: auto;
  height: calc(100vh - 58px);
}

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

.breadcrumbs a {
  color: var(--text);
  text-decoration: none;
  transition: var(--transition);
}

.breadcrumbs a:hover {
  color: var(--hover-link);
}

.breadcrumbs .here {
  color: var(--accent);
  font-weight: 500;
}

.breadcrumbs .arrow {
  color: var(--accent);
  font-size: 15px;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.spacer {
  flex: 1;
}

.seg {
  display: inline-flex;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.seg button {
  padding: 8px 10px;
  background: transparent;
  color: var(--text);
  border: 0;
  cursor: pointer;
  transition: var(--transition);
}

.seg button[aria-pressed="true"] {
  background: var(--hover);
  color: var(--accent);
}

.seg button:hover {
  background: var(--hover);
}

/* ===== Files View ===== */
.files-view {
  list-style: none;
  padding: 0;
  margin: 0;
}

.files-view li {
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: var(--transition);
}

.files-view li:hover {
  background: var(--hover);
}

.files-view li:hover .material-symbols-outlined {
  transform: scale(1.1);
}

.files-view a {
  text-decoration: none;
  font-weight: 500;
  flex-grow: 1;
  color: var(--text);
  transition: var(--transition);
}

.files-view a:hover {
  color: var(--hover-link);
}

.files-view .meta {
  font-size: 0.9rem;
  color: var(--muted);
  white-space: nowrap;
}

.files-view .three-dot {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--muted);
  transition: var(--transition);
}

.files-view .three-dot:hover {
  color: var(--text);
}

.files-view .selected {
  background: color-mix(in srgb, var(--accent) 20%, var(--panel));
  border: 1px solid var(--accent);
}

/* ===== Modal ===== */
.modal {
  display: none;
  position: fixed;
  z-index: 20;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
  background-color: var(--panel);
  margin: 15% auto;
  padding: 20px;
  border: 1px solid var(--border);
  width: 80%;
  max-width: 400px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.close-modal {
  color: var(--muted);
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

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

#modal-title {
  margin-top: 0;
}

#modal-details {
  margin-bottom: 20px;
  color: var(--muted);
}

#modal-share,
#modal-download,
#modal-delete {
  background: var(--hover);
  color: var(--text);
  border: none;
  padding: 10px 20px;
  margin-right: 10px;
  border-radius: 8px;
  cursor: pointer;
}

#modal-share:hover,
#modal-download:hover,
#modal-delete:hover {
  background: var(--accent);
  color: white;
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== File Preview ===== */
.file-preview {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 100px;
  height: 100px;
  background: center/cover no-repeat;
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 1000;
}

/* ===== Empty State ===== */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 20px;
}

/* ===== Site Footer ===== */
.footer {
  margin-top: auto;
  padding: 16px 20px;
  background: var(--bg);
  border-top: 2px solid var(--border);
  font-size: 13px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* Left: Social media */
.footer-left {
  display: flex;
  gap: 12px;
}

.footer-left a {
  color: var(--muted);
  text-decoration: none;
  transition: color var(--transition);
}

.footer-left a:hover {
  color: var(--accent);
}

/* Center: Branding */
.footer-center {
  text-align: center;
  flex: 1;
}

.footer-copy {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
}

/* Right: Links */
.footer-right {
  display: flex;
  gap: 12px;
}

.footer-right a {
  color: var(--muted);
  text-decoration: none;
  transition: color var(--transition);
}

.footer-right a:hover {
  color: var(--hover-link);
}

/* ===== Material Symbols Outlined ===== */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 20px; /* default */
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  vertical-align: middle;
  color: var(--accent);
  transition: var(--transition);
}

/* ===== Icon Size Utilities ===== */
.icon-xs { font-size: 14px; }
.icon-sm { font-size: 16px; }
.icon-md { font-size: 20px; } /* default */
.icon-lg { font-size: 24px; }
.icon-xl { font-size: 32px; }
.icon-2xl { font-size: 40px; }
.icon-3xl { font-size: 48px; }

/* ===== Media Queries ===== */
/* Mobile (≤768px) */
@media (max-width: 768px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-areas: "topbar" "main";
  }
  .sidebar {
    width: max-content;   /* fluid growth */
    min-width: 320px;
    max-width: 100vw;
    position: fixed;
    top: 58px;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.5s ease-in-out, width 0.5s linear, max-width 0.5s linear;
    z-index: 10;
  }
  .sidebar-open .sidebar {
    transform: translateX(0);
  }
  .sidebar-open .main {
    filter: blur(4px) brightness(0.7);
    pointer-events: none; /* prevent clicks behind sidebar */
    transition: filter 0.3s ease;
  }
  .btn.menu {
    display: inline-flex;
  }
  .files-view li {
    margin-bottom: 0.5rem;
    padding: 0.4rem 0.6rem;
    font-size: 14px;
  }
  .files-view a {
    font-size: 14px;
  }
  .files-view .meta {
    font-size: 14px;
  }
  .main {
    padding: 8px;
    padding-top: 8px;
  }
  .search {
    max-width: none;
    margin: 0 8px;
  }
  .search input {
    padding: 8px 70px 8px 40px;
    font-size: 12px;
  }
  .search .material-symbols-outlined {
    left: 12px;
    font-size: 18px;
  }
  .search .shortcut {
    right: 10px;
    font-size: 10px;
    padding: 2px 6px;
  }
  .brand strong {
    display: none;
  }
  body {
    font-size: 13px;
  }
}

/* Tablet (769px–1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-areas: "topbar" "main";
  }
  .sidebar {
    width: max-content; 
    min-width: 350px;
    max-width: 100vw;
    position: fixed;
    top: 58px;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.5s ease-in-out, width 0.5s linear, max-width 0.5s linear;
    z-index: 10;
  }
  .sidebar-open .sidebar {
    transform: translateX(0);
  }
  .sidebar-open .main {
    filter: blur(4px) brightness(0.7);
    pointer-events: none; /* prevent clicks behind sidebar */
    transition: filter 0.3s ease;
  }
  .btn.menu {
    display: inline-flex;
  }
  .files-view li {
    font-size: 16px;
  }
  .files-view a {
    font-size: 16px;
  }
  .files-view .meta {
    font-size: 16px;
  }
  .main {
    padding: 12px;
    padding-top: 12px;
  }
  .search {
    max-width: 500px;
    margin: 0 auto;
  }
  .search input {
    padding: 8px 70px 8px 40px;
    font-size: 13px;
  }
  body {
    font-size: 13px;
  }
}

/* Laptop (≥1280px) */
@media (min-width: 1280px) {
  .app {
    grid-template-columns: max-content 1fr; 
    grid-template-areas: "topbar topbar" "sidebar main";
  }
  .sidebar {
    width: max-content;
    min-width: 400px;
    max-width: 100vw;
    transform: none;
    position: static;
    z-index: 1;
    transition: width 0.5s linear, max-width 0.5s linear;
  }
  .btn.menu {
    display: none;
  }
  .files-view li {
    font-size: 18px;
  }
  .files-view a {
    font-size: 18px;
  }
  .files-view .meta {
    font-size: 18px;
  }
  .search {
    max-width: 600px;
    margin: 0 auto;
  }
  .search input {
    font-size: 14px;
  }
  body {
    font-size: 15px;
  }
}
