/* Global styles */
* {
  margin: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background: #f5f5f5;
}

.container {
  margin: 0 auto;
  max-width: 1400px;
  background: white;
  border-radius: 10px;
  padding: 20px;
}

h1 {
  text-align: center;
  color: #333;
  margin-bottom: 30px;
}

/* Header styles */
.header {
  background-color: #333;
  padding: 15px 30px;
  border-bottom: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition:
    background-color 0.3s,
    border-color 0.3s;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo img {
  width: 40px;
  height: 40px;
}

.logo-text {
  font-size: 20px;
  font-weight: bold;
  color: #fff;
}

.nav-menu {
  display: flex;
  gap: 25px;
}

.nav-menu a {
  text-decoration: none;
  color: #fff;
  font-weight: 500;
  transition: color 0.3s;
  padding: 5px 10px;
  border-radius: 5px;
}

.nav-menu a:hover {
  color: #007bff;
  background-color: #fff;
}

/* Theme switcher */
.theme-switcher {
  display: flex;
  align-items: center;
  gap: 10px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #007bff;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

/* Timezone selector */
.timezone-selector {
  margin-bottom: 15px;
}

.open-tz-modal-btn {
  font-size: 15px;
  padding: 10px 20px;
}

/* Modal */
.tz-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.tz-modal-overlay.open {
  display: flex;
}

.tz-modal {
  background: #fff;
  border-radius: 10px;
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.tz-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #ddd;
}

.tz-modal-header h3 {
  margin: 0;
}

.tz-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #555;
}

.tz-search {
  margin: 12px 20px;
  padding: 8px 12px;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 15px;
  outline: none;
  width: calc(100% - 40px);
}

.tz-search:focus {
  border-color: #007bff;
}

.timezone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 8px;
  overflow-y: auto;
  padding: 0 20px 16px;
  flex: 1;
}

.timezone-item {
  display: flex;
  align-items: center;
  padding: 5px;
}

.timezone-item input[type="checkbox"] {
  margin-right: 8px;
  width: auto;
}

.timezone-item.hidden {
  display: none;
}

/* Live clocks */
.live-clocks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin-bottom: 30px;
}

.clock {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 10px;
  padding: 20px;
  min-width: 200px;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.clock h3 {
  font-size: 16px;
  margin-bottom: 10px;
  opacity: 0.9;
}

.clock .time {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 5px;
}

.clock .date {
  font-size: 14px;
  opacity: 0.8;
}

.no-clocks {
  text-align: center;
  color: #666;
  font-style: italic;
  padding: 40px;
}

/* Time converter */
.time-converter {
  margin-top: 30px;
}

.converter-controls {
  display: flex;
  align-items: center;
  margin-top: 10px;
  gap: 15px;
  margin-bottom: 10px;
  flex-wrap: wrap;
  justify-content: space-between;
}

.time-input {
  padding: 8px 12px;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
}
.time-input#modeSelector {
  padding: 10px 10px;
}
.btn {
  padding: 8px 16px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s;
}

.btn:hover {
  background: #0056b3;
}

.conversion-table {
  width: 100%;
  border-collapse: collapse;
}

.conversion-table th,
.conversion-table td {
  border: 1px solid #ddd;
  padding: 12px;
  text-align: center;
}

.conversion-table th {
  background: #f8f9fa;
  font-weight: bold;
}

.conversion-table tr:nth-child(even) {
  background: #f9f9f9;
}

.bd-time {
  background: #e3f2fd !important;
  font-weight: bold;
}

.remove-row {
  background: #dc3545;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.3s;
}

.remove-row:hover {
  background: #c82333;
}

.time-display {
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 3px;
  min-height: 20px;
}

.time-display:hover {
  background: #f0f0f0;
}

.time-input-edit {
  width: auto;
  border: 2px solid #007bff;
  border-radius: 3px;
  font-size: 14px;
}

.copy-btn {
  background: #28a745;
  color: white;
  border: none;
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 10px;
  margin-left: 5px;
  transition: background-color 0.3s;
}

.copy-btn:hover {
  background: #218838;
}

.timezone-cell {
  position: relative;
}

