/* CSS Variables - Light Mode */
:root {
  --bg-primary: #f3f4f6;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e5e7eb;
  --bg-hover: #f9fafb;

  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;

  --border-color: #e5e7eb;
  --border-light: #f3f4f6;

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: #dbeafe;

  --success: #10b981;
  --success-light: #d1fae5;
  --success-dark: #059669;

  --danger: #ef4444;
  --danger-light: #fee2e2;
  --danger-dark: #dc2626;

  --warning: #f59e0b;
  --warning-light: #fef3c7;

  --dropbox: #0061fe;
  --onedrive: #0078d4;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

  color-scheme: light;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #030712;
    --bg-secondary: #111827;
    --bg-tertiary: #1f2937;
    --bg-hover: #1f2937;

    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #6b7280;

    --border-color: #374151;
    --border-light: #1f2937;

    --primary-light: #1e3a5f;
    --success-light: #064e3b;
    --danger-light: #7f1d1d;
    --warning-light: #78350f;

    color-scheme: dark;
  }
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden {
  display: none !important;
}

/* Loading State */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 1rem;
  background: var(--bg-primary);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Login Page - v2.15.14: Enhanced styling */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 50%, #1a1a2e 100%);
  background-size: 200% 200%;
  animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.login-card {
  background: rgba(30, 41, 59, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 3rem;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  text-align: center;
  max-width: 420px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
  color: var(--primary);
  margin-bottom: 1.5rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.login-card h1 {
  margin-bottom: 0.5rem;
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

.login-card p {
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
  font-size: 1rem;
}

/* Microsoft sign-in button */
.btn-microsoft {
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
  gap: 0.75rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.btn-microsoft:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

/* v3.0.0: Multi-auth login styles */
.login-card h2 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.login-divider {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.login-divider span {
  padding: 0 1rem;
}

.login-form {
  text-align: left;
}

.login-form .form-group {
  margin-bottom: 1.25rem;
}

.login-form .form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Password Requirements */
.password-requirements {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
}

.password-requirements p {
  margin: 0 0 0.5rem 0;
  color: var(--text-secondary);
  font-weight: 500;
}

.password-requirements ul {
  margin: 0;
  padding-left: 1.25rem;
  list-style: none;
}

.password-requirements .requirement {
  position: relative;
  padding-left: 0.25rem;
  margin-bottom: 0.25rem;
  color: var(--text-muted);
  transition: color var(--transition);
}

.password-requirements .requirement::before {
  content: "○";
  position: absolute;
  left: -1rem;
  color: var(--text-muted);
  transition: color var(--transition);
}

.password-requirements .requirement.valid {
  color: var(--success);
}

.password-requirements .requirement.valid::before {
  content: "●";
  color: var(--success);
}

.login-form .btn-large {
  width: 100%;
  margin-top: 0.5rem;
}

.login-hint {
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.forgot-password-link {
  display: block;
  margin-top: 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--primary);
  text-decoration: none;
}

.forgot-password-link:hover {
  text-decoration: underline;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  padding: 0;
  margin-bottom: 1.5rem;
}

.back-btn:hover {
  color: var(--text-primary);
}

.login-success {
  text-align: center;
  padding: 1rem 0;
}

.login-success svg {
  color: var(--success);
  margin-bottom: 1rem;
}

.login-success p {
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.auth-options,
.auth-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  margin-top: 1.5rem;
}

.auth-options .btn-large,
.auth-buttons .btn-large {
  width: 100%;
}

.btn-google {
  background: white;
  color: #333;
  border: 1px solid var(--border-color);
}

.btn-google:hover:not(:disabled) {
  background: #f8f9fa;
}

.btn-apple {
  background: #000;
  color: white;
}

.btn-apple:hover:not(:disabled) {
  background: #1a1a1a;
}

.error-icon {
  color: var(--danger);
  margin-bottom: 1rem;
}

.settings-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.settings-card-header h3 {
  margin: 0;
}

.settings-subsection {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.settings-subsection h4 {
  margin-bottom: 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.auth-badge.microsoft { color: #00a4ef; }
.auth-badge.google { color: #4285f4; }
.auth-badge.apple { color: var(--text-primary); }
.auth-badge.email { color: var(--text-secondary); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 1px 2px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

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

.btn-danger:hover:not(:disabled) {
  background: var(--danger-dark);
}

.btn-warning {
  background: #f59e0b;
  color: white;
}

.btn-warning:hover:not(:disabled) {
  background: #d97706;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: var(--success-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-large {
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

.btn-icon {
  padding: 0.5rem;
  width: 36px;
  height: 36px;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.5rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.version-badge {
  font-size: 0.65rem;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.header h1 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Connection Status */
.connection-status {
  display: flex;
  gap: 0.5rem;
}

.status-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  transition: all var(--transition);
  cursor: default;
}

.status-badge.connected {
  background: var(--success-light);
  color: var(--success);
}

.status-badge.disconnected {
  background: var(--danger-light);
  color: var(--danger);
}

/* User Menu */
.user-menu {
  position: relative;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-primary);
  transition: all var(--transition);
}

.user-menu-btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

.dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 100;
  overflow: hidden;
}

.dropdown a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: all var(--transition);
  font-size: 0.875rem;
}

.dropdown a:hover {
  background: var(--bg-tertiary);
}

.dropdown hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 0;
}

.dropdown-role {
  display: block;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

/* Navigation */
.nav {
  display: flex;
  gap: 0.25rem;
  padding: 0 1.5rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.nav-btn {
  padding: 0.875rem 1.25rem;
  background: none;
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
}

.nav-btn:hover {
  color: var(--text-primary);
}

.nav-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Content */
.content {
  padding: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.view-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 1rem;
}

/* Sync Card */
.sync-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
  transition: all 200ms ease;
  box-shadow: var(--shadow-sm);
}

.sync-card:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.1), 0 0 0 1px var(--primary);
  transform: translateY(-2px);
}

.sync-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.sync-card-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
}

.sync-card-status {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
}

.sync-card-status.active {
  background: var(--success-light);
  color: var(--success);
}

.sync-card-status.paused {
  background: var(--warning-light);
  color: var(--warning);
}

.sync-card-status.error {
  background: var(--danger-light);
  color: var(--danger);
}

.sync-card-status.syncing {
  background: var(--primary-light);
  color: var(--primary);
}

.sync-card-status.disabled {
  background: var(--danger-light);
  color: var(--danger);
}

/* Disabled sync card */
.sync-card.disabled {
  opacity: 0.6;
}

.sync-card.disabled:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
  border-color: var(--border-color);
}

/* Sync card header layout */
.sync-card-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  cursor: pointer;
}

.toggle-input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  transition: all var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  bottom: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--transition);
}

.toggle-input:checked + .toggle-slider {
  background: var(--success);
  border-color: var(--success);
}

.toggle-input:checked + .toggle-slider::before {
  background: white;
  transform: translateX(16px);
}

.toggle-switch:hover .toggle-slider {
  border-color: var(--text-muted);
}

.sync-card-body {
  padding: 1.25rem;
}

/* Sync Progress */
.sync-progress {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  animation: fadeIn var(--transition-slow);
}

.sync-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.sync-progress-bar {
  height: 6px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.sync-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: width var(--transition);
}

.sync-progress-file {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* Sync Paths */
.sync-paths {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-bottom: 1rem;
}

.sync-path {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.sync-path-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  flex-shrink: 0;
}

.sync-path-icon.dropbox {
  background: var(--primary-light);
  color: var(--dropbox);
}

.sync-path-icon.onedrive {
  background: var(--primary-light);
  color: var(--onedrive);
}

.sync-path-text {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-muted);
  padding: 0.25rem 0;
}

.sync-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
}

.sync-card-actions {
  display: flex;
  gap: 0.5rem;
}

.sync-card-actions .btn {
  flex: 1;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-color);
}

