
* {
  box-sizing: border-box;
}

.page {
  min-height: 100vh;
  background-color: #f5f5f5;
  padding: 20px;
  font-family: 'Arial', sans-serif;
}

.master-form-container {
  max-width: 800px;
  margin: 0 auto;
  background-color: white;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  width: 100%;
}

.master-form-container h2 {
  margin: 0 0 10px 0;
  font-size: clamp(20px, 4vw, 28px);
  color: #333;
  font-weight: 600;
}

.master-form-container p {
  margin: 0 0 30px 0;
  color: #666;
  font-size: clamp(14px, 2.5vw, 16px);
  line-height: 1.5;
}

/* ---------------- BUTTON ROW ---------------- */
.button-row {
  display: flex;
  gap: 15px;
  margin-bottom: 30px;
  flex-wrap: wrap;
  align-items: center;
}

.outline-btn {
  padding: 10px 20px;
  border: 2px solid #007bff;
  background-color: transparent;
  color: #007bff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  flex-shrink: 0;
  white-space: nowrap;
}

.outline-btn:hover,
.outline-btn.active {
  background-color: #007bff;
  color: white;
  transform: translateY(-1px);
}

/* ---------------- TAGS ---------------- */
.tag-section {
  margin-bottom: 25px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag {
  background-color: #e3f2fd;
  color: #1976d2;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #bbdefb;
}

/* ---------------- FIELDS ---------------- */
.field {
  display: flex;
  align-items: stretch;
  gap: 15px;
  flex-wrap: wrap;
}

.field label {
  font-weight: 600;
  color: #333;
  font-size: 14px;
  min-width: 80px;
  display: flex;
  align-items: center;
}

.field input {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  width: 100%;
}

.field input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.add-btn {
  background-color: #28a745;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.add-btn:hover {
  background-color: #218838;
  transform: translateY(-1px);
}

/* ---------------- DRAWER ---------------- */
.drawer {
  position: fixed;
  top: 0;
  right: -300px;
  width: 300px;
  height: 100vh;
  background-color: white;
  box-shadow: -3px 0 15px rgba(0, 0, 0, 0.2);
  transition: right 0.3s ease;
  z-index: 3000;
  overflow-y: auto;
}

.drawer.open {
  right: 0;
}

.drawer-content {
  padding: 60px 25px 120px;
  height: 100%;
  /* position: relative; */
}

/* Close Button */
.close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 28px;
  font-weight: bold;
  color: #000;          
  cursor: pointer;
  background: none;     
  border: none;
  z-index: 10;
}
.drawer.open .close-btn{
  right: 15px;
}

.close-btn:hover {
  color: #dc3545;       /* red on hover */
}


/* ---------------- GRADE ROWS ---------------- */
.grade-row {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 0 auto 25px;
  padding: 25px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 1px solid #dee2e6;
  border-radius: 12px;
  position: relative;
  width: 100%;
  max-width: 360px;
}

.grade-row input {
  padding: 16px 14px;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  font-size: 15px;
  width: 100%;
  height: 60px;
  background-color: white;
  font-weight: 500;
}

.remove-row {
  position: absolute;
  top: 12px;
  right: 12px;
  background-color: #dc3545;
  color: white;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.remove-row:hover {
  background-color: #c82333;
  transform: scale(1.1);
}

/* ---------------- ACTION BUTTONS ---------------- */
.action-row {
  margin: 25px 0;
  text-align: center;
}

.save-btn {
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  color: white;
  border: none;
  padding: 15px 35px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.save-btn:hover {
  transform: translateY(-2px);
}

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 992px) {
  .master-form-container {
    padding: 20px;
  }

  .button-row {
    gap: 10px;
  }

  .field {
    flex-direction: column;
    gap: 10px;
  }
}

@media (max-width: 768px) {
  .page {
    padding: 10px;
  }

  .master-form-container {
    padding: 15px;
    margin: 0 10px;
  }

  .button-row {
    flex-direction: column;
    align-items: stretch;
  }

  .outline-btn,
  .add-btn,
  .save-btn {
    width: 100%;
    justify-content: center;
  }

  .drawer {
    width: 100%;  
    right: -100%;
  }

  .drawer.open {
    right: 0;
  }

  .drawer-content {
    padding: 40px 15px 80px;
  }

  .drawer-actions {
    flex-direction: column;
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .grade-row {
    padding: 18px;
    max-width: 100%;
  }

  .grade-row input {
    height: 60px;
    font-size: 14px;
  }

  .save-btn {
    padding: 12px 20px;
    font-size: 15px;
  }

  .outline-btn {
    padding: 10px;
    font-size: 13px;
  }
}
/* === FIX for Close Button Visibility === */
.drawer-content {
  position: relative; 
}

.close-btn {
  position: absolute;   
  top: 15px;
  right: 15px;
  font-size: 28px;
  font-weight: bold;
  color: #000;         
  cursor: pointer;
  z-index: 9999;       
  display: block;      
}

.close-btn:hover {
  color: #dc3545;      
}
/* === Always Visible Close Button === */
.close-btn {
  position: absolute;  
  top: 15px;
  right: 15px;
  font-size: 28px;
  font-weight: bold;
  color: #333 !important;  
  cursor: pointer;
  z-index: 9999;
  display: block;
}

.close-btn:hover {
  color: #dc3545 !important;  
}
/* Fix for ADD button visibility inside input-row */
#input-rowaddbtn {

  flex-shrink: 0;          
  padding: 10px 20px;
  background-color: var(--buttonBg);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  
}

#input-rowaddbtn:hover {
  background-color: var(--buttonBgHover);
  transform: translateY(-1px);
}
/* Subject input field size fix */
.field input[type="text"] {
  flex: 0 0 70%;   /* take 70% width instead of full */
  max-width: 400px; /* optional: set a maximum width */
}
/* tag lists  */
.tag {
  display: inline-flex;
  align-items: center;
  background: #f0f0f0;
  padding: 6px 12px;
  margin: 5px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
}

.tag .remove-btn {
  margin-left: 8px;
  cursor: pointer;
  color: #777;
  font-weight: bold;
}

.tag .remove-btn:hover {
  color: red;
}
@media (max-width: 768px) {
  .field {
    flex-direction: column;   
    align-items: center;      
  }

  #input-rowaddbtn {
    width: auto;              
    margin-top: 10px;         
    display: block;
    margin-left: 105px;
  }
}
  /* .button-row button.active {
    background-color: #2e7d32;
    color: white;
  } */
/* Container for tags */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* Individual tag item */
.tag-item {
  background-color: #e0f7fa; /* light cyan background */
  color: #00796b; /* dark teal text */
  padding: 6px 10px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  font-size: 14px;
  position: relative;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
}

.tag-item:hover {
  transform: scale(1.05);
}

/* Text inside the tag */
.tag-item span {
  margin-right: 6px;
}

/* Cross button */
.delete-btn {
  background: #ff5252; /* red */
  color: white;
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: background 0.2s ease;
}

.delete-btn:hover {
  background: #d32f2f;
}
