/* ========================================
   Quick Access Toolbar - الحصين للتأمين
   شريط الأدوات الخدمي على اليسار
   ======================================== */

/* الشريط الرئيسي */
#quick-toolbar {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 4px;
  background: linear-gradient(180deg, #1a237e 0%, #283593 50%, #1a237e 100%);
  border-radius: 0 16px 16px 0;
  box-shadow: 4px 0 20px rgba(26, 35, 126, 0.3);
  transition: all 0.3s ease;
}

#quick-toolbar:hover {
  box-shadow: 6px 0 30px rgba(26, 35, 126, 0.5);
}

/* زر الأداة */
.qt-btn {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-family: 'Material Icons';
  transition: all 0.25s ease;
  position: relative;
  outline: none;
}

.qt-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  transform: scale(1.1);
}

.qt-btn.active {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

/* Tooltip */
.qt-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: #1a237e;
  color: #fff;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-family: 'Cairo', sans-serif;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.qt-btn:hover::after {
  opacity: 1;
}

/* Badge إشعارات */
.qt-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  background: #f44336;
  color: #fff;
  font-size: 9px;
  font-family: 'Cairo', sans-serif;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* فاصل */
.qt-divider {
  width: 28px;
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
  margin: 4px auto;
}

/* ========================================
   Panel - اللوحة المنبثقة
   ======================================== */
.qt-panel {
  position: fixed;
  left: 58px;
  top: 50%;
  transform: translateY(-50%) scale(0.95);
  width: 360px;
  max-height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  direction: rtl;
  font-family: 'Cairo', sans-serif;
}

.qt-panel.show {
  opacity: 1;
  pointer-events: all;
  transform: translateY(-50%) scale(1);
}

/* رأس اللوحة */
.qt-panel-header {
  background: linear-gradient(135deg, #1a237e, #283593);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.qt-panel-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.qt-panel-header h3 .material-icons {
  font-size: 20px;
}

.qt-panel-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.qt-panel-close:hover {
  background: rgba(255,255,255,0.3);
}

/* محتوى اللوحة */
.qt-panel-body {
  padding: 16px;
  overflow-y: auto;
  max-height: 440px;
}

/* ========================================
   أنماط الأدوات المشتركة
   ======================================== */

/* حقل إدخال */
.qt-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  direction: rtl;
  transition: border-color 0.2s;
  outline: none;
  box-sizing: border-box;
}

.qt-input:focus {
  border-color: #1a237e;
}

