/* ========================================================
   TADrive - Google Drive Aesthetic Style
   Domain: drive.yourdomain.com
   ======================================================== */

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

:root {
  --primary: #1a73e8;
  --primary-hover: #1557b0;
  --primary-light: #e8f0fe;
  --primary-glow: rgba(26, 115, 232, 0.2);
  --success: #0f9d58;
  --warning: #f4b400;
  --danger: #d93025;
  --danger-light: #fce8e6;

  --bg-main: #f8fafd;
  --bg-surface: #ffffff;
  --bg-sidebar: #f1f3f4;
  --bg-hover: #e8eaed;
  --bg-active: #e8f0fe;

  --text-main: #202124;
  --text-muted: #5f6368;
  --text-disabled: #80868b;
  --border-color: #dadce0;

  --sidebar-width: 256px;
  --topbar-height: 64px;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 3px rgba(60,64,67,0.15);
  --shadow-md: 0 4px 12px rgba(60,64,67,0.15);
  --shadow-lg: 0 8px 24px rgba(60,64,67,0.2);

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] {
  --primary: #8ab4f8;
  --primary-hover: #aecbfa;
  --primary-light: rgba(138, 180, 248, 0.15);
  --primary-glow: rgba(138, 180, 248, 0.25);
  
  --bg-main: #131314;
  --bg-surface: #1e1f20;
  --bg-sidebar: #191a1b;
  --bg-hover: #282a2c;
  --bg-active: rgba(138, 180, 248, 0.18);

  --text-main: #e3e3e3;
  --text-muted: #9aa0a6;
  --text-disabled: #5f6368;
  --border-color: #3c4043;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.6);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ========================================================
   TOPBAR
   ======================================================== */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  width: var(--sidebar-width);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-main);
  text-decoration: none;
  cursor: pointer;
}

.brand-logo svg {
  width: 32px;
  height: 32px;
}

.topbar-center {
  flex: 1;
  max-width: 720px;
  margin: 0 24px;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-sidebar);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  padding: 8px 16px;
  transition: all 0.2s ease;
}

.search-box:focus-within {
  background: var(--bg-surface);
  border-color: var(--primary);
  box-shadow: 0 1px 6px var(--primary-glow);
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  margin-left: 10px;
  font-size: 15px;
  color: var(--text-main);
}

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

.icon-btn {
  background: transparent;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.15s ease;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: var(--radius-lg);
  background: var(--bg-sidebar);
  cursor: pointer;
  border: 1px solid var(--border-color);
  transition: all 0.2s;
}

.user-badge:hover {
  background: var(--bg-hover);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.user-name {
  font-size: 14px;
  font-weight: 500;
}

/* ========================================================
   MAIN CONTAINER (SIDEBAR + CONTENT)
   ======================================================== */
.app-container {
  display: flex;
  flex: 1;
  height: calc(100vh - var(--topbar-height));
  overflow: hidden;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-main);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--border-color);
  flex-shrink: 0;
}

.btn-new-dropdown {
  position: relative;
  margin-bottom: 20px;
}

.btn-new {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 14px 24px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  width: auto;
}

.btn-new:hover {
  box-shadow: var(--shadow-md);
  background: var(--bg-hover);
}

.new-menu {
  position: absolute;
  top: 56px;
  left: 0;
  width: 220px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  display: none;
  flex-direction: column;
  z-index: 200;
  padding: 6px 0;
}

.new-menu.show {
  display: flex;
}

.new-menu-item {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-main);
}

