/* Styles pour l'application Cigarette Tracker - Optimisé pour mobile */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.app-header h1 {
  text-align: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.app-nav {
  display: flex;
  justify-content: space-around;
  gap: 0.5rem;
}

.app-nav a {
  flex: 1;
  padding: 0.75rem;
  text-decoration: none;
  background: rgba(255,255,255,0.2);
  color: white;
  border-radius: 8px;
  font-size: 0.9rem;
  text-align: center;
  transition: all 0.3s ease;
}

.app-nav a:hover,
.app-nav a.active {
  background: rgba(255,255,255,0.3);
  transform: translateY(-2px);
}

/* Main content */
.app-main {
  flex: 1;
  padding: 1rem;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

/* Daily Entry */
.daily-entry {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  margin-bottom: 1rem;
}

.daily-entry h2 {
  margin-bottom: 1.5rem;
  color: #333;
  text-align: center;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #555;
}

.form-group input {
  width: 100%;
  padding: 1rem;
  border: 2px solid #e1e1e1;
  border-radius: 8px;
  font-size: 1.1rem;
  transition: border-color 0.3s ease;
}

.form-group input:focus {
  outline: none;
  border-color: #667eea;
}

.form-group small {
  display: block;
  font-size: 0.8rem;
  color: #666;
  margin-top: 0.25rem;
}

.consumption-preview {
  background: #f8f9ff;
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  margin: 1.5rem 0;
  border-left: 4px solid #667eea;
}

.consumption-preview strong {
  font-size: 1.2rem;
  color: #667eea;
}

.calculation-detail {
  font-size: 0.9rem;
  color: #666;
  margin-top: 0.5rem;
}

.save-button {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.save-button:hover {
  transform: translateY(-2px);
}

/* Today entry exists */
.today-entry-exists {
  background: #e8f5e8;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  text-align: center;
  border-left: 4px solid #4caf50;
}

.today-entry-exists .button {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  background: #4caf50;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  transition: transform 0.2s ease;
}

.today-entry-exists .button:hover {
  transform: translateY(-2px);
}

/* History */
.history {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.history h2 {
  margin-bottom: 1.5rem;
  text-align: center;
  color: #333;
}

.history-header {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.new-entry-button {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: #4caf50;
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  transition: transform 0.2s ease;
}

.new-entry-button:hover {
  transform: translateY(-2px);
}

.statistics {
  background: #f8f9ff;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.stat-label {
  color: #666;
}

.stat-value {
  font-weight: 600;
  color: #667eea;
}

.empty-history {
  text-align: center;
  padding: 2rem;
  color: #666;
}

.empty-history .button {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.75rem 1.5rem;
  background: #667eea;
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
}

.entries-list {
  max-height: 60vh;
  overflow-y: auto;
}

.entry-item {
  background: #fafafa;
  border: 1px solid #e1e1e1;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.entry-header h3 {
  font-size: 1rem;
  color: #333;
  margin: 0;
}

.entry-actions {
  display: flex;
  gap: 0.5rem;
}

.edit-button,
.delete-button {
  padding: 0.5rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
  color: white;
}

.edit-button {
  background: #ffc107;
}

.delete-button {
  background: #f44336;
}

.entry-details {
  display: grid;
  gap: 0.5rem;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}

.detail-item span:first-child {
  color: #666;
}

.detail-item span:last-child {
  font-weight: 600;
}

.detail-item.consumption span:last-child {
  color: #667eea;
  font-size: 1.1rem;
}

/* Settings */
.settings {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.settings h2 {
  margin-bottom: 1.5rem;
  text-align: center;
  color: #333;
}

.app-info,
.calculation-info {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #e1e1e1;
}

.app-info h3,
.calculation-info h3 {
  margin-bottom: 0.5rem;
  color: #333;
}

.app-info p,
.calculation-info p {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.calculation-info code {
  display: block;
  background: #f8f9ff;
  padding: 1rem;
  border-radius: 8px;
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 0.9rem;
  margin-top: 1rem;
}

/* Graphs */
.graphs {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.graphs h2 {
  margin-bottom: 1.5rem;
  text-align: center;
  color: #333;
}

.period-selector {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.period-btn {
  flex: 1;
  padding: 0.75rem;
  border: 2px solid #e1e1e1;
  background: white;
  color: #333;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  min-width: 120px;
}

.period-btn:hover {
  border-color: #667eea;
  background: #f8f9ff;
}

.period-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: #667eea;
}

.custom-date-range {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #f8f9ff;
  border-radius: 8px;
}

.date-inputs {
  display: flex;
  gap: 1rem;
  align-items: end;
  flex-wrap: wrap;
}

.date-inputs .form-group {
  flex: 1;
  min-width: 140px;
}

.chart-container {
  position: relative;
  height: 400px;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #fafafa;
  border-radius: 8px;
}

.chart-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  padding: 1rem;
  background: #f8f9ff;
  border-radius: 8px;
}

.chart-stats .stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.chart-stats .stat-label {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0.25rem;
}

.chart-stats .stat-value {
  font-size: 1.2rem;
  font-weight: 600;
  color: #667eea;
}

/* Responsive */
@media (max-width: 480px) {
  .app-main {
    padding: 0.5rem;
  }
  
  .daily-entry,
  .history,
  .settings,
  .graphs {
    padding: 1rem;
  }
  
  .app-nav {
    flex-direction: row;
    gap: 0.25rem;
  }
  
  .app-nav a {
    font-size: 0.8rem;
    padding: 0.5rem;
  }
  
  .entry-header {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }
  
  .period-selector {
    flex-direction: column;
  }
  
  .period-btn {
    min-width: auto;
  }
  
  .date-inputs {
    flex-direction: column;
  }
}

/* Mode sombre pour les heures tardives */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #1a1a1a;
    color: #e1e1e1;
  }
  
  .daily-entry,
  .history,
  .settings,
  .graphs {
    background: #2d2d2d;
    color: #e1e1e1;
  }
  
  .form-group input {
    background: #3d3d3d;
    border-color: #555;
    color: #e1e1e1;
  }
  
  .entry-item {
    background: #3d3d3d;
    border-color: #555;
  }
  
  .statistics {
    background: #3d3d3d;
  }
  
  .consumption-preview {
    background: #3d3d3d;
  }
  
  .calculation-info code {
    background: #3d3d3d;
  }
  
  .period-btn {
    background: #3d3d3d;
    border-color: #555;
    color: #e1e1e1;
  }
  
  .period-btn:hover {
    background: #4d4d4d;
    border-color: #667eea;
  }
  
  .custom-date-range {
    background: #3d3d3d;
  }
  
  .chart-container {
    background: #3d3d3d;
  }
  
  .chart-stats {
    background: #3d3d3d;
  }
}