:root {
  --bg-primary: #0a0c16;
  --bg-secondary: #121424;
  --bg-glass: rgba(18, 20, 36, 0.75);
  --border-glass: rgba(255, 255, 255, 0.08);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.18);
  
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  
  --font-sans: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  background: radial-gradient(circle at 50% 0%, #171630 0%, #0a0c16 100%);
  color: var(--text-primary);
  font-family: var(--font-sans);
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Glassmorphism utility */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  box-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.5);
}

.hidden {
  display: none !important;
}

/* Utility Animations */
.animate-fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}

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

/* Toast Notifications */
.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-weight: 500;
  z-index: 9999;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  transform: translateY(-20px);
  opacity: 0;
  transition: var(--transition);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

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

/* Login Page Styling */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 24px;
  background: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.12) 0%, transparent 45%),
              radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 45%);
}

.login-box {
  width: 100%;
  max-width: 440px;
  padding: 40px;
  border-radius: var(--radius-lg);
  text-align: center;
}

.login-header {
  margin-bottom: 36px;
}

.login-header .logo {
  color: var(--primary);
  margin-bottom: 16px;
  display: inline-block;
  filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.4));
}

.login-header h2 {
  font-size: 26px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

.input-group {
  margin-bottom: 22px;
  text-align: left;
}

.input-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.input-group input, 
.input-group textarea,
.input-group select {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}

.input-group input:focus, 
.input-group textarea:focus,
.input-group select:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-group input[type="file"] {
  padding: 10px;
  cursor: pointer;
}

.file-tip {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .col {
  flex: 1;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-danger:hover {
  background: #dc2626;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

.btn-block {
  width: 100%;
}

.login-footer {
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-muted);
}

.login-footer strong {
  color: var(--text-secondary);
}

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

/* Sidebar */
.sidebar {
  width: 260px;
  background: rgba(14, 16, 30, 0.85);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  flex-shrink: 0;
}

.sidebar-brand {
  padding: 0 24px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 16px;
}

.sidebar-brand svg {
  color: var(--primary);
  filter: drop-shadow(0 0 5px rgba(99, 102, 241, 0.5));
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 12px;
  flex-grow: 1;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.menu-item.active {
  background: var(--primary-glow);
  color: var(--primary);
  border-left: 3px solid var(--primary);
  padding-left: 13px;
}

.sidebar-user {
  margin-top: auto;
  padding: 16px 24px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-user .user-info {
  display: flex;
  flex-direction: column;
}

.sidebar-user .username {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

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

.logout-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  padding: 6px;
  border-radius: 50%;
}

.logout-icon:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

/* Main Content */
.main-content {
  flex-grow: 1;
  padding: 40px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
}

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

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

.time-badge {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Tab panes */
.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Dashboard Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.stats-card {
  padding: 24px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 20px;
}

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

.card-icon.blue { background: rgba(59, 130, 246, 0.15); color: var(--info); }
.card-icon.purple { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }
.card-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.card-icon.orange { background: rgba(245, 158, 11, 0.15); color: var(--warning); }

.card-data h3 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.card-data .value {
  font-size: 28px;
  font-weight: 700;
}

/* Info Panel */
.info-panel {
  border-radius: var(--radius-md);
  padding: 30px;
}

.panel-header h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
}

.system-intro p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 24px;
}

.storage-info h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
}

.progress-bar-wrapper {
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #8b5cf6);
  border-radius: 4px;
  transition: width 0.5s ease-out;
}

.storage-info p {
  font-size: 12px;
  color: var(--text-muted);
}

.system-intro hr {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin: 20px 0;
}

.system-intro ul {
  list-style: none;
}

.system-intro li {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  padding-left: 20px;
  position: relative;
}

.system-intro li::before {
  content: "✦";
  color: var(--primary);
  position: absolute;
  left: 0;
}

/* Table Filter Bar */
.table-filter-bar {
  padding: 16px 24px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: none;
}

.section-desc {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Tables */
.table-container {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  overflow: hidden;
  border-top: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  background: rgba(255, 255, 255, 0.02);
  padding: 16px 24px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  padding: 18px 24px;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

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

tr:hover td {
  background: rgba(255, 255, 255, 0.01);
}

.user-avatar-cell {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-glass);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.badge.verse { background: rgba(59, 130, 246, 0.15); color: var(--info); }
.badge.hymn { background: rgba(16, 185, 129, 0.15); color: var(--success); }

/* Audio Player */
audio {
  width: 100%;
  max-width: 240px;
  height: 32px;
  outline: none;
}

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-content {
  width: 100%;
  max-width: 500px;
  border-radius: var(--radius-lg);
  padding: 30px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  transition: var(--transition);
}

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.btn-icon-only {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon-only:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

.btn-icon-only.edit:hover {
  color: var(--info);
  border-color: rgba(59, 130, 246, 0.3);
}

.btn-icon-only.delete:hover {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}

.action-buttons-cell {
  display: flex;
  gap: 8px;
}

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

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Switch Toggle Component */
.switch-container {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
  flex-shrink: 0;
}

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

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--text-muted);
  transition: var(--transition);
  border-radius: 24px;
  border: 1px solid var(--border-glass);
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-primary);
  transition: var(--transition);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .switch-slider {
  background-color: var(--primary);
  border-color: rgba(99, 102, 241, 0.5);
}

input:checked + .switch-slider:before {
  transform: translateX(24px);
  background-color: #ffffff;
}

