/* ================================
   Admin Panel Styles
   ================================ */

:root {
  --primary-color: #0d4a3c;
  --primary-hover: #1a6b56;
  --secondary-color: #6c757d;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #17a2b8;

  --background: #f5f7fa;
  --surface: #ffffff;
  --border-color: #e1e4e8;
  --text-primary: #24292e;
  --text-secondary: #586069;
  --text-muted: #959da5;

  --sidebar-width: 250px;
  --header-height: 70px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

  --transition: all 0.3s ease;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
}

/* ================================
   Login Page
   ================================ */

.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
}

.login-container {
  width: 100%;
  max-width: 450px;
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.logo {
  background: var(--primary-color);
  color: white;
  padding: 40px 20px;
  text-align: center;
}

.logo h1 {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.logo p {
  font-size: 0.9rem;
  opacity: 0.9;
}

.login-content {
  padding: 40px 30px;
}

.login-content h2 {
  margin-bottom: 10px;
  font-size: 1.5rem;
}

.subtitle {
  color: var(--text-secondary);
  margin-bottom: 30px;
  font-size: 0.95rem;
}

.footer-text {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-color);
}

/* ================================
   Admin Layout
   ================================ */

.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--primary-color);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
  font-size: 1.4rem;
  font-weight: 600;
}

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

.nav-item {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: var(--transition);
  gap: 12px;
}

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

.nav-item.active {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border-right: 3px solid #d4af37;
}

.nav-item .icon {
  font-size: 1.3rem;
}

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

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  background: var(--background);
}

.page-header {
  background: var(--surface);
  padding: 24px 32px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.page-header h1 {
  font-size: 1.8rem;
  font-weight: 600;
}

.header-actions {
  display: flex;
  gap: 12px;
}

.user-info {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ================================
   Buttons
   ================================ */

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

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

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

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

.btn-secondary:hover {
  background: #5a6268;
}

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

.btn-success:hover {
  background: #218838;
}

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

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

.btn-small {
  padding: 8px 16px;
  font-size: 0.85rem;
  width: 100%;
}

.btn-large {
  padding: 14px 32px;
  font-size: 1.05rem;
}

.btn-icon {
  padding: 8px 12px;
  font-size: 1.2rem;
}

/* ================================
   Cards
   ================================ */

.card {
  background: var(--surface);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 24px;
}

.card h3 {
  margin-bottom: 20px;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ================================
   Dashboard
   ================================ */

.main-content > * {
  padding: 0 32px;
}

.main-content > .page-header {
  padding: 24px 32px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 24px;
  padding-bottom: 40px;
}

.dashboard-grid .card {
  margin-bottom: 0;
}

.full-width {
  grid-column: 1 / -1;
}

.quick-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quick-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--background);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-primary);
  transition: var(--transition);
}

.quick-link:hover {
  background: var(--primary-color);
  color: white;
}

.prayer-times-summary .prayer-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}

.prayer-times-summary .prayer-row:last-child {
  border-bottom: none;
}

.prayer-name {
  font-weight: 500;
}

.prayer-time {
  color: var(--text-secondary);
}

.status-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-label {
  font-weight: 500;
}

.status-value {
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.85rem;
}

.status-success {
  background: #d4edda;
  color: #155724;
}

.status-error {
  background: #f8d7da;
  color: #721c24;
}

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

.tool-card {
  padding: 20px;
  background: var(--background);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-primary);
  transition: var(--transition);
  border: 2px solid transparent;
}

.tool-card:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-md);
}

.tool-card h4 {
  margin-bottom: 8px;
  color: var(--primary-color);
}

.tool-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ================================
   View Controls
   ================================ */

.view-selector {
  display: flex;
  gap: 12px;
  padding: 24px 0 20px;
}

.view-btn {
  padding: 10px 24px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.95rem;
}

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

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

.date-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.date-inputs {
  display: flex;
  gap: 12px;
}

