* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --danger-color: #dc2626;
  --danger-hover: #b91c1c;
  --success-color: #16a34a;
  --bg-color: #f3f4f6;
  --card-bg: #ffffff;
  --text-color: #1f2937;
  --text-muted: #6b7280;
  --border-color: #e5e7eb;
  --sidebar-bg: #1f2937;
  --sidebar-text: #e5e7eb;
}

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

/* Login Page */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #003d82 0%, #1a5fa0 50%, #0d2847 100%);
  position: relative;
  overflow: hidden;
}

/* Decorative background elements */
.login-bg-accent {
  position: absolute;
  border-radius: 50%;
  opacity: 0.1;
  animation: float 6s ease-in-out infinite;
}

.accent-1 {
  width: 400px;
  height: 400px;
  background: white;
  top: -100px;
  right: -100px;
  animation-delay: 0s;
}

.accent-2 {
  width: 300px;
  height: 300px;
  background: white;
  bottom: -50px;
  left: -100px;
  animation-delay: 2s;
}

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

.login-container {
  width: 100%;
  max-width: 480px;
  padding: 20px;
  position: relative;
  z-index: 10;
}

.login-card {
  background: var(--card-bg);
  border-radius: 24px;
  padding: 60px 50px;
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.25),
    0 0 1px 0px rgba(255, 255, 255, 0.1) inset;
  animation: slideUp 0.6s ease-out;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

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

.logo-container {
  text-align: center;
  margin-bottom: 40px;
}

.logo {
  max-width: 200px;
  height: auto;
  display: inline-block;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.12));
  transition: transform 0.3s ease;
}

.logo-container:hover .logo {
  transform: scale(1.08);
}

.login-title {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 40px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* Enhanced login form styling */
.login-form-group {
  margin-bottom: 24px;
}

.login-form-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-color);
  margin-bottom: 8px;
}

.login-form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  transition: all 0.3s ease;
  background: #fafbfc;
}

.login-form-group input::placeholder {
  color: #d1d5db;
}

.login-form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  background: white;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

.login-form-group input:hover:not(:focus) {
  border-color: #d1d5db;
}

/* Error message styling */
.error-message {
  background: linear-gradient(135deg, #fee 0%, #fef 100%);
  border-left: 4px solid var(--danger-color);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 24px;
  color: #991b1b;
  font-size: 14px;
  font-weight: 500;
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Enhanced button styling */
.btn-login {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--primary-color) 0%, #1d4ed8 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px -3px rgba(37, 99, 235, 0.3);
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-login:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 20px -5px rgba(37, 99, 235, 0.4);
  background: linear-gradient(135deg, #1d4ed8 0%, #1e3a8a 100%);
}

.btn-login:active:not(:disabled) {
  transform: translateY(0);
}

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

.btn-text {
  display: inline;
}

.btn-loader {
  display: none;
  font-size: 16px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Login footer */
.login-footer {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.login-help {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0;
}

/* Dashboard Layout */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-header h2 {
  font-size: 20px;
}

.sidebar-logo {
  max-width: 120px;
  height: auto;
  display: block;
  filter: brightness(0) invert(1);
  transition: transform 0.3s ease;
}

.sidebar-logo:hover {
  transform: scale(1.05);
}

.sidebar-nav {
  flex: 1;
  padding: 20px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: background-color 0.2s;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.nav-item.active {
  background-color: var(--primary-color);
  border-left: 3px solid #60a5fa;
}

.nav-item .icon {
  margin-right: 12px;
  font-size: 20px;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
  margin-bottom: 12px;
}

.user-info p {
  color: var(--sidebar-text);
  font-size: 14px;
}

.text-sm {
  font-size: 12px;
  color: rgba(229, 231, 235, 0.7);
}

/* Main Content */
.main-content {
  margin-left: 260px;
  flex: 1;
  padding: 32px;
  width: calc(100% - 260px);
}

.content-header {
  margin-bottom: 32px;
}

.content-header h1 {
  font-size: 32px;
  font-weight: 700;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

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

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
  min-height: 120px;
  resize: vertical;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-group input[type="checkbox"] {
  width: auto;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}

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

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

/* Full-width primary buttons only in login card */
.login-card .btn-primary {
  width: 100%;
}

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

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

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

.btn-outline {
  background-color: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--sidebar-text);
  width: 100%;
}

.btn-outline:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

/* Stats Cards */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.stats-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stats-icon {
  font-size: 32px;
}

.stats-content h3 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

.stats-content p {
  color: var(--text-muted);
  font-size: 14px;
}

/* Quick Actions */
.quick-actions {
  margin-top: 40px;
}

.quick-actions h2 {
  margin-bottom: 20px;
  font-size: 24px;
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.action-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  text-decoration: none;
  color: var(--text-color);
  transition: transform 0.2s, box-shadow 0.2s;
}

.action-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.action-icon {
  font-size: 36px;
  display: block;
  margin-bottom: 12px;
}

.action-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.action-card p {
  color: var(--text-muted);
  font-size: 14px;
}

/* Table */
.table-container {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

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

.table-header h2 {
  font-size: 20px;
}

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

thead th {
  background-color: var(--bg-color);
  padding: 12px 24px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-muted);
}

tbody td {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
}

tbody tr:hover {
  background-color: var(--bg-color);
}

.table-actions {
  display: flex;
  gap: 8px;
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.badge-success {
  background-color: #d1fae5;
  color: #065f46;
}

.badge-warning {
  background-color: #fef3c7;
  color: #92400e;
}

/* Error Message */
.error-message {
  background-color: #fee2e2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 20px;
}

.success-message {
  background-color: #d1fae5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 20px;
}

/* Image Preview */
.image-preview {
  margin-top: 12px;
}

.image-preview img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.file-upload-btn {
  display: inline-block;
  padding: 10px 20px;
  background-color: var(--primary-color);
  color: white;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}

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

.file-upload-btn input[type="file"] {
  display: none;
}

/* Media Grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  padding: 24px;
}

.media-item {
  background: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.media-item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.folder-item {
  border: 2px dashed var(--border-color);
  background: var(--bg-color);
}

.folder-draggable.drag-over {
  outline: 2px dashed var(--primary-color);
  outline-offset: -2px;
}

.folder-draggable.dragging {
  opacity: 0.6;
}

.folder-icon {
  width: 100%;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  color: var(--text-muted);
  background: var(--bg-color);
}

.media-info {
  padding: 12px;
}

.media-info p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: var(--card-bg);
  border-radius: 12px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

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

.modal-header h2 {
  font-size: 24px;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 32px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background-color 0.2s;
}

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

.modal-content form {
  padding: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.modal-actions .btn {
  width: auto;
}

/* Content header with button */
.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.content-header .btn {
  width: auto;
}

/* Small text helper */
.form-group small {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 13px;
}

/* Upload area */
.upload-area {
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  padding: 40px;
  margin: 2px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background-color: var(--bg-color);
  display: block;
  position: relative;
  box-sizing: border-box;
}

.upload-area:hover {
  border-color: var(--primary-color);
  background-color: rgba(37, 99, 235, 0.05);
}

.upload-area input[type="file"] {
  display: none;
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

/* Breadcrumb */
.breadcrumb-item {
  display: inline-block;
  color: var(--primary-color);
  cursor: pointer;
}

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

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    position: relative;
    height: auto;
  }
  
  .main-content {
    margin-left: 0;
    width: 100%;
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    max-width: 100%;
    margin: 0;
  }

  .content-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .content-header .btn {
    width: 100%;
  }
}
