/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: #e0e0e0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Login Page */
.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-container {
  background: #0f3460;
  border: 2px solid #e94560;
  border-radius: 10px;
  padding: 40px;
  max-width: 450px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(233, 69, 96, 0.3);
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
  border-bottom: 2px solid #e94560;
  padding-bottom: 20px;
}

.login-header h1 {
  color: #e94560;
  font-size: 28px;
  margin-bottom: 10px;
}

.login-header h2 {
  color: #f0f0f0;
  font-size: 20px;
  margin-bottom: 5px;
}

.login-header h3 {
  color: #b0b0b0;
  font-size: 16px;
  font-weight: normal;
}

.login-form {
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #f0f0f0;
  font-weight: 600;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px;
  background: #1a1a2e;
  border: 2px solid #533483;
  border-radius: 5px;
  color: #e0e0e0;
  font-size: 16px;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #e94560;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn-primary {
  background: #e94560;
  color: white;
  width: 100%;
}

.btn-primary:hover {
  background: #d63651;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(233, 69, 96, 0.4);
}

.btn-secondary {
  background: #533483;
  color: white;
  width: 100%;
  margin-top: 10px;
}

.btn-secondary:hover {
  background: #6b4499;
}

.btn-danger {
  background: #ff4444;
  color: white;
  padding: 8px 16px;
  font-size: 14px;
}

.btn-danger:hover {
  background: #cc0000;
}

.btn-success {
  background: #00c851;
  color: white;
  padding: 8px 16px;
  font-size: 14px;
}

.btn-success:hover {
  background: #007e33;
}

/* Error Message */
.error-message {
  color: #ff4444;
  margin-top: 15px;
  padding: 10px;
  background: rgba(255, 68, 68, 0.1);
  border-radius: 5px;
  text-align: center;
  display: none;
}

.error-message.show {
  display: block;
}

/* Divider */
.divider {
  text-align: center;
  margin: 20px 0;
  position: relative;
}

.divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #533483;
}

.divider span {
  background: #0f3460;
  padding: 0 15px;
  position: relative;
  color: #b0b0b0;
  font-size: 14px;
}

/* Form small text */
.form-group small {
  display: block;
  color: #b0b0b0;
  font-size: 12px;
  margin-top: 4px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
}

.modal.show {
  display: block;
}

