* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f9fafb;
  color: #111827;
  line-height: 1.5;
}

.app {
  min-height: 100vh;
}

/* Header */
.header {
  background: white;
  border-bottom: 1px solid #e5e7eb;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-title {
  font-size: 20px;
  font-weight: 600;
  color: #111827;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}

.status-badge.connected {
  background-color: #3b82f6;
  color: white;
}

.status-badge.disconnected {
  background-color: #ef4444;
  color: white;
}

.wifi-icon {
  font-size: 12px;
}

/* Navigation */
.nav-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: white;
  border-bottom: 1px solid #e5e7eb;
}

.tab-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 8px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  color: #6b7280;
  transition: all 0.2s;
}

.tab-button:hover {
  color: #374151;
}

.tab-button.active {
  color: #3b82f6;
  border-bottom: 2px solid #3b82f6;
}

.chart-icon,
.bulb-icon,
.timer-icon {
  font-size: 16px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.connected {
  background-color: #10b981;
}

.status-dot.disconnected {
  background-color: #ef4444;
}

/* Tab Content */
.tab-content {
  padding: 16px;
}

.tab-panel {
  display: none;
}

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

/* Cards */
.card {
  background: white;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  margin-bottom: 16px;
}

.card-header {
  padding: 20px 20px 0;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.card-description {
  font-size: 14px;
  color: #6b7280;
}

.card-content {
  padding: 20px;
}

/* Status Tab */
.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f3f4f6;
}

.status-row:last-child {
  border-bottom: none;
}

.status-label {
  font-size: 14px;
  color: #6b7280;
}

.status-value {
  font-size: 14px;
  font-weight: 500;
}

.status-value.connected {
  color: #10b981;
}

.status-value.disconnected {
  color: #ef4444;
}

/* Security Mode */
.security-section {
  border-top: 1px solid #e5e7eb;
  padding-top: 16px;
  margin-top: 16px;
}

.security-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.security-info {
  flex: 1;
}

.security-title {
  font-size: 14px;
  font-weight: 500;
  color: #111827;
  display: block;
}

.security-description {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}

/* Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  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: #d1d5db;
  transition: 0.2s;
  border-radius: 24px;
}

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

input:checked + .slider {
  background-color: #3b82f6;
}

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

/* Security Alert */
.security-alert {
  background-color: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 12px;
  margin-top: 16px;
}

.alert-content {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.alert-icon {
  font-size: 16px;
}

.alert-title {
  font-size: 14px;
  font-weight: 500;
  color: #92400e;
}

.alert-text {
  font-size: 12px;
  color: #92400e;
}

/* Custom Bar Chart */
.chart-container {
  margin: 16px 0;
}

.bar-chart {
  display: flex;
  align-items: end;
  justify-content: space-between;
  height: 200px;
  padding: 20px 0;
  gap: 8px;
}

.chart-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  height: 100%;
}

.bar-fill {
  width: 100%;
  background: linear-gradient(to top, #3b82f6, #60a5fa);
  border-radius: 4px 4px 0 0;
  margin-top: auto;
  transition: height 0.3s ease;
  position: relative;
}

.bar-label {
  font-size: 12px;
  color: #6b7280;
  margin-top: 8px;
}

.bar-value {
  position: absolute;
  top: -25px;
  font-size: 11px;
  color: #374151;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.2s;
}

.chart-bar:hover .bar-value {
  opacity: 1;
}

.chart-bar:hover .bar-fill {
  background: linear-gradient(to top, #2563eb, #3b82f6);
}

/* Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeline-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.timeline-time {
  font-size: 12px;
  color: #6b7280;
  width: 40px;
  flex-shrink: 0;
}

.timeline-bar {
  height: 8px;
  border-radius: 4px;
  flex: 1;
  max-width: 200px;
}

.focus-bar {
  background: linear-gradient(to right, #10b981, #34d399);
}

.break-bar {
  background: linear-gradient(to right, #f59e0b, #fbbf24);
}

.long-break-bar {
  background: linear-gradient(to right, #8b5cf6, #a78bfa);
}

.timeline-label {
  font-size: 12px;
  color: #374151;
  font-weight: 500;
  width: 100px;
  flex-shrink: 0;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.stat-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
}

.stat-header {
  margin-bottom: 8px;
}

.stat-title {
  font-size: 14px;
  font-weight: 500;
  color: #111827;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
}

.stat-label {
  font-size: 12px;
  color: #6b7280;
}

/* Brightness Controls */
.brightness-display {
  text-align: center;
  margin-bottom: 24px;
}

.brightness-value {
  font-size: 36px;
  font-weight: 700;
  color: #3b82f6;
  margin-bottom: 8px;
}

.brightness-label {
  font-size: 14px;
  color: #6b7280;
}

.slider-container {
  margin-bottom: 24px;
}

.brightness-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #d1d5db;
  outline: none;
  -webkit-appearance: none;
  margin-bottom: 16px;
}

.brightness-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
}

.brightness-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  border: none;
}

