/* ========================================
   TASK CARDS - CLAYMORPHISM THEME
======================================== */

/* ===== CARDS CONTAINER ===== */
.cards-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 98%;           
  max-width: 1100px;   
  margin: 0 auto;       
  padding: 20px 0;
  contain: layout;
}

/* ========================================
   👇 SECTION HEADERS (CLAYMORPHISM)
======================================== */
.task-section {
  background: transparent;
  margin-bottom: 16px;
  content-visibility: auto;
  contain-intrinsic-size: 1px 500px;
}

/* --- SECTION HEADER --- */
.section-header {
  position: -webkit-sticky;
  position: sticky;
  top: 112px;
  z-index: 800;
  scroll-margin-top: 150px;
  will-change: transform;

  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  margin-bottom: 8px;
  
  cursor: pointer;
  
  background: rgba(255, 248, 243, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  
  border-radius: 16px;
  border: none;
  box-shadow: 0 8px 24px rgba(180, 120, 80, 0.1);
  
  border-left-style: solid;
  border-left-width: 6px;
  
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
}

.section-header:hover {
  transform: translateY(-2px);
  background: rgba(255, 250, 247, 0.98);
  box-shadow: 0 12px 32px rgba(180, 120, 80, 0.15);
  z-index: 900;
}
.section-header:active { transform: scale(0.99); }

/* --- HEADER TYPOGRAPHY --- */
.section-title {
  font-weight: 800;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #4A4A4A;
}

.section-count {
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  min-width: 30px;
  text-align: center;
}

.section-icon {
  font-size: 18px;
  color: #B8927E;
}

/* --- HEADER COLORS & Z-INDEX (Claymorphism) --- */

/* 🔴 Overdue (Deep Red) */
.header-overdue { border-left-color: #FF6B6B; z-index: 802; }
.header-overdue .section-count { background: rgba(255, 107, 107, 0.15); color: #FF6B6B; font-weight: 800; }

/* 🟡 Due Soon (Golden Yellow) */
.header-due-soon { border-left-color: #FFD966; z-index: 801; }
.header-due-soon .section-count { background: rgba(255, 217, 102, 0.2); color: #FFB700; font-weight: 800; }

/* 🟢 Upcoming (Fresh Green) */
.header-upcoming { border-left-color: #7BC77B; z-index: 800; }
.header-upcoming .section-count { background: rgba(123, 199, 123, 0.15); color: #7BC77B; font-weight: 800; }


/* --- TOGGLE LOGIC --- */
.section-header.collapsed .section-icon { transform: rotate(-180deg); }
.section-body { display: block; margin-top: 12px; }
.section-body.collapsed { display: none; }
.section-inner { display: flex; flex-direction: column; gap: 16px; }


/* ========================================
   👇 TASK CARD STYLES (CLAYMORPHISM)
======================================== */
.task-card {
  background: rgba(255, 250, 247, 0.9);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(180, 120, 80, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.8); 
  border: none;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  contain: content; 
}

.task-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(180, 120, 80, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* Status Border Indicators (Claymorphism) */
.task-card.upcoming { border-left: 6px solid #C8D9B8; }
.task-card.due-soon { border-left: 6px solid #F4C7A8; }
.task-card.overdue  { border-left: 6px solid #D4917D; }

/* ===== CARD BODY ===== */
.card-body-custom {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(255, 250, 247, 0.8);
}

/* --- ROW STRUCTURE --- */
.card-row-1, .card-row-2, .card-row-3 {
  display: grid;
  gap: 6px;
}

/* 👇 ROW 1: 5 Columns (ID | Plant | Tank | Time | Due) */
.card-row-1 { 
  /* 0.5fr = ID
     0.8fr = Plant
     0.6fr = Tank (Reduced size)
     0.6fr = Time (Reduced size)
     1.3fr = Due Date (Maintains width)
  */
  grid-template-columns: 0.5fr 0.8fr 0.6fr 0.6fr 1.3fr; 
}

.card-row-2 { grid-template-columns: 2fr 1fr 1fr; }
.card-row-3 { grid-template-columns: 1.5fr 1.5fr 1fr; }

/* Row 1 Typography Tweaks (To fit 5 items) */
.card-row-1 .box-value {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px; 
}

/* ===== INFO BOXES ===== */
.info-box {
  background: #ffffff;
  border: 1px solid #e2e6ea;
  border-radius: 8px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 60px; 
  box-shadow: 0 2px 5px rgba(0,0,0,0.03);
  position: relative;
  overflow: hidden;
}

.info-box:hover {
  border-color: #b6d4fe;
  transform: translateY(-1px);
}

/* Labels */
.box-label {
  font-size: 10px;
  color: #8898aa;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 2px;
}

/* Values */
.box-value, .time-text, .task-list-text {
  font-size: 13px;
  font-weight: 600;
  color: #343a40;
  line-height: 1.3;
  padding-left: 2px;
}

.box-id { color: #D4917D; }
.box-due { color: #B8927E; font-weight: 700; }

/* Task List */
.task-list-box {
  justify-content: flex-start;
  padding-top: 10px;
  min-height: 70px;
}
.task-list-text {
  font-size: 12px;
  font-weight: 500;
  white-space: normal;
}

/* ===== REMAINING TIME (COLORED) ===== */
.remaining-box {
  align-items: center;
  text-align: center;
  border: 1px solid transparent; 
}

/* 🟢 Upcoming */
.remaining-box.time-upcoming { background: #f0fff4; border-color: #c3e6cb; }
.time-upcoming .time-text { color: #155724; font-weight: 700; }

/* 🟡 Due Soon */
.remaining-box.time-due-soon { background: #fff9db; border-color: #ffeeba; }
.time-due-soon .time-text { color: #856404; font-weight: 700; }

/* 🔴 Overdue */
.remaining-box.time-overdue { background: #fff5f5; border-color: #f5c6cb; }
.time-overdue .time-text { color: #721c24; font-weight: 700; }


/* ===== CUSTOM CARD DROPDOWN (Claymorphism) ===== */
.card-custom-dropdown-wrapper {
  position: relative;
  width: 100%;
}

.card-dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  background: #fdfdfd;
  border: 2px solid #D4917D;
  border-radius: 6px;
  color: #4A4A4A;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  height: 38px;
  display: flex;
  align-items: center;
}

.card-dropdown-trigger:hover {
  background: rgba(212, 145, 125, 0.05);
  border-color: #B8927E;
}

.card-dropdown-trigger:active {
  transform: scale(0.98);
}

.card-dropdown-trigger i {
  font-size: 14px;
  transition: transform 0.2s ease;
  color: #D4917D;
}

.card-dropdown-trigger i.rotated {
  transform: rotate(180deg);
}

.card-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: rgba(255, 250, 247, 0.98);
  border: 1.5px solid rgba(212, 145, 125, 0.35);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(180, 120, 80, 0.15);
  z-index: 10000;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.card-dropdown-menu:not(.hidden) {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.card-dropdown-menu.hidden {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.card-dropdown-option {
  padding: 10px 14px;
  color: #4A4A4A;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  border-bottom: 1px solid rgba(212, 145, 125, 0.08);
  display: flex;
  align-items: center;
}

.card-dropdown-option:last-child {
  border-bottom: none;
}

.card-dropdown-option:hover {
  background: rgba(212, 145, 125, 0.12);
  color: #D4917D;
  padding-left: 18px;
  font-weight: 600;
}

.card-dropdown-option[data-active="true"] {
  background: rgba(212, 145, 125, 0.15);
  color: #D4917D;
  border-left: 3px solid #D4917D;
  padding-left: 11px;
  font-weight: 700;
}


/* ===== INPUTS ===== */
.card-manual-input, .card-dropdown, .card-observation-input {
  width: 100%;
  border: 2px solid #e9ecef;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
  background: #fdfdfd;
  transition: all 0.2s;
  height: 38px; 
}

.card-observation-input {
  height: 38px;
  resize: none;
  font-family: inherit;
}

.card-manual-input:focus, .card-dropdown:focus, .card-observation-input:focus {
  border-color: #D4917D;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 3px rgba(212, 145, 125, 0.15);
  outline: none;
}

/* Action Box */
.action-box { display: flex; }

/* ===== DONE BUTTON ===== */
.btn-done {
  width: 100%;
  height: 100%;
  min-height: 60px; 
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #198754 0%, #157347 100%);
  color: white;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 4px 10px rgba(25, 135, 84, 0.3);
  transition: all 0.2s ease;
}

.btn-done:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(25, 135, 84, 0.4);
}

.btn-done i { font-size: 16px; }

/* Disabled State */
.btn-done:disabled {
  background: #e9ecef;
  color: #adb5bd;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 992px) {
  /* On mobile, Row 1 still tries 5 cols, but maybe stacks if too tight. 
     For now, we keep the grid but text might truncate. */
  .card-row-1 { grid-template-columns: 0.6fr 0.9fr 0.7fr 0.7fr 1.3fr; }
  .card-row-2 { grid-template-columns: 1fr; }
  .card-row-3 { grid-template-columns: 1fr; }
  
  .task-list-box { min-height: auto; }
}

/* ========================================
   SKELETON LOADER
======================================== */
.skeleton-container {
  padding: 10px;
  max-width: 1100px;
  margin: 0 auto;
}

.skeleton-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  border: 1px solid #eee;
}

/* Animated Gradient */
.skeleton-header, .skeleton-box {
  background: #f4f6f8;
  background: linear-gradient(110deg, #ececec 8%, #f5f5f5 18%, #ececec 33%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
  border-radius: 6px;
}

.skeleton-header { height: 20px; width: 40%; margin-bottom: 15px; }
.skeleton-row { display: flex; gap: 10px; margin-bottom: 12px; }
.skeleton-box { height: 36px; }
.skeleton-box.sm { width: 30%; } 
.skeleton-box.md { width: 48%; } 
.skeleton-box.lg { width: 100%; height: 45px; } 

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}