.empty-state svg {
  margin-bottom: 1rem;
  color: var(--text-muted);
  opacity: 0.5;
}

.empty-state p {
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
}

/* Tables */
.table-container {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.table th {
  background: var(--bg-tertiary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.table tr:last-child td {
  border-bottom: none;
}

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

.table td {
  font-size: 0.875rem;
  color: var(--text-primary);
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.label-optional {
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.form-hint-inline {
  display: block;
  margin-top: 0.375rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input[readonly] {
  background: var(--bg-tertiary);
  cursor: default;
}

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

.folder-picker {
  display: flex;
  gap: 0.5rem;
}

.folder-picker .input {
  flex: 1;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: normal;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: color var(--transition);
}

.checkbox-group label:hover {
  color: var(--text-primary);
}

.checkbox-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
}

.form-actions .btn {
  min-width: 100px;
}

.filters {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  z-index: 1000;
  animation: fadeIn 200ms ease-out;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  z-index: 1001;
  animation: scaleIn 200ms ease-out;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.modal-large {
  max-width: 800px;
}

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

.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
  border-radius: var(--radius);
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  max-height: calc(90vh - 70px);
}

/* Error Modal */
.error-header {
  background: var(--danger-light);
  border-bottom-color: var(--danger);
}

.error-header h3 {
  color: var(--danger);
}

.error-content {
  text-align: center;
  padding: 1rem 0;
}

.error-icon {
  color: var(--danger);
  margin-bottom: 1rem;
}

.error-content > p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.error-services {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.error-service-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  border-left: 3px solid var(--danger);
}

.error-service-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.error-service-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
}

.error-service-icon.dropbox {
  background: var(--primary-light);
  color: var(--dropbox);
}

.error-service-icon.onedrive {
  background: var(--primary-light);
  color: var(--onedrive);
}

.error-service-name {
  font-weight: 500;
  color: var(--text-primary);
}

.btn-connect {
  background: var(--primary);
  color: white;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
}

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

/* Folder Tree */
.folder-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.breadcrumb-item {
  color: var(--primary);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

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

.breadcrumb-item::after {
  content: '/';
  margin-left: 0.5rem;
  color: var(--text-muted);
}

.breadcrumb-item:last-child::after {
  display: none;
}

.folder-tree {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  max-height: 300px;
  overflow-y: auto;
  background: var(--bg-primary);
}

.folder-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: all var(--transition);
  font-size: 0.875rem;
  color: var(--text-primary);
}

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

.folder-item:last-child {
  border-bottom: none;
}

.folder-item.selected {
  background: var(--primary-light);
  color: var(--primary);
}

.folder-icon {
  color: var(--warning);
}

/* Tabs */
.details-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.tab-btn {
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
}

.tab-btn:hover {
  color: var(--text-primary);
}

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

.tab-content {
  min-height: 200px;
}

/* Role Badge */
.role-badge {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.role-badge.admin {
  background: var(--primary-light);
  color: var(--primary);
}

.role-badge.user {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

/* Select */
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 2000;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: slideIn var(--transition-slow);
  max-width: 400px;
}

.toast.success {
  border-left: 3px solid var(--success);
}

.toast.error {
  border-left: 3px solid var(--danger);
}

.toast.info {
  border-left: 3px solid var(--primary);
}

.toast-icon {
  flex-shrink: 0;
}

.toast-icon.success { color: var(--success); }
.toast-icon.error { color: var(--danger); }
.toast-icon.info { color: var(--primary); }

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
  margin-bottom: 0.125rem;
}

.toast-message {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.toast-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.toast.removing {
  animation: slideOut var(--transition-slow) forwards;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}

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

/* Focus States */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Responsive */
@media (max-width: 768px) {
  .header {
    padding: 0.75rem 1rem;
  }

  .content {
    padding: 1rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .view-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .filters {
    flex-wrap: wrap;
    width: 100%;
  }

  .filters .input {
    flex: 1;
    min-width: 120px;
  }

  .nav {
    padding: 0 1rem;
    overflow-x: auto;
  }

  .modal {
    width: 95%;
    max-height: 95vh;
  }

  .toast-container {
    left: 1rem;
    right: 1rem;
  }

  .toast {
    max-width: none;
  }
}

/* Dashboard - v2.9.0 */
.dashboard-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

/* v2.15.14: Enhanced summary cards with gradients */
.summary-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.summary-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0.08;
  z-index: 0;
}

.summary-card > * {
  position: relative;
  z-index: 1;
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Active card - green gradient */
.summary-card:has(.summary-icon.active) {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.05) 100%);
  border-color: rgba(16, 185, 129, 0.3);
}

/* Syncing card - blue gradient */
.summary-card:has(.summary-icon.syncing) {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.05) 100%);
  border-color: rgba(59, 130, 246, 0.3);
}

/* Paused card - yellow/amber gradient */
.summary-card:has(.summary-icon.paused) {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(245, 158, 11, 0.05) 100%);
  border-color: rgba(245, 158, 11, 0.3);
}

/* Error card - red gradient */
.summary-card:has(.summary-icon.error) {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(239, 68, 68, 0.05) 100%);
  border-color: rgba(239, 68, 68, 0.3);
}