.select-input,
input[type="number"],
input[type="text"],
input[type="time"],
textarea {
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}

input[type="number"] {
  width: 100px;
}

/* ================================
   Tables
   ================================ */

.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table thead {
  background: var(--background);
}

.data-table th {
  padding: 14px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border-color);
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr:hover {
  background: var(--background);
}

.date-col {
  font-weight: 500;
  white-space: nowrap;
}

.time-input {
  width: 100%;
  max-width: 120px;
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.9rem;
}

.athan-hint {
  display: block;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 4px;
}

.action-bar {
  position: sticky;
  bottom: 0;
  padding: 20px 0;
  background: var(--background);
  text-align: center;
}

/* ================================
   Forms
   ================================ */

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(13, 74, 60, 0.1);
}

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

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

.form-hint {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

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

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.arabic-input {
  direction: rtl;
  font-size: 1.2rem;
}

/* ================================
   Adkhar Grid
   ================================ */

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

.adkhar-card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  transition: var(--transition);
}

.adkhar-card.inactive {
  opacity: 0.6;
}

.adkhar-card:hover {
  box-shadow: var(--shadow-md);
}

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

.category-badge {
  background: var(--primary-color);
  color: white;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
}

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

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px;
  transition: transform 0.2s;
}

.btn-icon:hover {
  transform: scale(1.2);
}

.adkhar-arabic {
  font-size: 1.3rem;
  direction: rtl;
  margin-bottom: 12px;
  line-height: 1.8;
  color: var(--text-primary);
}

.adkhar-transliteration {
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.adkhar-translation {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.adkhar-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.status-badge {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-badge.active {
  background: #d4edda;
  color: #155724;
}

.status-badge.inactive {
  background: #f8d7da;
  color: #721c24;
}

.order-badge {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ================================
   Modal
   ================================ */

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s;
}

.modal.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: var(--surface);
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideDown 0.3s;
}

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

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

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

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

.modal-body {
  padding: 24px;
}

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

/* ================================
   Filter Bar
   ================================ */

.filter-bar {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-bottom: 20px;
  padding: 16px 0;
}

.filter-bar .select-input {
  min-width: 200px;
}

/* ================================
   Settings
   ================================ */

.settings-container {
  max-width: 900px;
  padding-bottom: 40px;
}

.settings-list {
  list-style: none;
  padding: 0;
}

.settings-list li {
  padding: 8px 0;
  color: var(--text-secondary);
}

.info-box {
  background: var(--background);
  padding: 20px;
  border-radius: 6px;
  border-left: 4px solid var(--info-color);
}

.info-box p {
  margin-bottom: 12px;
}

.info-box p:last-child {
  margin-bottom: 0;
}

/* ================================
   Utility Classes
   ================================ */

.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.no-data {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

.error-message {
  background: #f8d7da;
  color: #721c24;
  padding: 12px 16px;
  border-radius: 6px;
  margin-top: 16px;
  border: 1px solid #f5c6cb;
}

/* ================================
   Toast Notifications
   ================================ */

.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  padding: 16px 24px;
  background: var(--text-primary);
  color: white;
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  opacity: 0;
  transform: translateY(20px);
  transition: var(--transition);
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

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

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

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

/* ================================
   Animations
   ================================ */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* ================================
   Responsive Design
   ================================ */

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

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

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

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

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

  .date-picker {
    flex-wrap: wrap;
  }

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

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

  .view-selector {
    overflow-x: auto;
  }

  .table-responsive {
    font-size: 0.85rem;
  }

  .time-input {
    max-width: 90px;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .main-content > * {
    padding: 0 16px;
  }

  .main-content > .page-header {
    padding: 20px 16px;
  }

  .card {
    padding: 16px;
  }

  .date-inputs {
    flex-direction: column;
    width: 100%;
  }

  .date-inputs select,
  .date-inputs input {
    width: 100%;
  }
}
