/* =========================
   GENERAL STYLES
========================= */

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background-color: #f9f9f9;
  margin: 0;
  padding: 0;
  line-height: 1.6;
}

.container {
  width: 90%;
  max-width: 900px;
  margin: 40px auto;
  background: #ffffff;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

h1 {
  text-align: center;
  color: #333;
  font-size: 2rem;
}

h2 {
  margin-top: 30px;
  border-bottom: 2px solid #007bff;
  padding-bottom: 8px;
  color: #007bff;
}

h3 {
  margin-top: 20px;
  border-bottom: 1px solid #ccc;
  padding-bottom: 5px;
  color: #555;
}

/* =========================
   FORMS & INPUTS
========================= */

.form-group {
  margin-bottom: 15px;
}

label {
  display: block;
  font-weight: bold;
  margin-bottom: 8px;
}

input,
select,
button {
  width: 100%;
  padding: 10px;
  font-size: 1rem;
  margin-bottom: 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box; /* Ensures padding doesn't affect width */
}

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

button {
  background-color: #007bff;
  color: white;
  border: none;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.3s ease;
}

button:hover {
  background-color: #0056b3;
}

.secondary-btn {
  background-color: #6c757d;
}

.secondary-btn:hover {
  background-color: #5a6268;
}

/* =========================
   TABS & NAVIGATION
========================= */

.tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 25px;
  border-bottom: 1px solid #ddd;
  padding-bottom: 10px;
}

.tab-btn {
  padding: 10px 20px;
  cursor: pointer;
  background: #f1f1f1;
  border: 1px solid #ccc;
  border-radius: 6px;
  color: #333;
  width: auto;
  transition: 0.3s;
}

.tab-btn.active {
  background: #007bff;
  color: white;
  border-color: #007bff;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* =========================
   DYNAMIC INPUT GROUPS
========================= */

.allowance-input-group,
.deduction-input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.allowance-input-group input,
.deduction-input-group input {
  flex: 1;
}

.remove-btn {
  width: 40px;
  background: #dc3545;
  padding: 5px;
}

/* =========================
   TABLE STYLES
========================= */

.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin-top: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px; /* Ensures table doesn't squash too much */
}

th, td {
  border: 1px solid #ddd;
  padding: 12px;
  text-align: left;
}

th {
  background-color: #f2f2f2;
}

/* =========================
   VIDEO LIBRARY
========================= */

.video-library {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.video-card {
  background: #ffffff;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 3px 8px rgba(0,0,0,0.05);
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 18px rgba(0,0,0,0.12);
}

.video-card iframe {
  width: 100%;
  height: 200px;
  border: none;
}

.video-card h4 {
  margin: 12px 14px 6px 14px;
  font-size: 1rem;
}

.video-card p {
  margin: 0 14px 14px 14px;
  font-size: 0.9rem;
  color: #666;
}

/* =========================
   MOBILE RESPONSIVENESS (Media Queries)
========================= */

/* Tablets and smaller */
@media screen and (max-width: 768px) {
  .container {
    width: 95%;
    margin: 20px auto;
    padding: 15px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .tabs {
    flex-wrap: wrap; /* Allows buttons to wrap to next line */
  }

  .tab-btn {
    flex: 1 1 45%; /* Two buttons per row on tablets */
    padding: 12px 10px;
    font-size: 0.9rem;
  }
}

/* Smartphones */
@media screen and (max-width: 480px) {
  .tab-btn {
    flex: 1 1 100%; /* One button per row on phones */
  }

  .allowance-input-group,
  .deduction-input-group {
    flex-direction: column; /* Stacks name and amount vertically */
    gap: 5px;
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 6px;
  }

  .remove-btn {
    width: 100%;
    margin-top: 5px;
  }

  .video-library {
    grid-template-columns: 1fr; /* Single column for videos */
  }
  
  /* Make tables readable via scrolling */
  .table-responsive {
    border: 1px solid #ddd;
  }
}

/* =========================
   UTILITIES
========================= */

.highlight-red {
  border: 2px solid #dc3545 !important;
  background-color: #f8d7da !important;
}