#security-alert{
  display: flex;
  position: fixed;
  z-index: 200;
  width: 70%;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #d45b5b;
  text-align: center;
  color: white;
  font-weight: bolder;
  border: solid 1px #962e2e;
  top: 1%;
  left: 15%;
}
#timer-already-started-alert{
  background: #EEE;
  color: #111827;
  border-radius: 1px;
  padding: 20px;
  border: none;
  width: 90%;
  min-height: 50px;
  position: fixed;
  bottom: 1%;
  left: 5%;
  box-shadow: 2px 2px #DDD;
}
.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #6b7280;
}

.preset-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.preset-btn , #manual-brightness-toggle{
  padding: 8px 16px;
  border: 1px solid #d1d5db;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}
#manual-brightness-toggle{
  width: 100%;
  margin-top: 5px;
}

.preset-btn:hover, #manual-brightness-toggle:hover {
  background: #f9fafb;
  border-color: #3b82f6;
}

/* Timer */
.timer-display {
  text-align: center;
  margin-bottom: 24px;
}

.timer-time {
  font-size: 48px;
  font-family: "Courier New", monospace;
  font-weight: 700;
  color: #3b82f6;
  margin-bottom: 16px;
}

.timer-badge {
  display: inline-block;
  background: #111827;
  color: white;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 500;
}

.progress-container {
  margin-bottom: 24px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(to right, #3b82f6, #60a5fa);
  transition: width 0.3s ease;
  width: 0%;
}

.timer-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.timer-btn {
  flex: 1;
  height: 48px;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.timer-btn.primary {
  background: #111827;
  color: white;
}

.timer-btn.primary:hover {
  background: #374151;
}

.timer-btn.secondary {
  background: white;
  color: #111827;
  border: 1px solid #d1d5db;
}

.timer-btn.secondary:hover {
  background: #f9fafb;
}

.break-controls {
  margin-bottom: 24px;
}

.break-title {
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 12px;
}

.break-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.break-btn {
  padding: 10px 16px;
  border: 1px solid #d1d5db;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.break-btn:hover {
  background: #f9fafb;
  border-color: #3b82f6;
}

.break-btn.full-width {
  width: 100%;
}

.timer-info {
  text-align: center;
  font-size: 14px;
  color: #6b7280;
  line-height: 1.4;
}

/* Locked State */
.locked-message {
  text-align: center;
  padding: 32px 16px;
}

.lock-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.lock-text {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 4px;
}

.lock-subtext {
  font-size: 12px;
  color: #9ca3af;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 640px) {
  .header {
    padding: 12px 16px;
  }

  .header-title {
    font-size: 18px;
  }

  .tab-content {
    padding: 12px;
  }

  .card-content {
    padding: 16px;
  }

  .timer-time {
    font-size: 40px;
  }

  .brightness-value {
    font-size: 32px;
  }

  .bar-chart {
    height: 150px;
    gap: 4px;
  }

  .timeline-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .timeline-bar {
    width: 100%;
    max-width: none;
  }
}
