/* ===========================
   UNIFIED STYLES FOR COMPANY INTERNAL TOOLS
   =========================== */

/* ===========================
   CSS VARIABLES
   =========================== */
:root {
  /* Background Colors */
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --bg-tertiary: #3c3c3c;
  --bg-header: #424242;
  
  /* Text Colors */
  --text-primary: #e0e0e0;
  --text-secondary: #999;
  --text-disabled: #666;
  
  /* Border Colors */
  --border-primary: #444;
  --border-secondary: #555;
  --border-focus: #777;
  
  /* Accent Colors */
  --accent-green: #4CAF50;
  --accent-green-hover: #45a049;
  --accent-green-active: #3e8e41;
  
  /* Status Colors */
  --status-success: #28a745;
  --status-error: #dc3545;
  --status-warning: #ffa500;
  --status-info: #2196f3;
  
  /* Button Colors */
  --btn-blue: #1976d2;
  --btn-blue-hover: #1565c0;
  --btn-orange: #ff8c00;
  --btn-orange-hover: #e07c00;
  
  /* Common Values */
  --transition-standard: 0.3s ease;
  --radius-small: 6px;
  --radius-medium: 8px;
  --radius-large: 12px;
  
  /* Shadows */
  --shadow-standard: 0 4px 15px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.4);
}

/* ===========================
   BASE STYLES
   =========================== */
body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 20px;
  min-height: 100vh;
  font-size: 16px;
}

h1, h2 {
  color: var(--text-primary);
  border-left: 5px solid var(--border-secondary);
  padding-left: 15px;
  margin-bottom: 30px;
  font-weight: 300;
}

/* ===========================
   CONTAINER COMPONENTS
   =========================== */
.container {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-standard);
  border: 1px solid var(--border-primary);
  margin-bottom: 20px;
}

/* ===========================
   FORM COMPONENTS
   =========================== */
input[type="text"], 
input[type="email"], 
input[type="date"], 
input[type="number"], 
input[type="password"],
select, 
textarea {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-secondary);
  color: var(--text-primary);
  padding: 12px 15px;
  font-size: 1rem;
  border-radius: 12px;
  transition: all 0.3s ease;
  box-sizing: border-box;
  width: 100%;
}

input:focus, 
select:focus, 
textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 10px rgba(119, 119, 119, 0.3);
}

input::placeholder {
  color: var(--text-secondary);
}

input:disabled {
  background: #2a2a2a;
  color: var(--text-disabled);
  cursor: not-allowed;
}

/* Form Layout */
.form-row {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
  align-items: center;
}

.form-row label {
  min-width: 120px;
  font-weight: 500;
}

.form-row input,
.form-row select {
  flex: 1;
}

/* ===========================
   BUTTON COMPONENTS
   =========================== */
button, .btn {
  background: var(--accent-green);
  border: 1px solid var(--accent-green-hover);
  color: white;
  padding: 10px 16px;
  cursor: pointer;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

button:hover, .btn:hover {
  background: var(--accent-green-hover);
  border-color: var(--accent-green-active);
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

button:active, .btn:active {
  transform: translateY(0);
}

/* Button Variants */
.btn-danger {
  background: var(--status-error);
  border-color: #c82333;
}

.btn-danger:hover {
  background: #c82333;
  border-color: #bd2130;
}

.btn-info {
  background: var(--status-info);
  border-color: #1e7e34;
}

.btn-info:hover {
  background: #1e7e34;
  border-color: #1c7430;
}

.btn-add,
.btn-pdf,
.btn-accept {
  background: var(--status-info);
  color: white;
  border: 1px solid var(--btn-blue);
  padding: 10px 20px;
  white-space: nowrap;
  border-radius: var(--radius-medium);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition-standard);
  flex-shrink: 0;
}

.btn-add:hover,
.btn-pdf:hover,
.btn-accept:hover {
  background: var(--btn-blue);
  border-color: var(--btn-blue-hover);
}

.btn-reject {
  background: var(--status-error);
  color: white;
  border-color: #c82333;
}

.btn-reject:hover {
  background: #c82333;
  border-color: #bd2130;
}

.config-button {
  padding: 12px 18px;
  font-size: 1rem;
  text-decoration: none;
  display: inline-block;
}

/* ===========================
   TABLE COMPONENTS
   =========================== */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-standard);
  margin-bottom: 20px;
}

th, td {
  border: 1px solid var(--border-primary);
  padding: 12px;
  text-align: left;
  font-size: 16px;
}