.cell-copy {
  position: absolute;
  top: 2px;
  right: 2px;
  opacity: 0;
  transition: opacity 0.2s;
}

.timezone-cell:hover .cell-copy,
.bd-time:hover .cell-copy {
  opacity: 1;
}

/* Features section */
.features {
  margin-top: 50px;
  padding: 40px 0;
  background: #f8f9fa;
  border-radius: 10px;
}

.features h2 {
  text-align: center;
  margin-bottom: 30px;
  color: #333;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  padding: 0 20px;
}

.feature {
  text-align: center;
  padding: 20px;
}

.feature h3 {
  margin-bottom: 15px;
  color: #333;
}

.feature p {
  color: #666;
  line-height: 1.6;
}

/* Footer styles */
.footer {
  background: #333;
  color: white;
  padding: 40px 0;
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  padding: 0 20px;
}

.newsletter {
  text-align: left;
}

.newsletter h3 {
  margin-bottom: 15px;
  color: #fff;
}

.newsletter p {
  margin-bottom: 20px;
  color: #ccc;
}

.newsletter-form {
  display: flex;
  gap: 10px;
}

.newsletter input {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 5px;
}

.newsletter button {
  padding: 10px 20px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.newsletter button:hover {
  background: #0056b3;
}

.footer-links {
  text-align: right;
}

.footer-links h3 {
  margin-bottom: 15px;
}

.footer-links a {
  color: #ccc;
  text-decoration: none;
  display: block;
  margin-bottom: 10px;
}

.footer-links a:hover {
  color: #fff;
}
label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  color: #333;
}
@media (max-width: 1024px) {
  .cell-copy {
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
  }
  #converterTitle {
    font-size: 100%;
  }
  .live-clocks {
    gap: 10px;
    margin-bottom: 10px;
  }
  .footer-links {
    text-align: center;
  }
  .ControlsBtn-group {
    display: flex;
    gap: 10px;
  }
  .logo-text {
    display: none;
  }
  .converter-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .time-input {
    width: 100%;
    padding: 2px 6px;
  }
  .time-input#modeSelector {
    padding: 4px 4px;
  }
  .btn {
    width: 100%;
    padding: 1px 1px;
  }

  /* Responsive table */
  .conversion-table thead {
    display: none;
  }

  .conversion-table tr {
    border: 1px solid #ddd;
  }

  .conversion-table td {
    display: block;
    text-align: right;
    border-bottom: 1px dotted #ccc;
    position: relative;
    padding-left: 50%;
    padding-right: 30px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .conversion-table td:before {
    content: attr(data-label);
    position: absolute;
    left: 10px;
    font-weight: bold;
    text-align: left;
    font-size: 90%;
    white-space: nowrap;
  }
  label {
    font-size: 14px;
    font-weight: 400;
  }
  .conversion-table td:last-child {
    border-bottom: 0;
  }
  .clock h3 {
    font-size: 90%;
    margin-bottom: 5px;
  }
}

@media (max-width: 480px) {
  .nav-menu {
    display: none; /* Hide for now, can be replaced with a burger menu */
  }

  .header {
    padding: 15px;
  }

  .container {
    padding: 15px;
  }

  .clock {
    min-width: 100%;
    padding: 10px;
  }
}

/* Toast notifications */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #28a745;
  color: white;
  padding: 12px 20px;
  border-radius: 5px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast.error {
  background: #dc3545;
}

.toast.info {
  background: #17a2b8;
}
.rangeMode,
.timeMode-group {
  display: inline-flex;
  gap: 10px;
}

/* Tab styles */
.tab-buttons {
  display: flex;
  margin-bottom: 15px;
}

.tab-button {
  background: none;
  border: none;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 16px;
  color: #555;
  transition: all 0.3s ease;
  border: 2px solid #01ad18;
  color: #01ad18;
  font-weight: bold;
}
.tab-button:first-child {
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}
.tab-button:last-child {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}

.tab-button:hover {
  color: #01ad18;
  border-color: #01ad18;
}

.tab-button.active {
  color: #ff4800;
  border-color: #ff4800;
  font-weight: bold;
}

.tab-content {
  padding: 10px 0;
}