.new-menu-item:hover {
  background: var(--bg-hover);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.nav-item.active {
  background: var(--bg-active);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-storage {
  padding: 16px 12px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.storage-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.storage-bar-bg {
  width: 100%;
  height: 6px;
  background: var(--bg-hover);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.storage-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  width: 0%;
  transition: width 0.3s ease;
}

.storage-text {
  font-size: 12px;
  color: var(--text-main);
  font-weight: 500;
}

/* WORKSPACE AREA */
.workspace {
  flex: 1;
  background: var(--bg-surface);
  margin: 12px 16px 16px 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

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

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 500;
  color: var(--text-main);
}

.breadcrumb-item {
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.15s;
}

.breadcrumb-item:hover {
  color: var(--primary);
}

.breadcrumb-item.active {
  color: var(--text-main);
  font-weight: 600;
  cursor: default;
}

.workspace-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.workspace-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  position: relative;
}

/* DROPZONE OVERLAY */
.dropzone-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(26, 115, 232, 0.1);
  border: 3px dashed var(--primary);
  border-radius: var(--radius-md);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  backdrop-filter: blur(4px);
}

.dropzone-overlay.active {
  display: flex;
}

.dropzone-message {
  background: var(--bg-surface);
  padding: 24px 36px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 12px;
}

/* SECTION TITLES */
.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* GRID VIEW */
.folders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.folder-card {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.folder-card:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.folder-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.folder-card-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.file-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  position: relative;
  box-shadow: var(--shadow-sm);
}

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

.file-preview-area {
  height: 130px;
  background: var(--bg-sidebar);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  position: relative;
}

.file-preview-area img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-preview-area svg {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
}

.file-info-area {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
}

.file-meta {
  overflow: hidden;
  flex: 1;
  margin-right: 8px;
}

.file-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
  margin-bottom: 4px;
}

.file-size {
  font-size: 11px;
  color: var(--text-muted);
}

/* LIST VIEW (TABLE) */
.files-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.files-table th {
  text-align: left;
  padding: 10px 16px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
}

.files-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.files-table tr:hover td {
  background: var(--bg-hover);
}

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

.empty-state svg {
  width: 72px;
  height: 72px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 6px;
}

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

/* ========================================================
   FLOATING UPLOAD MANAGER (BOTTOM-RIGHT - GOOGLE DRIVE STYLE)
   ======================================================== */
.upload-manager {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 360px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  overflow: hidden;
  display: none;
  flex-direction: column;
  animation: slideUp 0.25s ease;
}

.upload-manager.show {
  display: flex;
}

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

.upload-manager-header {
  background: var(--bg-sidebar);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
}

.upload-manager-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.upload-manager-body {
  padding: 16px;
  max-height: 240px;
  overflow-y: auto;
}

.upload-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.upload-item-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.upload-item-name {
  font-weight: 500;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 220px;
}

.upload-item-stats {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.upload-item-progress-bg {
  width: 100%;
  height: 5px;
  background: var(--bg-hover);
  border-radius: 4px;
  overflow: hidden;
}

.upload-item-progress-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.15s ease;
}

/* ========================================================
   MODALS & POPUPS
   ======================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.show {
  display: flex;
}

.modal-card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 520px;
  overflow: hidden;
  animation: zoomIn 0.2s ease;
}

@keyframes zoomIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

.modal-title {
  font-size: 17px;
  font-weight: 600;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: var(--bg-sidebar);
}

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

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-input, .form-select {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-sidebar);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

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

.btn-danger:hover {
  opacity: 0.9;
}

/* ========================================================
   AUTH PAGE (LOGIN / REGISTER)
   ======================================================== */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
  padding: 20px;
}

.auth-card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
}

.auth-brand h2 {
  font-size: 22px;
  font-weight: 700;
}

.auth-brand p {
  font-size: 13px;
  color: var(--text-muted);
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.auth-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ========================================================
   ADMIN DASHBOARD VIEW
   ======================================================== */
.admin-grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-card-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
}

.stat-card-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.switch-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-main);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  margin-bottom: 16px;
}

/* TOGGLE SWITCH */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: .3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar {
    position: absolute;
    left: -260px;
    top: var(--topbar-height);
    bottom: 0;
    z-index: 300;
    background: var(--bg-surface);
    box-shadow: var(--shadow-lg);
    transition: left 0.3s ease;
  }
  .sidebar.open {
    left: 0;
  }
  .topbar-center {
    display: none;
  }
  .workspace {
    margin: 8px;
  }
  .upload-manager {
    width: 90%;
    right: 5%;
    left: 5%;
  }
}