.modal-content {
  background: #0f3460;
  margin: 5% auto;
  padding: 30px;
  border: 2px solid #e94560;
  border-radius: 10px;
  width: 90%;
  max-width: 700px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.close {
  color: #e94560;
  float: right;
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  line-height: 20px;
}

.close:hover {
  color: #ff6b81;
}

.help-content h2 {
  color: #e94560;
  margin-bottom: 20px;
}

.help-content h3 {
  color: #f0f0f0;
  margin-top: 20px;
  margin-bottom: 10px;
}

.help-content ul {
  margin-left: 20px;
  margin-bottom: 15px;
}

.help-content li {
  margin-bottom: 8px;
  line-height: 1.6;
}

.help-content code {
  background: #1a1a2e;
  padding: 2px 6px;
  border-radius: 3px;
  color: #e94560;
}

/* Main Header */
.main-header {
  background: #0f3460;
  border-bottom: 3px solid #e94560;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.header-content {
  max-width: 95%;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.header-content h1 {
  color: #e94560;
  font-size: 24px;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.user-info {
  color: #f0f0f0;
  font-weight: 600;
  padding: 8px 16px;
  background: #1a1a2e;
  border-radius: 5px;
}

.header-actions .btn {
  width: auto;
  margin: 0;
  padding: 10px 20px;
  font-size: 14px;
}

/* Main Content */
.main-content {
  max-width: 95%;
  margin: 20px auto;
  padding: 0 20px;
}

/* Supervisor Section */
.supervisor-section {
  background: #0f3460;
  border: 2px solid #533483;
  border-radius: 10px;
  padding: 25px;
  margin-bottom: 30px;
}

.supervisor-section h2 {
  color: #e94560;
  margin-bottom: 20px;
}

.duty-form .form-row {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1.5fr auto;
  gap: 15px;
  align-items: end;
}

.duty-form .form-group {
  margin-bottom: 0;
}

.duty-form .btn {
  width: auto;
  white-space: nowrap;
}

/* Duty Board */
.duty-board h2 {
  color: #e94560;
  margin-bottom: 20px;
  font-size: 22px;
}

.duty-table-container {
  background: #0f3460;
  border: 2px solid #533483;
  border-radius: 10px;
  overflow-x: auto;
}

.duty-table {
  width: 100%;
  border-collapse: collapse;
}

.duty-table thead {
  background: #1a1a2e;
  border-bottom: 2px solid #e94560;
}

.duty-table th {
  padding: 15px;
  text-align: left;
  color: #e94560;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 14px;
  letter-spacing: 0.5px;
}

.duty-table td {
  padding: 15px;
  border-bottom: 1px solid #533483;
  color: #e0e0e0;
}

.duty-table tbody tr:hover {
  background: rgba(83, 52, 131, 0.2);
}

.duty-table tbody tr:last-child td {
  border-bottom: none;
}

.duty-table .loading {
  text-align: center;
  color: #b0b0b0;
  font-style: italic;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-pending {
  background: #ffa500;
  color: #000;
}

.status-completed {
  background: #00c851;
  color: #fff;
}

.status-overdue {
  background: #ff4444;
  color: #fff;
  font-weight: bold;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Overdue Row Styling */
.duty-table tbody tr.overdue {
  background: rgba(255, 68, 68, 0.1);
}

.duty-table tbody tr.overdue td {
  color: #ff4444;
  font-weight: bold;
}

/* Actions Column */
.action-buttons {
  display: flex;
  gap: 8px;
}

/* Filter Section */
.filter-section {
  background: #0f3460;
  border: 2px solid #533483;
  border-radius: 10px;
  padding: 25px;
  margin-bottom: 30px;
}

.filter-section h2 {
  color: #e94560;
  margin-bottom: 20px;
}

.filter-form .form-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr auto auto auto;
  gap: 15px;
  align-items: end;
}

/* Print Styles */
@media print {
  body {
    background: white;
    color: black;
  }

  .no-print {
    display: none !important;
  }

  .print-header {
    display: block !important;
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 2px solid black;
    padding-bottom: 20px;
  }

  .print-header h1 {
    font-size: 24px;
    margin-bottom: 5px;
  }

  .print-header h2 {
    font-size: 18px;
    margin-bottom: 5px;
  }

  .print-header h3 {
    font-size: 16px;
    margin-bottom: 10px;
  }

  .print-date {
    font-size: 12px;
    color: #666;
  }

  .duty-table-container {
    background: white;
    border: 1px solid black;
  }

  .duty-table {
    color: black;
  }

  .duty-table thead {
    background: #f0f0f0;
    border-bottom: 2px solid black;
  }

  .duty-table th {
    color: black;
    border: 1px solid black;
  }

  .duty-table td {
    border: 1px solid black;
    color: black;
  }

  .print-signature {
    display: block !important;
    margin-top: 50px;
    page-break-inside: avoid;
  }

  .print-signature p {
    margin: 20px 0;
    font-size: 14px;
  }
}

.print-header {
  display: none;
}

.print-signature {
  display: none;
}

/* Archive Section */
.archive-section {
  background: #0f3460;
  border: 2px solid #533483;
  border-radius: 10px;
  padding: 25px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 2px solid #533483;
}

.tab-button {
  padding: 12px 24px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: #b0b0b0;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.tab-button:hover {
  color: #e0e0e0;
}

.tab-button.active {
  color: #e94560;
  border-bottom-color: #e94560;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Operators Table */
.operators-list,
.areas-management {
  background: #0f3460;
  border: 2px solid #533483;
  border-radius: 10px;
  padding: 25px;
}

.operators-list h2,
.areas-management h2 {
  color: #e94560;
  margin-bottom: 20px;
}

.operators-list h3,
.areas-management h3 {
  color: #f0f0f0;
  margin-bottom: 15px;
  margin-top: 20px;
}

.add-area-section {
  background: #1a1a2e;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 30px;
  border: 1px solid #533483;
}

.areas-list-section {
  margin-top: 20px;
}

.area-form .form-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 15px;
  align-items: end;
}

.area-form .form-group {
  margin-bottom: 0;
}

.operators-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.stat-card {
  background: #1a1a2e;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #533483;
}

.stat-card h4 {
  color: #b0b0b0;
  font-size: 14px;
  margin-bottom: 8px;
}

.stat-card .stat-value {
  color: #e94560;
  font-size: 24px;
  font-weight: bold;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .duty-form .form-row,
  .filter-form .form-row,
  .area-form .form-row {
    grid-template-columns: 1fr;
  }

  .duty-form .btn,
  .filter-form .btn,
  .area-form .btn {
    width: 100%;
  }

  .duty-table {
    font-size: 14px;
  }

  .duty-table th,
  .duty-table td {
    padding: 10px 8px;
  }

  .operators-stats {
    grid-template-columns: 1fr;
  }

  .tabs {
    flex-wrap: wrap;
  }

  .tab-button {
    flex: 1;
    min-width: 120px;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 14px;
  }

  .header-content {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }

  .header-content h1 {
    font-size: 18px;
  }

  .header-actions {
    width: 100%;
    justify-content: center;
  }

  .user-info {
    width: 100%;
    text-align: center;
  }

  /* Make tables horizontally scrollable on mobile */
  .duty-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .duty-table {
    min-width: 800px;
    font-size: 13px;
  }

  .duty-table th,
  .duty-table td {
    padding: 8px 6px;
    white-space: nowrap;
  }

  /* Adjust buttons for mobile */
  .action-buttons {
    flex-direction: column;
    gap: 5px;
  }

  .action-buttons .btn {
    width: 100%;
    padding: 6px 12px;
    font-size: 12px;
  }

  /* Login page mobile */
  .login-container {
    padding: 20px;
    max-width: 100%;
  }

  .login-header h1 {
    font-size: 22px;
  }

  .login-header h2 {
    font-size: 18px;
  }

  /* Modal adjustments */
  .modal-content {
    width: 95%;
    margin: 10% auto;
    padding: 20px;
    max-height: 85vh;
  }

  /* Tabs mobile */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }

  .tab-button {
    font-size: 14px;
    padding: 10px 16px;
    white-space: nowrap;
  }

  /* Stats cards mobile */
  .operators-stats {
    grid-template-columns: 1fr;
  }

  .stat-card {
    text-align: center;
  }

  /* Sections padding */
  .supervisor-section,
  .filter-section,
  .archive-section,
  .operators-list,
  .areas-management {
    padding: 15px;
  }

  .main-content {
    padding: 0 10px;
    margin: 20px auto;
  }

  /* Form groups */
  .form-group label {
    font-size: 14px;
  }

  .form-group input,
  .form-group select {
    font-size: 14px;
    padding: 10px;
  }

  /* Status badges */
  .status-badge {
    font-size: 11px;
    padding: 4px 10px;
  }
}

@media (max-width: 480px) {
  .header-content h1 {
    font-size: 16px;
  }

  .btn {
    font-size: 14px;
    padding: 10px 16px;
  }

  .duty-table {
    font-size: 12px;
  }

  .duty-table th,
  .duty-table td {
    padding: 6px 4px;
  }

  .login-header h1 {
    font-size: 20px;
  }

  .login-header h2 {
    font-size: 16px;
  }

  .login-header h3 {
    font-size: 14px;
  }

  .tab-button {
    font-size: 13px;
    padding: 8px 12px;
  }

  .stat-card .stat-value {
    font-size: 20px;
  }
}

/* Landscape orientation for tablets */
@media (max-width: 1024px) and (orientation: landscape) {
  .duty-table {
    font-size: 13px;
  }

  .header-content {
    flex-direction: row;
  }

  .operators-stats {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
  /* Increase touch targets */
  .btn {
    min-height: 44px;
    padding: 12px 20px;
  }

  .tab-button {
    min-height: 44px;
  }

  input,
  select,
  button {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  /* Better spacing for touch */
  .action-buttons {
    gap: 10px;
  }

  .tabs {
    gap: 5px;
  }
}
