/* Modern Dashboard CSS - Dark Mode */
:root {
  /* Colors */
  --bg-body: #0f172a;
  /* Slate 900 */
  --bg-sidebar: #1e293b;
  /* Slate 800 */
  --bg-card: #1e293b;
  /* Slate 800 */
  --bg-input: #334155;
  /* Slate 700 */

  --text-main: #f8fafc;
  /* Slate 50 */
  --text-muted: #94a3b8;
  /* Slate 400 */

  --primary: #6366f1;
  /* Indigo 500 */
  --primary-hover: #4f46e5;
  /* Indigo 600 */
  --primary-light: rgba(99, 102, 241, 0.1);

  --danger: #ef4444;
  /* Red 500 */
  --success: #22c55e;
  /* Green 500 */
  --warning: #f59e0b;
  /* Amber 500 */

  --border-color: #334155;
  /* Slate 700 */
  --border-radius: 0.75rem;
  /* 12px */

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --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);

  --sidebar-width: 260px;
  --header-height: 64px;
}

/* Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

ul {
  list-style: none;
}

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

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

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: center;
  /* Center horizontally */
  padding: 0 1.5rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
}

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-logo img {
  height: 48px;
  /* Increased from 32px */
  width: auto;
}

.sidebar-nav {
  padding: 1.5rem;
  flex: 1;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius);
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-weight: 500;
  transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
  background-color: var(--primary);
  color: white;
  box-shadow: var(--shadow-md);
}

.nav-link svg {
  width: 20px;
  height: 20px;
}

.sidebar-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius);
}

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

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

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 2rem;
  max-width: 1400px;
  width: 100%;
}

.page-header {
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  /* To accommodate back button generally */
  align-items: center;
}

.page-title {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text-main);
}

.page-subtitle {
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Cards */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
}

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

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

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  color: var(--text-main);
  font-size: 1rem;
  transition: border-color 0.2s, ring 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

textarea.form-control {
  min-height: 150px;
  resize: vertical;
}

/* Date Input Styling for Safari/Webkit */
input[type="date"] {
  color-scheme: dark;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  /* Pill shape */
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  gap: 0.5rem;
}

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

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  background-color: #475569;
}

.btn-block {
  width: 100%;
}

/* Upload Box */
.upload-area {
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius);
  background-color: rgba(255, 255, 255, 0.02);
  padding: 2rem;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
}

.upload-area:hover {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

/* Alerts */
.alert {
  padding: 1rem;
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
  border: 1px solid transparent;
}

.alert-success {
  background-color: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

.alert-error {
  background-color: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

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

.mt-4 {
  margin-top: 1rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.d-flex {
  display: flex;
}

.align-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: 0.5rem;
}

/* Preview Grid for Thumbnails */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.preview-item {
  position: relative;
  display: block;
  aspect-ratio: 1;
  /* Square thumbnails */
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: #000;
  transition: transform 0.2s, border-color 0.2s;
}

.preview-item:hover {
  transform: scale(1.02);
  border-color: var(--primary);
  cursor: pointer;
}

.preview-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Crop to fill square */
  display: block;
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 1.5rem;
  cursor: pointer;
}

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

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

  .main-content {
    margin-left: 0;
    padding: 1.5rem;
  }

  .menu-toggle {
    display: block;
    margin-right: 1rem;
  }


}

/* Uppy Overrides for Dark Mode */
.uppy-Dashboard-inner {
  width: 100% !important;
  height: 470px !important;
  border: 1px solid var(--border-color) !important;
  background-color: var(--bg-card) !important;
  z-index: 100 !important;
}

[data-uppy-theme="dark"] .uppy-Dashboard-inner {
  background-color: var(--bg-card) !important;
  border-color: var(--border-color) !important;
}

.uppy-Dashboard-AddFiles-title {
  color: var(--text-main) !important;
}

.uppy-StatusBar {
  border-top: 1px solid var(--border-color);
}

.uppy-Dashboard-Item-previewInner,
.uppy-Dashboard-Item-previewInner img,
.uppy-Dashboard-Item-previewInner video {
  cursor: pointer !important;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

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

.modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}

.modal-content img,
.modal-content video {
  max-width: 100%;
  max-height: 90vh;
  display: block;
  border-radius: 8px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
}

.modal-close {
  position: absolute;
  top: -40px;
  right: 0;
  color: white;
  font-size: 32px;
  cursor: pointer;
  background: none;
  border: none;
  z-index: 10001;
}

/* Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-left-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

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

/* Progress Bar Indeterminate Animation */
.sending-progress-fill.indeterminate {
  position: relative;
  width: 100% !important;
  background: transparent;
}

.sending-progress-fill.indeterminate::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--primary);
  animation: indeterminate 2s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
}

@keyframes indeterminate {
  0% {
    left: -35%;
    right: 100%;
  }

  60% {
    left: 100%;
    right: -90%;
  }

  100% {
    left: 100%;
    right: -90%;
  }
}