/* زر */
.qt-action-btn {
  padding: 8px 18px;
  border: none;
  border-radius: 10px;
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.qt-action-btn.primary {
  background: linear-gradient(135deg, #1a237e, #283593);
  color: #fff;
}

.qt-action-btn.primary:hover {
  box-shadow: 0 4px 12px rgba(26, 35, 126, 0.3);
  transform: translateY(-1px);
}

.qt-action-btn.secondary {
  background: #f5f5f5;
  color: #333;
}

.qt-action-btn.secondary:hover {
  background: #e0e0e0;
}

/* Label */
.qt-label {
  display: block;
  font-size: 12px;
  color: #666;
  margin-bottom: 6px;
  font-weight: 600;
}

/* Select */
.qt-select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  direction: rtl;
  outline: none;
  background: #fff;
  cursor: pointer;
  box-sizing: border-box;
}

.qt-select:focus {
  border-color: #1a237e;
}

/* نتيجة */
.qt-result {
  background: linear-gradient(135deg, #e8eaf6, #c5cae9);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  margin-top: 12px;
}

.qt-result-value {
  font-size: 22px;
  font-weight: 700;
  color: #1a237e;
}

.qt-result-label {
  font-size: 11px;
  color: #666;
  margin-top: 2px;
}

/* Grid */
.qt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Row */
.qt-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.qt-row > * {
  flex: 1;
}

/* ========================================
   حاسبة عادية
   ======================================== */
.calc-display {
  background: #1a237e;
  color: #fff;
  padding: 16px;
  text-align: left;
  border-radius: 10px;
  margin-bottom: 12px;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  direction: ltr;
}

.calc-display .calc-expr {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  min-height: 18px;
}

.calc-display .calc-val {
  font-size: 28px;
  font-weight: 700;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.calc-key {
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-family: 'Cairo', sans-serif;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  background: #f5f5f5;
  color: #333;
}

.calc-key:hover {
  background: #e0e0e0;
  transform: scale(1.05);
}

.calc-key.op {
  background: #e8eaf6;
  color: #1a237e;
}

.calc-key.eq {
  background: linear-gradient(135deg, #1a237e, #283593);
  color: #fff;
}

.calc-key.eq:hover {
  box-shadow: 0 4px 12px rgba(26, 35, 126, 0.3);
}

.calc-key.clear {
  background: #ffebee;
  color: #c62828;
}

/* ========================================
   المفكرة
   ======================================== */
.qt-notepad {
  width: 100%;
  min-height: 200px;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  direction: rtl;
  resize: vertical;
  outline: none;
  line-height: 1.8;
  box-sizing: border-box;
}

.qt-notepad:focus {
  border-color: #1a237e;
}

.qt-note-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.qt-note-count {
  font-size: 11px;
  color: #999;
}

/* ========================================
   التقويم
   ======================================== */
.qt-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.qt-calendar-nav {
  background: none;
  border: none;
  color: #1a237e;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: background 0.2s;
}

.qt-calendar-nav:hover {
  background: #e8eaf6;
}

.qt-calendar-title {
  font-size: 14px;
  font-weight: 700;
  color: #1a237e;
}

.qt-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}

.qt-cal-day-name {
  font-size: 10px;
  color: #999;
  padding: 4px;
  font-weight: 600;
}

.qt-cal-day {
  padding: 6px;
  font-size: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: transparent;
  font-family: 'Cairo', sans-serif;
}

.qt-cal-day:hover {
  background: #e8eaf6;
}

.qt-cal-day.today {
  background: #1a237e;
  color: #fff;
  font-weight: 700;
}

.qt-cal-day.has-event {
  position: relative;
}

.qt-cal-day.has-event::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: #f44336;
  border-radius: 50%;
}

.qt-cal-day.other-month {
  color: #ccc;
}

/* أحداث التقويم */
.qt-events-list {
  margin-top: 12px;
  max-height: 150px;
  overflow-y: auto;
}

.qt-event-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 4px;
  font-size: 12px;
  background: #fff3e0;
  border-right: 3px solid #ff9800;
}

.qt-event-item.danger {
  background: #ffebee;
  border-right-color: #f44336;
}

.qt-event-item.success {
  background: #e8f5e9;
  border-right-color: #4caf50;
}

/* ========================================
   البحث السريع
   ======================================== */
.qt-search-results {
  margin-top: 12px;
  max-height: 350px;
  overflow-y: auto;
}

.qt-search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 4px;
}

.qt-search-item:hover {
  background: #f5f5f5;
}

.qt-search-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
}

.qt-search-icon.policy { background: #1a237e; }
.qt-search-icon.claim { background: #c62828; }
.qt-search-icon.client { background: #2e7d32; }
.qt-search-icon.branch { background: #f57f17; }

.qt-search-info h4 {
  margin: 0;
  font-size: 13px;
  color: #333;
}

.qt-search-info p {
  margin: 2px 0 0;
  font-size: 11px;
  color: #999;
}

/* ========================================
   إشعارات الوثائق
   ======================================== */
.qt-notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 6px;
  background: #fff;
  border: 1px solid #eee;
  transition: all 0.2s;
}

.qt-notif-item:hover {
  border-color: #1a237e;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.qt-notif-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.qt-notif-icon.warning { background: #fff3e0; color: #ff9800; }
.qt-notif-icon.danger { background: #ffebee; color: #f44336; }
.qt-notif-icon.info { background: #e3f2fd; color: #1976d2; }

.qt-notif-content h4 {
  margin: 0;
  font-size: 12px;
  color: #333;
}

.qt-notif-content p {
  margin: 2px 0 0;
  font-size: 11px;
  color: #999;
}

/* ========================================
   الاختصارات السريعة
   ======================================== */
.qt-shortcut-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.qt-shortcut-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 10px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  border: 2px solid #eee;
  background: #fff;
}

.qt-shortcut-card:hover {
  border-color: #1a237e;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.qt-shortcut-card .material-icons {
  font-size: 28px;
  color: #1a237e;
}

.qt-shortcut-card span {
  font-size: 11px;
  color: #333;
  font-weight: 600;
  text-align: center;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
  #quick-toolbar {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    flex-direction: row;
    justify-content: center;
    border-radius: 16px 16px 0 0;
    padding: 6px 8px;
    gap: 1px;
  }

  .qt-btn {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .qt-btn::after {
    display: none;
  }

  .qt-divider {
    width: 1px;
    height: 24px;
    margin: 0 4px;
  }

  .qt-panel {
    left: 8px;
    right: 8px;
    bottom: 60px;
    top: auto;
    transform: scale(0.95);
    width: auto;
    max-height: 70vh;
  }

  .qt-panel.show {
    transform: scale(1);
  }
}
