/* ═══════════════════════════════════════════════════════════
   ACTIVITY HISTORY MODAL — Bottom-Sheet Responsive Design
   ═══════════════════════════════════════════════════════════ */

/* Modal Root */
#qhikma-modal-root * {
  box-sizing: border-box;
}

/* Backdrop */
.qhikma-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9990;
  background: rgba(0, 0, 0, 0);
  transition: background 0.3s ease;
  cursor: pointer;
}

.qhikma-modal-backdrop.open {
  display: block;
  background: rgba(0, 0, 0, 0.5);
}

/* Modal Container */
.qhikma-modal {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9991;
  background: #fff;
  border-radius: 20px 20px 0 0;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-direction: column;
  display: flex;
}

.qhikma-modal.open {
  transform: translateY(0);
}

@media (max-width: 480px) {
  .qhikma-modal {
    max-height: 90vh;
  }
}

@media (min-width: 768px) {
  .qhikma-modal {
    position: fixed;
    bottom: auto;
    top: 50%;
    left: 50%;
    right: auto;
    width: 60vw;
    max-width: 700px;
    max-height: 75vh;
    transform: translate(-50%, -50%) scale(0.95);
    border-radius: 20px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .qhikma-modal.open {
    transform: translate(-50%, -50%) scale(1);
  }
}

@media (min-width: 1200px) {
  .qhikma-modal {
    width: 50vw;
    max-width: 600px;
  }
}

/* Header */
.qhikma-modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid #e5dcc6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.qhikma-modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #1d1b18;
}

.qhikma-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  font-size: 26px;
  color: #8b7355;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
}

.qhikma-modal-close:hover {
  background: #f3efe6;
  color: #5e4710;
}

/* Tabs */
.qhikma-modal-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e5dcc6;
  overflow-x: auto;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
}

.qhikma-tab-btn {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: #8b7355;
  border-bottom: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.qhikma-tab-btn.active {
  color: #b8902a;
  border-bottom-color: #b8902a;
}

.qhikma-tab-btn:hover {
  color: #7a5c14;
}

.qhikma-tab-icon {
  font-size: 16px;
}

@media (max-width: 480px) {
  .qhikma-tab-btn {
    font-size: 11px;
    padding: 10px 8px;
  }

  .qhikma-tab-label {
    display: none;
  }

  .qhikma-tab-btn.active .qhikma-tab-label {
    display: inline;
  }
}

/* Content Area */
.qhikma-modal-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0;
}

.qhikma-tab-content {
  display: none;
  height: 100%;
  overflow-y: auto;
  padding: 12px 0;
}

.qhikma-tab-content.active {
  display: block;
}

/* List */
.qhikma-list {
  display: flex;
  flex-direction: column;
}

.qhikma-empty {
  padding: 40px 20px;
  text-align: center;
  color: #8b7355;
  font-size: 14px;
  font-weight: 500;
}

/* List Item */
.qhikma-list-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #f0ece0;
  cursor: pointer;
  transition: background 0.15s;
  align-items: flex-start;
}

.qhikma-list-item:hover {
  background: #fffaf0;
}

.qhikma-item-icon {
  font-size: 20px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #fffbf0;
  border-radius: 8px;
}

.qhikma-item-text {
  flex: 1;
  min-width: 0;
}

.qhikma-item-title {
  font-size: 14px;
  font-weight: 600;
  color: #1d1b18;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qhikma-item-subtitle {
  font-size: 12px;
  color: #8b7355;
  margin: 2px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qhikma-item-notes {
  font-size: 12px;
  color: #6d6557;
  margin: 4px 0 0;
  line-height: 1.3;
  max-height: 50px;
  overflow: hidden;
}

.qhikma-item-time {
  font-size: 11px;
  color: #a89968;
  margin: 4px 0 0;
  font-weight: 500;
}

/* Actions */
.qhikma-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.qhikma-action-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: #fff;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
  padding: 0;
  border: 1px solid #e5dcc6;
}

.qhikma-action-btn:hover {
  background: #f9f5ef;
  transform: scale(1.05);
}

.qhikma-action-btn:active {
  transform: scale(0.95);
}

@media (max-width: 480px) {
  .qhikma-action-btn {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }
}

/* Footer */
.qhikma-modal-footer {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #e5dcc6;
  flex-shrink: 0;
  justify-content: center;
  flex-wrap: wrap;
}

.qhikma-footer-btn {
  padding: 8px 14px;
  border: 1px solid #cdbb87;
  border-radius: 20px;
  background: #fffaf0;
  color: #5e4710;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.qhikma-footer-btn:hover {
  background: #fff4ef;
  border-color: #b8902a;
  color: #7a5c14;
}

.qhikma-footer-btn.qhikma-danger {
  border-color: #d9a5a5;
  background: #fef3f3;
  color: #8b4a4a;
}

.qhikma-footer-btn.qhikma-danger:hover {
  background: #fce9e9;
  border-color: #c97777;
  color: #6b3a3a;
}

@media (max-width: 480px) {
  .qhikma-footer-btn {
    padding: 6px 10px;
    font-size: 11px;
  }
}

/* Header Integration — Icon for opening modal */
.qhikma-activity-icon {
  cursor: pointer;
  font-size: 18px;
  padding: 8px;
  border-radius: 6px;
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.qhikma-activity-icon:hover {
  background: #f3efe6;
}

.qhikma-activity-icon:active {
  background: #e5dcc6;
}
