
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin: 0; padding: 0; }
html, body { overflow-x: hidden; width: 100%; position: relative; scroll-behavior: smooth; background: #FFFFFF; }
body, button, input, select, textarea, label, h1, h2, h3, h4, p, span, a {
  font-family: 'Cairo', Tahoma, Arial, sans-serif;
}
body { color: #1a1a2e; min-height: 100vh; padding-bottom: 90px; }
body.cards-hidden .container { display: none !important; }
body.cards-hidden .ios-nav { display: none !important; }

.header-fixed {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: linear-gradient(135deg, #E67E22 0%, #D35400 50%, #A04000 100%);
  color: #fff; padding: 1rem 1rem 1.3rem; text-align: center;
  border-radius: 0 0 35px 35px;
  box-shadow: 0 8px 32px rgba(160,64,0,0.25), inset 0 1px 0 rgba(255,255,255,0.2);
  min-height: 130px;
}
.header-content {
  position: relative; z-index: 1; display: flex !important; flex-direction: row !important;
  align-items: center !important; justify-content: space-between !important; gap: 0.8rem; flex-wrap: wrap;
}
.header-logo {
  width: auto !important; height: 42px !important; padding: 0 12px !important;
  background: rgba(255,255,255,0.95); border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Aref Ruqaa', serif !important;
  font-size: 14px !important; font-weight: 700 !important;
  border: 2px solid rgba(255,255,255,0.4); backdrop-filter: blur(10px);
  animation: logoFloat 3s ease-in-out infinite; flex-shrink: 0;
  box-shadow: 0 4px 15px rgba(160,64,0,0.2);
  color: #A04000 !important;
}
@keyframes logoFloat { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-7px) rotate(3deg); } }
.header-title-container { display: flex; flex-direction: column; align-items: center; text-align: center; flex: 1; min-width: 0; }
.header-title { font-size: 1.15rem !important; font-weight: 800; margin: 0; text-shadow: 0 2px 6px rgba(0,0,0,0.15); line-height: 1.25; color: #fff; white-space: nowrap; }
.header-subtitle { font-size: 0.72rem; opacity: 0.92; margin: 0.2rem 0 0; font-weight: 500; color: rgba(255,255,255,0.95); white-space: nowrap; }
.header-datetime { font-size: 0.68rem; opacity: 0.95; margin-top: 4px; background: rgba(255,255,255,0.25); padding: 3px 10px; border-radius: 15px; backdrop-filter: blur(5px); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.header-logout-btn { width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,0.2); border: 2px solid rgba(255,255,255,0.4); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; flex-shrink: 0; }
.header-logout-btn:hover { background: rgba(255,255,255,0.35); transform: scale(1.08); }

.login-screen {
  position: fixed; inset: 0; z-index: 2000;
  background: linear-gradient(135deg, #E67E22 0%, #D35400 50%, #A04000 100%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-box {
  background: #FFFFFF; border-radius: 24px; padding: 30px 25px;
  width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: modalSlideIn 0.4s ease;
}
@keyframes modalSlideIn { from { transform: translateY(-30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.login-logo { text-align: center; margin-bottom: 20px; }
.login-logo-icon {
  width: 70px; height: 70px; margin: 0 auto 15px;
  background: linear-gradient(135deg, #E67E22, #D35400);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 32px; color: #fff;
  box-shadow: 0 8px 25px rgba(230,126,34,0.4);
}
.login-title {
  font-size: 20px; font-weight: 800; color: #A04000; margin-bottom: 5px;
  font-family: 'Aref Ruqaa', serif;
}
.login-subtitle { font-size: 13px; color: #666; margin-bottom: 25px; text-align: center; }

.container { max-width: 720px; margin: 160px auto 20px; padding: 15px; width: 100%; display: grid !important; grid-template-columns: repeat(2, 1fr) !important; gap: 14px !important; }

.main-card {
  background: #FFFFFF;
  border-radius: 18px; padding: 20px 15px; text-align: center;
  border: 1px solid rgba(230,126,34,0.3);
  box-shadow: 0 6px 24px rgba(0,0,0,0.08);
  transition: all 0.3s ease; cursor: pointer;
  border-right: 5px solid #E67E22;
  display: flex !important; flex-direction: column !important;
  align-items: center !important; justify-content: center !important;
  gap: 10px !important; min-height: 120px !important;
}
.main-card:hover { transform: translateY(-4px) scale(1.02); box-shadow: 0 12px 36px rgba(230,126,34,0.28); border-right-color: #A04000; }
.main-card:active { transform: scale(0.98); }
.main-card i {
  font-size: 28px !important; width: 56px !important; height: 56px !important;
  border-radius: 16px !important;
  background: linear-gradient(135deg, rgba(230,126,34,0.15), rgba(211,84,0,0.1)) !important;
  color: #A04000 !important;
  display: inline-flex !important; align-items: center !important; justify-content: center !important;
  border: 1px solid rgba(160,64,0,0.15);
}
.main-card h3 { font-size: 13px !important; font-weight: 700 !important; color: #1a1a2e !important; margin: 0 !important; line-height: 1.3 !important; }
.main-card p { font-size: 10px !important; color: #667085 !important; margin: 0 !important; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.55); backdrop-filter: blur(8px); z-index: 10001; display: none; align-items: center; justify-content: center; padding: 15px; }
.modal.show { display: flex; }
.modal-content { background: #fff; border-radius: 22px; padding: 22px; width: 100%; max-width: 520px; box-shadow: 0 20px 60px rgba(160,64,0,0.3); max-height: 85vh; overflow-y: auto; position: relative; border: 3px solid #E67E22; animation: modalSlideIn 0.3s ease; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 2px solid rgba(230,126,34,0.25); }
.modal-header h3 { margin: 0; color: #A04000; font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-close { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #E67E22, #D35400); color: #fff; border: none; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform 0.2s; }
.modal-close:hover { transform: scale(1.1); }

.input-group { margin-bottom: 14px; text-align: right; }
.input-group label { display: block; margin-bottom: 6px; font-weight: 700; color: #333; font-size: 13px; }
.input-group input, .input-group select, .input-group textarea { 
  width: 100%; padding: 12px; border-radius: 12px; border: 1px solid #ddd; 
  font-size: 14px; background: #f9f9f9; direction: rtl; 
}
.input-group input:focus, .input-group select:focus, .input-group textarea:focus { 
  outline: none; border-color: #E67E22; box-shadow: 0 0 0 3px rgba(230,126,34,0.2); background: #fff; 
}
.input-group input[readonly] { background: #FFF5E6; color: #A04000; font-weight: 700; }

.action-btn { 
  padding: 14px 20px !important; border-radius: 14px !important; border: none !important;
  font-weight: 700 !important; font-size: 14px !important; cursor: pointer !important; transition: all 0.2s !important; 
  display: flex !important; align-items: center !important; justify-content: center !important; gap: 8px !important;
  width: 100% !important;
}
.action-btn.primary { background: linear-gradient(135deg, #E67E22, #D35400) !important; color: #fff !important; }
.action-btn.success { background: #28a745 !important; color: #fff !important; }
.action-btn.warning { background: #ffc107 !important; color: #111 !important; }
.action-btn.danger { background: #dc3545 !important; color: #fff !important; }
.action-btn.info { background: #17a2b8 !important; color: #fff !important; }
.action-btn:hover { transform: translateY(-2px) !important; opacity: 0.95 !important; box-shadow: 0 6px 20px rgba(0,0,0,0.2) !important; }
.action-btn-small {
  padding: 6px 10px !important; font-size: 10px !important; min-width: 32px !important; width: auto !important;
  display: inline-flex !important;
}

.data-list { margin-top: 15px; max-height: 300px; overflow-y: auto; }
.data-item { 
  background: #FFFFFF; border-radius: 12px; padding: 12px; margin-bottom: 10px; 
  display: flex; flex-direction: column; align-items: stretch; 
  border: 1px solid rgba(230,126,34,0.25); transition: all 0.2s; border-right: 4px solid #E67E22; 
}
.data-item:hover { background: #FFF9F0; transform: translateY(-2px); box-shadow: 0 4px 16px rgba(230,126,34,0.15); }
.data-item-name { font-weight: 700; color: #1a1a2e; font-size: 14px; margin-bottom: 4px; }
.data-item-detail { font-size: 11px; color: #556070; margin-top: 2px; }
.data-item-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }

.search-box { position: sticky; top: 0; background: #fff; padding: 8px 0; z-index: 5; border-bottom: 1px solid rgba(230,126,34,0.2); margin-bottom: 10px; border-radius: 12px; display: flex; gap: 8px; align-items: center; }
.search-box input { flex: 1; padding: 10px 15px; border-radius: 12px; border: 1px solid #ddd; font-size: 14px; background: #f9f9f9; }

.toast { 
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%); 
  background: #FFFFFF; color: #1a1a2e;
  padding: 14px 24px 14px 18px; border-radius: 16px; z-index: 10002; 
  display: none; font-size: 13px; font-weight: 600; 
  animation: toastSlide 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow: 0 10px 40px rgba(0,0,0,0.15); border: 2px solid #E67E22;
  min-width: 280px; max-width: 90%; align-items: center; gap: 12px;
}
.toast.show { display: flex; }
.toast-icon {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.toast-content { flex: 1; text-align: right; line-height: 1.4; }
.toast.success { border-color: #28a745; }
.toast.success .toast-icon { background: rgba(40,167,69,0.15); color: #28a745; }
.toast.warning { border-color: #ffc107; }
.toast.warning .toast-icon { background: rgba(255,193,7,0.15); color: #f39c12; }
.toast.error { border-color: #dc3545; }
.toast.error .toast-icon { background: rgba(220,53,69,0.15); color: #dc3545; }
@keyframes toastSlide { 
  from { transform: translateX(-50%) translateY(-50px); opacity: 0; } 
  to { transform: translateX(-50%) translateY(0); opacity: 1; } 
}

.ios-nav { 
  position: fixed; bottom: 12px; left: 12px; right: 12px; 
  background: #FFFFFF; backdrop-filter: blur(20px); 
  display: flex; justify-content: space-around; padding: 10px 0; 
  border-radius: 26px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); 
  z-index: 10000; border: 1px solid rgba(230,126,34,0.3); 
}
.ios-nav a { flex: 1; text-align: center; text-decoration: none; color: #667085; font-size: 10px; font-weight: 600; transition: color 0.2s; }
.ios-nav a i { display: block; font-size: 20px; margin-bottom: 3px; }
.ios-nav a.active { color: #A04000; }
.ios-nav a.active i { color: #E67E22; }

.delete-modal-content { text-align: center; padding: 30px 20px; }
.delete-modal-icon {
  width: 80px; height: 80px; margin: 0 auto 20px;
  background: rgba(220,53,69,0.1); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; color: #dc3545;
  animation: shakeIcon 0.5s ease;
}
@keyframes shakeIcon { 0%, 100% { transform: rotate(0deg); } 25% { transform: rotate(-10deg); } 75% { transform: rotate(10deg); } }
.delete-modal-title { font-size: 18px; font-weight: 700; color: #1a1a2e; margin-bottom: 10px; }
.delete-modal-message { font-size: 14px; color: #666; margin-bottom: 25px; line-height: 1.6; }
.delete-modal-item-name {
  font-weight: 700; color: #dc3545; background: rgba(220,53,69,0.08);
  padding: 8px 16px; border-radius: 12px; display: inline-block; margin: 10px 0;
}
.delete-modal-actions { display: flex; gap: 10px; justify-content: center; }
.delete-modal-actions .action-btn { width: auto !important; min-width: 120px !important; padding: 12px 24px !important; }

.section-view {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: #fff; z-index: 2000; padding: 20px;
  overflow-y: auto; padding-bottom: 100px;
}
.section-view.active { display: block; }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; padding-bottom: 15px;
  border-bottom: 2px solid rgba(230,126,34,0.2);
}
.section-header h3 {
  margin: 0; color: #A04000; font-size: 18px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
.btn-back {
  background: rgba(230,126,34,0.1); color: #A04000;
  border: none; padding: 8px 16px; border-radius: 10px;
  font-family: 'Cairo'; font-weight: 600; font-size: 13px;
  cursor: pointer; display: flex; align-items: center; gap: 5px;
  transition: 0.2s;
}
.btn-back:hover { background: rgba(230,126,34,0.2); transform: translateX(-2px); }

.report-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
.report-table th { background: linear-gradient(135deg, #E67E22, #D35400); color: #fff; padding: 12px; text-align: center; font-weight: 700; }
.report-table td { padding: 10px; border-bottom: 1px solid #eee; text-align: center; }
.report-table tr:hover { background: #FFF9F0; }
.report-table tfoot { background: #FFF5E6; font-weight: 700; }
.report-table tfoot td { padding: 14px; }

@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; left: 0; top: 0; width: 100%; }
  .no-print { display: none !important; }
}

@media (max-width: 768px) {
  .header-fixed { padding: 0.9rem 0.8rem 1.1rem; min-height: 115px; border-radius: 0 0 28px 28px; }
  .header-title { font-size: 1.05rem !important; }
  .header-logo { font-size: 12px !important; padding: 0 10px !important; }
  .container { gap: 10px !important; padding: 12px !important; margin-top: 145px !important; }
  .main-card { min-height: 105px !important; padding: 15px 10px !important; }
  .main-card i { width: 48px !important; height: 48px !important; font-size: 22px !important; }
  .main-card h3 { font-size: 12px !important; }
  .section-view { padding: 15px; }
  .section-header h3 { font-size: 16px; }
  .btn-back { padding: 6px 12px; font-size: 12px; }
  .report-table { font-size: 11px; }
  .report-table th, .report-table td { padding: 8px 5px; }
}
