/* Calendar styles */
.container {
  position: relative;
  padding: 1rem;
  font-size: 8px;
}

/* The STACK is now the absolute positioned element that holds everything */
.calendar-stack {
  position: absolute;
  right: 50%;
  top: 0dvh;
  margin-right: 1rem; /* Adjust gap from center spine */
  
  display: flex;
  flex-direction: column;
  align-items: center; /* Center buttons relative to calendar */
  gap: 5px;         /* Space between Controls and Calendar */
  
  z-index: 10;
}

/* New Control Panel Card */
.control-panel {
  width: 280px; 
  background: #cdf7f825;
  padding: 10px;        /* Slightly reduced padding to save space */
  border-radius: 8px; 
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  gap: 1px;            /* Tighter gap between rows */
  position: static;
}

/* NEW: Centers the info button row */
.info-row {
  display: flex;
  justify-content: center;
  margin-bottom: 2px;
}

/* Existing button styles... */
.library-controls {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  /* margin-top: 0.2rem; removed top margin since info is above now */
}

/* Position calendar container RELATIVE inside the stack */
.calendar-container {
  position: relative; 
  /* No top/right here, it's controlled by stack */
  width: 280px;
  height: auto; /* Allow auto height or keep fixed if strictly needed */
  visibility: visible;
  background: #cdf7f8;
  background: #c2eaeb;

  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  padding: 1rem;
  border-radius: 8px;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-weight: bold;
  font-size: 1px;
  margin-bottom: 0.3rem;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.calendar-day {       
  aspect-ratio: 1;      /* Change this to affect the size of the calendar grid */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid #ebc3a7;
}

.calendar-day:hover {
  background: #f0f0f0;
}

.calendar-day.has-entry {
  background: #a6faa6;
}

.calendar-day.selected {
  border: 2px solid red;
}
.calendar-day.today{
  background: #86c9e8;
}

/* Library export/import buttons */
.library-controls {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.2rem;
}
.library-controls .lib-btn {
  /* background: #2b8a8a; */
  background-color: rgb(199, 171, 225);
  color: #fff;
  border: none;
  /* padding: 0.45rem 0.8rem; */
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}
.library-controls .lib-btn:hover { background: #246f6f; }
.info-btn {
  /* background: transparent; */
  border: 1px solid #888;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-weight: bold;
  font-style: italic;
  color: #f0e6e6;
  background-color: darkred;
}

.library-controls .info-btn:hover { background: #eef; }
#yearDisplay{
  /* position:absolute; */
  left: 150px;
  top: -0px;
  font-weight: normal;
  font-size: 10px;
}

.add-book-btn {
  display: flex;
  justify-content: center; /* Centers the button horizontally */
  margin-top: 0.5rem;      
  width: 100%;  
  margin-bottom: 0.5rem;

}

/* REPLACEMENT: enhanced style for the button itself */
.newBookBtn {
  background: #4ae7e7;; /* Darker green to differentiate from library buttons */
  color: #320572;      /* Warm white text */
  border: 1px solid #0e3d28;
  /* padding: 0.6rem 1.2rem; */
  padding: 0.2rem;

  border-radius: 20px; /* Pillow shape for a friendlier look */
  cursor: pointer;
  font-size: 0.75rem;
  font-family: 'playfair display', serif; /* Matching your fonts */
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  transition: all 0.2s ease;
  width: 80%; /* nice wide button */
}

.newBookBtn:hover {
  background: #3ce398;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.newBookBtn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.exportImportBtn {
  background-color: rgb(199, 171, 225);
  border-radius: 5px;
}

/* Control-panel: Delete this book button */
.delete-book-btn{
  display: flex;
  justify-content: center;
  width: 100%;
  margin-bottom: 0.5rem;
  ;
}

.deleteBookBtn{
  background: #ff4444;
  color: #fffbe7;
  border: 1px solid #821010;
  padding: 0.2rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.75rem;
  font-family: 'playfair display', serif;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  transition: all 0.2s ease;
  width: 80%;
}

.deleteBookBtn:hover{
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#mthDisplay{
  font-weight: normal;
  font-size: 10px;
  border: none;
}
.button{
  font-weight: normal;
  font-size: 20px;
}
.arrow-btn {
  font-size: 0.7rem;      /* Makes the arrow smaller */
  padding: 0.2em 0.5em; /* Optional: adjust button size */
  background: none;     /* Optional: remove default button background */
  border: none;         /* Optional: remove default button border */
  cursor: pointer;
}

/* draggable calendar handle + state */
/* Handle inside stack has higher z-index to handle drag */
.calendar-stack .calendar-day { pointer-events: auto; } 

.calendar-handle {
  position: absolute;
  top: -26px;        
  right: 5px;
  width: 34px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #c2eaeb;
  color: #fff;
  border-radius: 4px;
  cursor: grab;
  user-select: none;
  z-index: -1;
  font-size: 18px;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.calendar-handle:focus { outline: 2px solid #88d; box-shadow: 0 2px 6px rgba(0,0,0,0.35); }
.calendar-handle.dragging { cursor: grabbing; }
.calendar-stack.dragging { cursor: grabbing; }