th {
  background: var(--bg-header);
  color: var(--text-primary);
  font-weight: 500;
}

tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.05);
}

tr:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* ===========================
   NAVIGATION COMPONENTS
   =========================== */
.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 15px;
}

.nav-buttons {
  display: flex;
  align-items: center;
  gap: 15px;
}

.nav-buttons a {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding: 10px 15px;
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.3s;
}

.nav-buttons a:hover {
  background: var(--border-secondary);
}

.nav-buttons .active,
.nav-buttons .current {
  background: var(--accent-green) !important;
  border-color: var(--accent-green-hover) !important;
}

/* ===========================
   SEARCH AND FILTER COMPONENTS
   =========================== */
.search-container {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.search-container input[type="text"] {
  flex: 0 1 300px;
  min-width: 200px;
  max-width: 300px;
}

.search-container label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  white-space: nowrap;
}

.search-container input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--border-secondary);
  padding: 0;
}

.search-sort-container {
  display: flex;
  gap: 15px;
  margin-bottom: 30px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

/* ===========================
   STATUS AND BADGE COMPONENTS
   =========================== */
.status-success {
  color: var(--status-success);
  font-weight: bold;
}

.status-error {
  color: var(--status-error);
  font-weight: bold;
}

.status-warning {
  color: var(--status-warning);
  font-weight: bold;
}

.status-pending-text {
  color: var(--text-secondary);
  font-style: italic;
}

.badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: bold;
}

.badge-success {
  background: var(--status-success);
  color: white;
}

.badge-error {
  background: var(--status-error);
  color: white;
}

.badge-warning {
  background: var(--status-warning);
  color: white;
}

.status-badge {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: bold;
  text-align: center;
  display: inline-block;
  min-width: 80px;
  border-radius: 4px;
}

.status-pending-badge {
  background: var(--status-warning);
  color: #000;
}

.status-accepted {
  background: var(--status-success);
  color: #fff;
}

.status-rejected {
  background: var(--status-error);
  color: #fff;
}

/* ===========================
   ACTION BUTTONS
   =========================== */
.action-buttons {
  display: flex;
  gap: 5px;
  justify-content: center;
  min-width: 120px;
  min-height: 30px;
  align-items: center;
}

.invoice-actions {
  white-space: nowrap;
}

.invoice-actions .button-link,
.invoice-actions button {
  display: inline-block;
  width: 55px;
  padding: 8px 6px;
  background: var(--accent-green);
  color: white;
  border: 1px solid var(--accent-green-hover);
  cursor: pointer;
  text-decoration: none;
  font: inherit;
  text-align: center;
  box-sizing: border-box;
  border-radius: 6px;
  transition: all 0.3s ease;
  margin-right: 4px;
  font-size: 12px;
}

.invoice-actions .button-link:hover,
.invoice-actions button:hover {
  background: var(--accent-green-hover);
  border-color: var(--accent-green-active);
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.invoice-actions .pdf-button {
  background: var(--btn-orange);
  border-color: var(--btn-orange-hover);
}

.invoice-actions .pdf-button:hover {
  background: var(--btn-orange-hover);
  border-color: #cc6f00;
}

.invoice-actions .json-button {
  background: var(--status-success);
  border-color: #1e7e34;
}

.invoice-actions .json-button:hover {
  background: #1e7e34;
  border-color: #155724;
}

.invoice-actions .delete-button {
  background: var(--status-error);
  border-color: #c82333;
}

.invoice-actions .delete-button:hover {
  background: #c82333;
  border-color: #bd2130;
  transform: translateY(-1px);
}

.invoice-actions .disabled {
  background: #666;
  border-color: #555;
  cursor: not-allowed;
  opacity: 0.6;
}

.invoice-actions .disabled:hover {
  background: #666;
  border-color: #555;
  transform: none;
}

/* ===========================
   PAGINATION
   =========================== */
#pagination,
#pagination_tyg {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin: 20px 0;
}

#pagination button,
#pagination_tyg button,
.page-button {
  background: var(--border-secondary);
  border: 1px solid var(--text-disabled);
  color: white;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.3s ease;
}

#pagination button:hover,
#pagination_tyg button:hover,
.page-button:hover {
  background: var(--border-focus);
}

#pagination button.active,
#pagination_tyg button.active,
.page-button.active,
.page-button[style*="font-weight: bold"] {
  background: var(--accent-green);
  border-color: var(--accent-green-hover);
}

