/* ======== Global Styles ======== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Arial', sans-serif;
  background: #f8f9fa;
  color: #2c3e50;
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
}

/* ======== Header ======== */
.header {
  text-align: center;
  margin-bottom: 50px;
  padding: 30px 0;
}

#title {
  font-size: 36px;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: 16px;
  color: #7f8c8d;
  font-weight: 400;
}

/* ======== Section Headers ======== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 15px;
}

.section-title {
  font-size: 22px;
  font-weight: 600;
  color: #2c3e50;
}

.subjects-section,
.notes-section {
  margin-bottom: 50px;
}

/* ======== Buttons ======== */
button {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.2s ease;
  font-size: 14px;
  font-family: inherit;
}

button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

button:active {
  transform: scale(0.98);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-icon {
  font-size: 18px;
  font-weight: 600;
}

.btn-primary {
  background: #3498db;
  color: white;
}

.btn-primary:hover {
  background: #2980b9;
}

.btn-secondary {
  background: #95a5a6;
  color: white;
}

.btn-secondary:hover {
  background: #7f8c8d;
}

.btn-success {
  background: #27ae60;
  color: white;
  width: 100%;
  padding: 12px;
  margin-top: 10px;
}

.btn-success:hover {
  background: #229954;
}

/* ======== Modal Overlay ======== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.modal-overlay.active {
  display: block;
}

/* ======== Modals ======== */
.modal {
  display: none;
  background: white;
  width: 420px;
  max-width: 90%;
  padding: 30px;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 1000;
  border: 1px solid #e0e0e0;
}

.modal.active {
  display: block;
}

.modal-close {
  position: absolute;
  top: 15px;
  left: 15px;
  background: #f5f5f5;
  font-size: 24px;
  font-weight: 400;
  color: #7f8c8d;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.modal-close:hover {
  background: #e74c3c;
  color: white;
}

.modal-title {
  font-size: 22px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 25px;
  text-align: center;
}

/* ======== Form Styles ======== */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #2c3e50;
  margin-bottom: 6px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 11px 14px;
  border-radius: 6px;
  border: 1px solid #ddd;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
  background: white;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
  border-color: #3498db;
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237f8c8d' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  padding-left: 35px;
}

/* ======== Subjects List ======== */
.Subjects {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.Subject {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto auto auto;
  gap: 15px;
  align-items: center;
  padding: 18px 20px;
  border-radius: 8px;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.Subject:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.Subject h4 {
  font-size: 15px;
  font-weight: 600;
  color: #2c3e50;
}

.Subject .hPresent {
  font-weight: 700;
  font-size: 16px;
}

.Subject button {
  padding: 7px 14px;
  border-radius: 5px;
  font-size: 13px;
  color: white;
  font-weight: 500;
  min-width: 40px;
}

#Plus { 
  background: #27ae60;
}

#Plus:hover {
  background: #229954;
}

#Minus { 
  background: #f39c12;
}

#Minus:hover {
  background: #e67e22;
}

#Delete { 
  background: #e74c3c;
}

#Delete:hover {
  background: #c0392b;
}

/* ======== Notes List ======== */
.Notes {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.Note {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  padding: 16px 20px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  border: 1px solid #e0e0e0;
  transition: all 0.2s ease;
}

.Note:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.Note h6 {
  font-size: 15px;
  font-weight: 500;
  color: #2c3e50;
  flex: 1;
}

#deleteNoteBtn {
  background: #e74c3c;
  color: white;
  padding: 8px 16px;
  border-radius: 5px;
  font-size: 13px;
}

#deleteNoteBtn:hover {
  background: #c0392b;
}

/* ======== Empty States ======== */
.Subjects:empty::before,
.Notes:empty::before {
  content: 'لا توجد عناصر بعد';
  display: block;
  text-align: center;
  padding: 40px;
  color: #95a5a6;
  font-size: 15px;
  background: white;
  border-radius: 8px;
  border: 2px dashed #ddd;
}

.Notes:empty::before {
  content: 'لا توجد ملاحظات بعد';
}

/* ======== Animations ======== */
@keyframes appear {
  from { 
    opacity: 0; 
    transform: translateY(-10px); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0); 
  }
}

@keyframes del {
  from { 
    opacity: 1; 
    transform: translateY(0); 
  }
  to { 
    opacity: 0; 
    transform: translateY(-10px); 
  }
}

/* ======== Responsive Design ======== */
@media (max-width: 768px) {
  #title {
    font-size: 28px;
  }
  
  .section-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
  
  .Subject {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .Subject button {
    width: 100%;
  }
  
  .modal {
    width: 95%;
    padding: 24px;
  }
}