.summary-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 12px;
}

.summary-icon.active {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.summary-icon.syncing {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.summary-icon.paused {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.summary-icon.error {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.summary-content {
  display: flex;
  flex-direction: column;
}

.summary-count {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.summary-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dashboard-section {
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  padding: 1.5rem;
}

.dashboard-section h3 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.health-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.health-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: var(--bg-primary);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  transition: border-color 0.2s;
}

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

.health-item.error {
  border-left: 4px solid var(--danger);
  background: var(--danger-light);
}

.health-item.warning {
  border-left: 4px solid var(--warning);
  background: var(--warning-light);
}

.health-item-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.health-status-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.health-status-icon.active {
  background: var(--success-light);
  color: var(--success);
}

.health-status-icon.syncing {
  background: var(--primary-light);
  color: var(--primary);
}

.health-status-icon.paused {
  background: var(--warning-light);
  color: var(--warning);
}

.health-status-icon.error {
  background: var(--danger-light);
  color: var(--danger);
}

.health-info h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.health-info p {
  margin: 0.25rem 0 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.health-item-right {
  text-align: right;
}

.health-last-sync {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.health-last-sync-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.health-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

/* v2.11.1: Clickable Error Card */
.summary-card.clickable {
  cursor: pointer;
}

.summary-card.clickable:hover {
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.2);
}

/* v2.11.1: Error Details Modal */
.error-pair-section {
  padding: 1rem;
  margin-bottom: 1rem;
  background: var(--bg-primary);
  border-radius: var(--radius);
  border-left: 4px solid var(--danger);
}

.error-pair-name {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.error-pair-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.error-events-list {
  margin: 0.75rem 0;
}

.error-event-item {
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.error-event-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.error-event-details {
  font-size: 0.875rem;
  color: var(--danger);
  word-break: break-word;
}

.error-event-file {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  font-family: monospace;
}

.error-no-details {
  padding: 0.75rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.error-pair-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* v2.15.0: Deleted Files & Storage Meter */
.storage-meter-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.storage-meter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.storage-meter-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.storage-percent {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.storage-meter {
  height: 12px;
  background: var(--bg-tertiary);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.storage-meter-fill {
  height: 100%;
  background: var(--success);
  border-radius: 6px;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.storage-meter-fill.warning {
  background: var(--warning);
}

.storage-meter-fill.critical {
  background: var(--danger);
}

.storage-meter-details {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.storage-meter-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.provider-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--radius-full);
}

.provider-badge.dropbox {
  background: var(--primary-light);
  color: var(--dropbox);
}

.provider-badge.onedrive {
  background: var(--primary-light);
  color: var(--onedrive);
}

.text-warning {
  color: var(--warning);
}

.text-muted {
  color: var(--text-muted);
}

.action-buttons {
  display: flex;
  gap: 0.5rem;
}

.btn-small {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  margin-top: 1rem;
}

#deleted-files-page-info {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* v2.12.3: Deleted Files - Folder UI */
.deleted-file-row {
  position: relative;
}

.deleted-file-row.folder-row {
  cursor: pointer;
}

.deleted-file-row.folder-row:hover {
  background: var(--bg-hover);
}

.deleted-file-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* v2.12.5: Better file info display */
.deleted-file-info {
  min-width: 0;
  flex: 1;
}

.deleted-file-title {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Path column styling */
.path-cell {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deleted-file-icon {
  flex-shrink: 0;
  color: var(--text-muted);
}

.deleted-file-icon.folder {
  color: var(--warning);
}

.deleted-file-icon.file {
  color: var(--primary);
}

.folder-expand-btn {
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: transform var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.folder-expand-btn:hover {
  color: var(--text-primary);
}

.folder-expand-btn.expanded {
  transform: rotate(90deg);
}

.folder-contents-row {
  background: var(--bg-tertiary);
}

.folder-contents-row td {
  padding: 0 !important;
}

.folder-contents-wrapper {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.folder-contents-wrapper.expanded {
  max-height: 500px;
  overflow-y: auto;
}

/* v2.12.5: Tree-style folder contents */
.folder-contents-tree {
  padding: 0.5rem 0 0.5rem 3rem;
  position: relative;
}

/* Vertical line connecting all items */
.folder-contents-tree::before {
  content: '';
  position: absolute;
  left: 2.5rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 1px;
  background: var(--border-color);
}

.folder-tree-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  position: relative;
  margin-left: 0.5rem;
}

.folder-tree-item:hover {
  background: var(--bg-hover);
  border-radius: var(--radius);
}

/* Tree connector characters */
.tree-connector {
  font-family: monospace;
  color: var(--border-color);
  font-size: 1rem;
  line-height: 1;
  user-select: none;
  margin-left: -0.5rem;
}

/* Horizontal line from connector to item */
.tree-line {
  width: 0.75rem;
  height: 1px;
  background: var(--border-color);
  flex-shrink: 0;
}

/* Hide vertical line below last item */
.folder-tree-item.last-item ~ .folder-contents-tree::before {
  display: none;
}

.folder-tree-item .deleted-file-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.folder-tree-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-tree-size {
  color: var(--text-muted);
  font-size: 0.75rem;
  min-width: 60px;
  text-align: right;
  flex-shrink: 0;
}

.folder-tree-empty {
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-style: italic;
}

/* Placeholder for empty folder expand button */
.folder-expand-placeholder {
  width: 24px;
  display: inline-block;
}

/* Checkboxes in deleted files table */
.deleted-files-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.deleted-files-header-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.deleted-files-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 1px solid var(--border-color);
}

.deleted-files-selection-info {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.deleted-files-bulk-actions {
  display: flex;
  gap: 0.5rem;
}

.deleted-files-bulk-actions .btn {
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
}

.deleted-files-bulk-actions .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Folder badge */
.folder-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  background: var(--warning-light);
  color: var(--warning);
  font-size: 0.7rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  margin-left: 0.5rem;
}

.file-count-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.375rem;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 0.7rem;
  border-radius: var(--radius-full);
  margin-left: 0.25rem;
}

/* v2.12.5: Distinct style for empty folders */
.file-count-badge.empty {
  background: transparent;
  border: 1px dashed var(--border-color);
  color: var(--text-muted);
  font-style: italic;
}

/* Restore selected items from folder */
.folder-restore-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}

/* Confirmation Modal - v2.12.6 */
.modal-confirm {
  max-width: 400px;
  z-index: 1100; /* Higher than other modals so it appears on top */
}

.modal-confirm .modal-body {
  padding: 1.5rem;
}

.modal-confirm #confirm-modal-message {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  white-space: pre-line;
}

.modal-confirm .form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.modal-confirm .btn-danger {
  background: var(--danger);
  color: white;
}

.modal-confirm .btn-danger:hover {
  background: #c82333;
}

/* ===========================================
   v2.13.0 - Dashboard Consolidation & Selective Sync
   =========================================== */

/* Section Header with Action Button */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.section-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-small {
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
}

/* Sync Pairs List Container */
.sync-pairs-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Expandable Sync Pair Row */
.sync-pair-row {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.sync-pair-row:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sync-pair-row.expanded {
  border-color: var(--primary);
}

/* Row Header (always visible) */
.sync-pair-header {
  display: flex;
  align-items: center;
  padding: 0.875rem 1rem;
  cursor: pointer;
  user-select: none;
  gap: 1rem;
  position: relative;
  z-index: 100;
  isolation: isolate;
}

.sync-pair-header:hover {
  background: var(--bg-tertiary);
}

.sync-pair-expand-icon {
  color: var(--text-muted);
  font-size: 0.875rem;
  transition: transform 0.2s ease;
  width: 16px;
  text-align: center;
}

.sync-pair-row.expanded .sync-pair-expand-icon {
  transform: rotate(90deg);
}

.sync-pair-info {
  flex: 1;
  min-width: 0;
}

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

.sync-pair-paths {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.sync-pair-paths .path {
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sync-pair-paths .arrow {
  color: var(--text-muted);
}

.sync-pair-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.sync-pair-last-sync {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.sync-pair-status-badge {
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
}

.sync-pair-status-badge.healthy {
  background: var(--success-light);
  color: var(--success);
}

.sync-pair-status-badge.warning {
  background: var(--warning-light);
  color: var(--warning);
}

.sync-pair-status-badge.error {
  background: var(--danger-light);
  color: var(--danger);
}

.sync-pair-status-badge.disabled {
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.sync-pair-status-badge.syncing {
  background: var(--info-light);
  color: var(--info);
}

/* v2.15.2: Redesigned Header Layout */
.sync-pair-name-section {
  min-width: 120px;
  max-width: 180px;
  flex-shrink: 0;
}

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

/* Platform Connections Row */
/* v2.15.7: Center platform connections on desktop */
.sync-pair-connections {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.platform-connection {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

/* v2.15.2: Larger platform icons */
.platform-icon {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  flex-shrink: 0;
}

.platform-icon.dropbox {
  background: rgba(0, 126, 229, 0.15);
  color: #007ee5;
}

.platform-icon.onedrive {
  background: rgba(3, 131, 194, 0.15);
  color: #0383c2;
}

.platform-icon svg {
  width: 22px;
  height: 22px;
}

/* v2.15.2: Larger Connection Status Dot */
.connection-dot {
  position: absolute;
  bottom: -3px;
  right: -3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}

.connection-dot.connected {
  background: var(--success);
}

.connection-dot.disconnected {
  background: var(--danger);
}

/* Clickable Path */
.platform-path {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.platform-path.clickable {
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.platform-path.clickable:hover {
  background: var(--bg-tertiary);
  color: var(--primary);
}

/* v2.15.2: Simplified Sync Direction Icon */
.sync-direction-icon {
  font-size: 1.25rem;
  color: var(--text-muted);
  padding: 0 0.25rem;
  cursor: default;
}

/* v2.15.3: Meta section (last sync + file count) */
.sync-pair-meta {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
  padding-left: 1rem;
  cursor: help;
}

/* v2.15.3: Short version visible on desktop, hidden on mobile */
.sync-pair-meta .sync-pair-last-sync-short {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* v2.15.3: Full version hidden on desktop, visible on mobile */
.sync-pair-meta .sync-pair-last-sync-full {
  display: none;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* v2.15.5: Sync Direction Dropdown */
.sync-direction-wrapper {
  position: relative;
  z-index: 100;
}

.sync-direction-icon {
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.sync-direction-icon:hover {
  background: var(--bg-tertiary);
  color: var(--primary);
}

/* v2.15.10: Use position fixed to escape all stacking contexts */
.sync-direction-dropdown {
  position: fixed;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 999999;
  min-width: 180px;
  padding: 0.5rem 0;
  display: none;
}

.sync-direction-dropdown.open {
  display: block;
}

.sync-direction-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background 0.15s ease;
  font-size: 0.875rem;
}

.sync-direction-option:hover {
  background: var(--bg-tertiary);
}

.sync-direction-option.active {
  color: var(--primary);
  font-weight: 500;
}

.sync-direction-option .option-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

/* v2.15.5: Path Browser Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  padding: 1rem;
}

.modal-overlay .modal-content {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.modal-overlay .modal-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.modal-overlay .modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  line-height: 1;
}

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

.modal-overlay .modal-body {
  padding: 1.5rem;
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.modal-overlay .modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
}

/* v2.15.7: Mobile modal responsive */
@media (max-width: 600px) {
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal-overlay .modal-content {
    max-width: 100%;
    max-height: 85vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .modal-overlay .modal-header {
    padding: 1rem;
  }

  .modal-overlay .modal-body {
    padding: 1rem;
  }

  .modal-overlay .modal-footer {
    padding: 1rem;
    position: sticky;
    bottom: 0;
    background: var(--bg-secondary);
  }
}

/* v2.15.7: Create folder input */
.create-folder-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.create-folder-row input {
  flex: 1;
}

.create-folder-row .btn {
  white-space: nowrap;
}

/* v2.15.5: Folder Browser Modal */
.current-path-display,
.selected-path-display {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
}

.current-path-display .label,
.selected-path-display .label {
  font-size: 0.875rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.current-path-display .path {
  font-family: monospace;
  color: var(--text-primary);
  word-break: break-all;
}

.selected-path-display input {
  flex: 1;
  font-family: monospace;
}

.folder-browser {
  flex: 1;
  min-height: 200px;
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-primary);
}

.folder-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s ease;
}

.folder-item:last-child {
  border-bottom: none;
}

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

.folder-item.parent {
  color: var(--text-muted);
}

.folder-item.select-current {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 500;
}

.folder-item.select-current:hover {
  background: var(--primary-light);
}

.folder-item.selected {
  background: var(--success-light);
  border-left: 3px solid var(--success);
}

.folder-icon {
  font-size: 1.25rem;
}

.folder-name {
  flex: 1;
  word-break: break-all;
}

.no-folders {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}

.loading-spinner {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}

/* v2.15.7: Folder browser loading state */
.folder-browser-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3rem;
  color: var(--text-muted);
}

.folder-browser-loading .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* v2.15.7: Small spinner for buttons */
.spinner-small {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-color);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 0.5rem;
  vertical-align: middle;
}

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

.error-message {
  padding: 1rem;
  text-align: center;
  color: var(--danger);
  background: var(--danger-light);
  border-radius: var(--radius);
}

/* v2.15.5: Clickable path styling */
.platform-path.clickable {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.platform-path.clickable:hover {
  color: var(--primary);
  text-decoration-style: solid;
}

/* v2.15.6: Mobile Responsive - Stack layout */
@media (max-width: 900px) {
  .sync-pair-header {
    flex-wrap: wrap;
    gap: 0.5rem;
    position: relative;
  }

  .sync-pair-row {
    position: relative;
  }

  /* v2.15.6: Row 1 - Arrow, Title, Status Icon - use flex-basis to force wrap */
  .sync-pair-expand-icon {
    order: 0;
    flex-shrink: 0;
  }

  .sync-pair-name-section {
    min-width: unset;
    max-width: unset;
    /* Take up remaining space on first row, forcing connections to wrap */
    flex: 1 1 calc(100% - 70px);
    order: 1;
  }

  .sync-pair-status-icon {
    order: 2;
    position: static;
    flex-shrink: 0;
  }

  /* v2.15.6: Row 2 - Platform connections (full width) */
  .sync-pair-connections {
    order: 3;
    width: 100%;
    flex-basis: 100%;
    min-width: 0;
    padding-top: 0.5rem;
    flex-shrink: 0;
  }

  /* v2.15.6: Row 3 - Full status text */
  .sync-pair-meta {
    order: 4;
    width: 100%;
    flex-basis: 100%;
    margin-left: 0;
    padding-left: 0;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    margin-top: 0.25rem;
    flex-shrink: 0;
  }

  /* v2.15.11: Show short version on mobile too (full details in expanded view) */
  .sync-pair-meta .sync-pair-last-sync-short {
    display: block;
  }

  .sync-pair-meta .sync-pair-last-sync-full {
    display: none;
  }

  .platform-path {
    max-width: 120px;
  }
}

/* Legacy - keep for compatibility */
.sync-direction-control {
  flex-shrink: 0;
}

.sync-direction-btn {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.5rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 1rem;
}

.sync-direction-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--primary);
}

.sync-direction-btn .direction-icon {
  font-size: 1.1rem;
  color: var(--text-primary);
}

.sync-direction-btn .direction-dropdown-arrow {
  font-size: 0.6rem;
  color: var(--text-muted);
}

/* Status Icon */
.sync-pair-status-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.sync-pair-status-icon.active {
  background: var(--success-light);
  color: var(--success);
}

.sync-pair-status-icon.paused {
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.sync-pair-status-icon.error {
  background: var(--danger-light);
  color: var(--danger);
}

/* Expanded Content */
.sync-pair-details {
  display: none;
  border-top: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.sync-pair-row.expanded .sync-pair-details {
  display: block;
}

.sync-pair-details-content {
  padding: 1rem;
}

/* Details Grid */
.sync-pair-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-value {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
}

.detail-value.path {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  word-break: break-all;
}

/* v2.15.12: Last Sync Summary - single row with time, status, and stats */
.last-sync-summary {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
}

.last-sync-datetime {
  color: var(--text-muted);
}

.last-sync-status-badge {
  font-weight: 600;
}

.last-sync-status-badge.success { color: var(--success); }
.last-sync-status-badge.partial { color: var(--warning); }
.last-sync-status-badge.failed { color: var(--danger); }

.last-sync-stat {
  font-weight: 500;
}

.last-sync-stat.added { color: var(--success); }
.last-sync-stat.modified { color: var(--info); }
.last-sync-stat.deleted { color: var(--danger); }

/* v2.15.8: No sync yet message */
.no-sync-yet {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

/* Actions Bar */
.sync-pair-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.sync-pair-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.8rem;
  white-space: nowrap;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s ease;
}

.sync-pair-actions .btn svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.sync-pair-actions .btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.sync-pair-actions .btn-secondary:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.sync-pair-actions .btn-warning {
  background: var(--warning);
  color: white;
  border: none;
}

.sync-pair-actions .btn-warning:hover {
  filter: brightness(1.1);
}

.sync-pair-actions .btn-danger {
  background: var(--danger);
  color: white;
  border: none;
}

.sync-pair-actions .btn-danger:hover {
  filter: brightness(1.1);
}

/* Invite Actions */
.invite-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.invite-actions .btn-small {
  white-space: nowrap;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

/* Selective Sync Modal */
.selective-sync-modal .modal-content {
  max-width: 700px;
}

.selective-sync-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  min-height: 350px;
}

.folder-browser-panel,
.excluded-folders-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.panel-header {
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

/* Folder Tree */
.folder-tree {
  font-size: 0.85rem;
}

.folder-tree-item {
  display: flex;
  align-items: center;
  padding: 0.375rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  gap: 0.5rem;
}

.folder-tree-item:hover {
  background: var(--bg-tertiary);
}

.folder-tree-item.loading {
  color: var(--text-muted);
  font-style: italic;
}

.folder-tree-item .folder-expand {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.folder-tree-item .folder-icon {
  color: var(--warning);
}

.folder-tree-item .folder-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-tree-item .exclude-btn {
  opacity: 0;
  padding: 0.125rem 0.5rem;
  font-size: 0.7rem;
  background: var(--danger-light);
  color: var(--danger);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.folder-tree-item:hover .exclude-btn {
  opacity: 1;
}

.folder-tree-children {
  margin-left: 1.25rem;
  display: none;
}

.folder-tree-children.expanded {
  display: block;
}

/* Excluded Folders List */
.excluded-folders-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.excluded-folder-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  gap: 0.5rem;
}

.excluded-folder-item .folder-icon {
  color: var(--text-muted);
}

.excluded-folder-item .folder-path {
  flex: 1;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.excluded-folder-item .remove-btn {
  padding: 0.125rem 0.375rem;
  font-size: 0.7rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.excluded-folder-item .remove-btn:hover {
  background: var(--danger-light);
  color: var(--danger);
  border-color: var(--danger);
}

.excluded-empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* v2.13.0: Additional Selective Sync Styles */
.folder-browser-section,
.excluded-folders-section {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.folder-browser-section h4,
.excluded-folders-section h4 {
  padding: 0.75rem 1rem;
  margin: 0;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
  font-weight: 600;
}

.excluded-count {
  font-weight: 400;
  color: var(--text-muted);
}

.folder-browser-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
}

.folder-browser-tabs .tab-btn {
  flex: 1;
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.folder-browser-tabs .tab-btn:hover {
  background: var(--bg-tertiary);
}

.folder-browser-tabs .tab-btn.active {
  background: var(--bg-primary);
  color: var(--primary);
  font-weight: 500;
  border-bottom: 2px solid var(--primary);
}

.folder-breadcrumb {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}

.breadcrumb-item {
  cursor: pointer;
}

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

.breadcrumb-item.active {
  color: var(--text-primary);
  font-weight: 500;
}

#selective-sync-tree {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  max-height: 300px;
}

.folder-tree-item.excluded {
  opacity: 0.6;
}

.excluded-badge {
  font-size: 0.7rem;
  padding: 0.125rem 0.5rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

.empty-hint {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
}

.modal-description {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* Events Modal Filters */
.events-filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}

.events-filters select {
  min-width: 150px;
}

.input-small {
  padding: 0.375rem 0.75rem;
  font-size: 0.85rem;
}

/* Events Modal */
.events-modal .modal-content {
  max-width: 800px;
}

.events-list {
  max-height: 400px;
  overflow-y: auto;
}

.event-item {
  display: flex;
  align-items: flex-start;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  gap: 0.75rem;
}

.event-item:last-child {
  border-bottom: none;
}

.event-icon {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.event-icon.success {
  background: var(--success-light);
  color: var(--success);
}

.event-icon.error {
  background: var(--danger-light);
  color: var(--danger);
}

.event-icon.warning {
  background: var(--warning-light);
  color: var(--warning);
}

.event-icon.info {
  background: var(--info-light);
  color: var(--info);
}

.event-content {
  flex: 1;
  min-width: 0;
}

.event-message {
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.event-timestamp {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.event-details {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Exclusions Modal */
.exclusions-modal .modal-content {
  max-width: 600px;
}

.exclusion-patterns-container {
  margin-bottom: 1rem;
}

.exclusion-pattern-input {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.exclusion-pattern-input input {
  flex: 1;
}

.exclusion-patterns-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  max-height: 200px;
  overflow-y: auto;
}

.exclusion-pattern-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  gap: 0.5rem;
}

.exclusion-pattern-item .pattern {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.exclusion-pattern-item .remove-btn {
  padding: 0.125rem 0.375rem;
  font-size: 0.7rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.exclusion-pattern-item .remove-btn:hover {
  background: var(--danger-light);
  color: var(--danger);
  border-color: var(--danger);
}

.exclusion-help {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  margin-top: 1rem;
}

.exclusion-help code {
  background: var(--bg-tertiary);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* Add Sync Pair Wizard Modal */
.wizard-modal .modal-content {
  max-width: 600px;
}

.wizard-steps {
  display: flex;
  justify-content: center;
  padding: 1rem 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.wizard-step.active {
  color: var(--primary);
  font-weight: 600;
}

.wizard-step.completed {
  color: var(--success);
}

.wizard-step-number {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
}

.wizard-step.active .wizard-step-number {
  background: var(--primary);
  color: white;
}

.wizard-step.completed .wizard-step-number {
  background: var(--success);
  color: white;
}

.wizard-step-connector {
  width: 40px;
  height: 2px;
  background: var(--border-color);
}

.wizard-step.completed + .wizard-step-connector {
  background: var(--success);
}

.wizard-content {
  min-height: 250px;
}

.wizard-page {
  display: none;
}

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

.wizard-actions {
  display: flex;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  margin-top: 1rem;
}

.wizard-actions .btn-group {
  display: flex;
  gap: 0.5rem;
}

/* Folder Picker for Wizard */
.folder-picker {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-top: 0.5rem;
}

.folder-picker-header {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  gap: 0.5rem;
}

.folder-picker-path {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-picker-content {
  max-height: 200px;
  overflow-y: auto;
  padding: 0.5rem;
}

/* Progress Indicator */
.sync-progress {
  margin-top: 0.5rem;
}

.sync-progress-bar {
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.sync-progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
}

.sync-progress-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ===========================================
   v2.15.16 - Settings Page with Tabs
   =========================================== */

/* Settings Tabs Container */
.settings-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0 0 1rem 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.settings-tab-btn {
  padding: 0.625rem 1.25rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.settings-tab-btn:hover:not(.active) {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.settings-tab-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Admin-only indicator */
.settings-tab-btn.admin-only::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--warning);
  border-radius: 50%;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* Settings Tab Content Panels */
.settings-tab-content {
  display: none;
}

.settings-tab-content.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

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

/* Connection Cards */
.connection-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.connection-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all 0.2s ease;
}

.connection-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.connection-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.connection-card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  flex-shrink: 0;
}

.connection-card-icon.dropbox {
  background: rgba(0, 97, 254, 0.15);
  color: var(--dropbox);
}

.connection-card-icon.onedrive {
  background: rgba(0, 120, 212, 0.15);
  color: var(--onedrive);
}

.connection-card-icon svg {
  width: 28px;
  height: 28px;
}

.connection-card-info {
  flex: 1;
  min-width: 0;
}

.connection-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 0.25rem 0;
}

.connection-card-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.connection-card-status.connected {
  color: var(--success);
}

.connection-card-status.disconnected {
  color: var(--text-muted);
}

.connection-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.connection-status-dot.connected {
  background: var(--success);
}

.connection-status-dot.disconnected {
  background: var(--text-muted);
}

.connection-card-account {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.5rem 0 1rem 0;
  padding: 0.5rem 0.75rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  word-break: break-all;
}

.connection-card-actions {
  display: flex;
  gap: 0.5rem;
}

/* Settings Cards */
.settings-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.settings-card h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.settings-card .settings-description {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

/* v3.0.3: SMTP Status Indicator */
.smtp-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.smtp-status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.smtp-status-indicator.checking {
  background: var(--warning);
  animation: pulse 1.5s infinite;
}

.smtp-status-indicator.configured {
  background: var(--success);
}

.smtp-status-indicator.not-configured {
  background: var(--text-muted);
}

.smtp-status-indicator.error {
  background: var(--danger);
}

.smtp-status-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Form row for side-by-side fields */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.settings-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.settings-card-header h3 {
  margin: 0;
}

.settings-card-header .filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Settings Section Headers */
.settings-section {
  margin-bottom: 2rem;
}

.settings-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.settings-section-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.settings-section-description {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

/* Mobile: Stack connection cards */
@media (max-width: 640px) {
  .settings-tabs {
    gap: 0.375rem;
  }

  .settings-tab-btn {
    padding: 0.5rem 0.875rem;
    font-size: 0.8rem;
  }

  .connection-cards {
    grid-template-columns: 1fr;
  }

  .connection-card {
    padding: 1rem;
  }

  .connection-card-icon {
    width: 40px;
    height: 40px;
  }

  .connection-card-icon svg {
    width: 24px;
    height: 24px;
  }

  .connection-card-actions {
    flex-direction: column;
  }

  .connection-card-actions .btn {
    width: 100%;
  }
}

/* Print styles */
@media print {
  .header, .nav, .btn, .modal-backdrop, .modal, .toast-container {
    display: none !important;
  }

  .content {
    padding: 0;
    max-width: none;
  }

  body {
    background: white;
    color: black;
  }
}