.page-button:active,
select.page-button:focus {
  background: var(--bg-primary);
  border-color: var(--border-focus);
}

/* ===========================
   LAYOUT COMPONENTS
   =========================== */
.books-layout,
.programs-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: flex-start;
  margin-bottom: 40px;
}

.books-column,
.programs-column {
  flex: 1;
  min-width: 280px;
  max-width: none;
}

.books-image {
  max-height: 80px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.books-link {
  color: white;
  text-decoration: none;
  background: #ff8f00;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid #ff6f00;
  transition: all 0.3s ease;
  display: inline-block;
  font-size: 14px;
  white-space: nowrap;
}

.books-link:hover {
  background: #ff6f00;
  border-color: #e65100;
  transform: translateY(-1px);
}

.program {
  transition: all 0.3s ease;
}

.program:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.program button {
  width: 100%;
  max-width: 150px;
  margin: 10px 0;
}

.program a {
  color: white;
  text-decoration: none;
}

.program h2 {
  font-size: 1.3rem;
  margin-bottom: 15px;
}

.week-display {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--text-primary);
}

/* ===========================
   ATTENDANCE TABLE SPECIFIC
   =========================== */
.attendance-table {
  table-layout: fixed;
  width: 100%;
}

.attendance-table th:first-child,
.attendance-table td:first-child {
  text-align: left;
  font-weight: bold;
  width: 150px !important;
}

.attendance-table th:nth-child(2),
.attendance-table th:nth-child(3),
.attendance-table th:nth-child(4),
.attendance-table th:nth-child(5),
.attendance-table th:nth-child(6),
.attendance-table th:nth-child(7),
.attendance-table td:nth-child(2),
.attendance-table td:nth-child(3),
.attendance-table td:nth-child(4),
.attendance-table td:nth-child(5),
.attendance-table td:nth-child(6),
.attendance-table td:nth-child(7) {
  width: calc((100% - 150px) / 6) !important;
  min-width: 120px;
  max-width: none;
}

.day-cell {
  font-size: 13px;
  line-height: 1.3;
  text-align: center;
  height: 60px;
  vertical-align: middle;
}

.editable {
  cursor: pointer;
  transition: background-color 0.2s;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.time-entry {
  color: #90EE90;
}

.time-exit {
  color: #FFB347;
}

.time-entry.editable,
.time-exit.editable {
  text-align: center;
  box-sizing: border-box;
}

.time-total {
  color: #87CEEB;
  font-weight: bold;
}

.late {
  background: rgba(255, 165, 0, 0.3);
  border-radius: 4px;
  padding: 2px 4px;
}

/* ===========================
   UTILITY CLASSES
   =========================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.p-20 { padding: 20px; }

.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}

.pagination-nav {
  display: inline-block;
}

/* ===========================
   MOBILE RESPONSIVENESS
   =========================== */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  
  .nav-container {
    flex-direction: column;
    align-items: stretch;
  }
  
  .nav-buttons {
    justify-content: center;
  }
  
  .search-container,
  .search-sort-container {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  
  .search-container input[type="text"],
  .search-sort-container input[type="text"] {
    max-width: 100%;
    width: 100%;
  }
  
  table {
    font-size: 11px;
  }
  
  th, td {
    padding: 6px 4px;
  }
  
  .day-cell {
    font-size: 9px;
  }
  
  button, .btn {
    padding: 8px 12px;
    font-size: 12px;
  }
  
  .form-row {
    flex-direction: column;
    align-items: stretch;
  }
  
  .form-row label {
    min-width: auto;
    margin-bottom: 5px;
  }
  
  .books-layout,
  .programs-layout {
    flex-direction: column;
  }
  
  .books-column,
  .programs-column {
    min-width: 100%;
    max-width: none;
  }
  
  .books-link {
    padding: 4px 8px;
    font-size: 12px;
  }
  
  .btn-add {
    width: 100%;
    max-width: 100%;
  }
  
  .action-buttons {
    gap: 2px;
    min-width: 80px;
  }
  
  .invoice-actions .button-link {
    width: 50px;
    padding: 4px 8px;
    font-size: 10px;
    margin: 1px;
  }
}

/* ===========================
   TABLET RESPONSIVENESS
   =========================== */
@media (max-width: 1024px) {
  .programs-layout {
    flex-direction: column;
  }
  
  .programs-column {
    max-width: none;
  }
}