/* ========================================
   HISTORY MODAL (7in x 9in Glass UI)
   + Scroll Fix & Modern Updates
======================================== */

/* 1. SCROLL LOCK FIX */
body.no-scroll {
  overflow: hidden; /* Stops background scrolling */
}

/* 2. MODAL CONTAINER (Claymorphism) */
.history-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  
  /* Dimensions: 7in x 9in */
  width: 95%; 
  max-width: 7in;   
  height: 8in;      
  max-height: 85vh; 
  
  /* Claymorphism Glass Style */
  background: rgba(255, 248, 243, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  
  border-radius: 24px;
  border: 1px solid rgba(212, 145, 125, 0.2);
  
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 2000;
  
  /* Animation */
  transform: translate(-50%, -48%) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.history-modal.active {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: auto;
  box-shadow: 
    0 20px 60px -10px rgba(180, 120, 80, 0.15), 
    0 0 0 100vmax rgba(0, 0, 0, 0.25);
}

/* --- HEADER (Claymorphism) --- */
.history-header {
  background: rgba(255, 248, 243, 0.95);
  padding: 18px 24px;
  border-bottom: 1px solid rgba(212, 145, 125, 0.1);
  flex-shrink: 0;
}

.history-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.history-title {
  font-size: 22px;
  font-weight: 700;
  color: #4A4A4A;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-close-history {
  background: rgba(212, 145, 125, 0.1);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 16px;
  color: #D4917D;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s;
}
.btn-close-history:hover { background: rgba(212, 145, 125, 0.2); transform: rotate(90deg); }

/* --- FILTER (Claymorphism) --- */
.history-filter-row .search-wrapper {
  display: flex;
  gap: 10px;
  background: rgba(255, 250, 247, 0.9);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgba(212, 145, 125, 0.15);
}
.search-dropdown, .search-input {
  border: none; background: transparent; padding: 8px 12px; outline: none; font-size: 14px; color: #4A4A4A;
}
.search-dropdown { border-right: 1px solid rgba(212, 145, 125, 0.2); font-weight: 600; cursor: pointer; }
.search-input { flex: 1; }

/* --- CONTENT --- */
/* --- CONTENT --- */
.history-content {
  flex: 1;                 /* Fill remaining space */
  display: flex;           /* Keep flex for the gap */
  flex-direction: column;
  
  /* 🔴 CRITICAL FIXES FOR SCROLLING: */
  min-height: 0;           /* Allows the container to stop growing and start scrolling */
  overflow-y: auto;        /* Enables the scrollbar */
  
  padding: 24px;
  gap: 16px; 
  scrollbar-width: thin;
}

/* ========================================
   ACCORDION CARD STYLES (Claymorphism)
======================================== */
.history-item-card {
  background: rgba(255, 250, 247, 0.95);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(180, 120, 80, 0.06);
  border: 1px solid rgba(212, 145, 125, 0.15);
  border-left: 5px solid #D4917D; 
  overflow: hidden; 
  transition: all 0.2s ease;
  margin-bottom: 2px;
  
  flex-shrink: 0; 
}

/* --- ROW 1: HEADER (Always Visible) (Claymorphism) --- */
.history-card-header {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background: rgba(255, 250, 247, 0.95);
  transition: background 0.2s;
}
.history-card-header:hover { background: rgba(255, 248, 243, 0.99); }

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Arrow Icon */
.toggle-icon {
  font-size: 12px;
  color: #B8927E;
  transition: transform 0.3s ease;
}
/* Rotate arrow when active */
.history-item-card.active .toggle-icon { transform: rotate(90deg); }

/* ID Text */
.header-id-text {
  font-size: 14px;
  font-weight: 700;
  color: #D4917D;
  font-family: monospace; 
}

/* Delete Button (Claymorphism) */
.btn-header-delete {
  background: rgba(240, 169, 168, 0.15);
  border: 1px solid rgba(240, 169, 168, 0.3);
  color: #d97e7e;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}
.btn-header-delete:hover {
  background: #d97e7e;
  color: white;
  border-color: #d97e7e;
}

/* --- ROW 2: DETAILS (Hidden by Default) (Claymorphism) --- */
.history-card-details {
  display: none;
  padding: 0 16px 16px 16px;
  background: rgba(255, 250, 247, 0.95);
  border-top: 1px dashed rgba(212, 145, 125, 0.2);
  animation: slideDown 0.3s ease forwards;
}

/* Info Boxes (Claymorphism) */
.history-info-box {
  background: rgba(255, 248, 243, 0.8);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid rgba(212, 145, 125, 0.1);
}
.history-box-label { font-size: 10px; color: #B8927E; font-weight: 700; text-transform: uppercase; }
.history-box-value { font-size: 12px; font-weight: 600; color: #4A4A4A; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.history-task-text { color: #D4917D; white-space: normal; line-height: 1.2; }
.history-obs-text { color: #6ba876; }

/* Timestamp Footer */
.details-footer {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(212, 145, 125, 0.1);
  font-size: 11px;
  color: #B8927E;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ========================================
   SEPARATE DELETE POPUP (Matches your HTML)
======================================== */

/* 1. The Overlay (Dark Layer on Top) */
#delete-popup-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  
  /* High Z-Index to sit ON TOP of History Modal */
  z-index: 3000; 
  
  background: rgba(0, 0, 0, 0.5); /* Standard dark dim */
  backdrop-filter: none; /* No blur, just clean dim */
  
  /* Layout: Center the box */
  display: flex; /* (This is toggled by JS usually, but flex centers it) */
  align-items: center;
  justify-content: center;
}

/* 2. The Box (Claymorphism Style) */
.popup-box {
  background: rgba(255, 248, 243, 0.98);
  width: 320px;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(180, 120, 80, 0.15);
  text-align: center;
  border: 1px solid rgba(212, 145, 125, 0.2);
}

/* 3. The Icon (Warning) */
.popup-icon {
  font-size: 32px;
  color: #D4917D;
  margin-bottom: 12px;
}

/* 4. Text Styles */
.popup-box h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
  color: #4A4A4A;
}

.popup-box p {
  margin: 0 0 24px 0;
  font-size: 14px;
  color: #6A6A6A;
  line-height: 1.4;
}

/* 5. Buttons (Claymorphism) */
.popup-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* Cancel Button */
.btn-cancel {
  padding: 8px 20px;
  background: rgba(255, 250, 247, 0.9);
  border: 1px solid rgba(212, 145, 125, 0.2);
  color: #B8927E;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-cancel:hover { background: rgba(255, 248, 243, 0.99); border-color: rgba(212, 145, 125, 0.3); }

/* Confirm Delete Button */
.btn-confirm-delete {
  padding: 8px 20px;
  background: #d97e7e;
  border: 1px solid #d97e7e;
  color: white;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-confirm-delete:hover { background: #c96969; border-color: #c96969; }
/* ========================================
   NEW: HISTORY TABS (Claymorphism)
======================================== */
.history-tabs-row {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(212, 145, 125, 0.1);
}

.history-tab-btn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: rgba(255, 250, 247, 0.9);
  color: #B8927E;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.history-tab-btn:hover {
  background: rgba(242, 199, 168, 0.2);
  color: #D4917D;
}

/* Active State (Clay) */
.history-tab-btn.active {
  background: rgba(212, 145, 125, 0.15);
  color: #D4917D;
  box-shadow: 0 2px 4px rgba(212, 145, 125, 0.1);
}

/* ========================================
   NEW: DELETED CARD STYLE (Claymorphism)
======================================== */
.history-item-card.deleted-style {
  border-left-color: #d97e7e; 
  background: rgba(240, 169, 168, 0.08); 
}

/* Deleted Badge */
.deleted-badge {
  font-size: 10px;
  font-weight: 700;
  color: #c96969;
  background: rgba(240, 169, 168, 0.2);
  padding: 4px 8px;
  border-radius: 8px;
  text-transform: uppercase;
}