@import url("https://fonts.googleapis.com/css?family=Roboto:400,500,700&display=swap");

:root {
  --primary-color: #007bff;
  --primary-hover: #0056b3;
  --success-color: #28a745;
  --success-hover: #218838;
  --dark-bg: #111;
  --card-bg: #222;
  --card-hover: #333;
  --input-bg: #333;
  --text-color: #eee;
  --border-radius: 12px;
  --button-radius: 8px;
}

/* Velmi jednoduché a spolehlivé styly pro formulář */
.simple-upload {
  margin-bottom: 20px;
  text-align: center;
}

.simple-file-btn {
  display: inline-block;
  background: var(--primary-color);
  color: white;
  padding: 12px 25px;
  border-radius: 5px;
  cursor: pointer;
  margin-bottom: 10px;
}

.simple-submit-btn {
  display: block;
  width: 100%;
  background: var(--success-color);
  color: white;
  padding: 15px;
  border: none;
  border-radius: 5px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  margin-top: 15px;
}

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

body {
  font-family: 'Roboto', sans-serif;
  background: var(--dark-bg);
  color: var(--text-color);
  padding: 15px;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding-bottom: 30px;
}

/* Responzivní design */
@media (max-width: 480px) {
  body {
    padding: 10px;
  }
  
  .container {
    padding-bottom: 20px;
  }
  
  h1 {
    font-size: 24px;
  }
  
  h2 {
    font-size: 20px;
  }
  
  h3 {
    font-size: 18px;
  }
}

h2, h3 {
  text-align: center;
  margin-bottom: 15px;
  color: #fff;
}

p {
  text-align: center;
  margin-bottom: 20px;
  font-size: 16px;
}

form {
  background: var(--card-bg);
  padding: 20px;
  border-radius: var(--border-radius);
  margin-bottom: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

/* Upload tlačítka pro mobilní zařízení */
.upload-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
}

.upload-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 15px;
  cursor: pointer;
  border-radius: var(--button-radius);
  color: #fff;
  transition: all 0.3s ease;
  min-height: 80px;
  text-align: center;
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.camera-btn {
  background: var(--primary-color);
}

.camera-btn:hover, .camera-btn:active {
  background: var(--primary-hover);
}

.gallery-btn {
  background: #6c757d;
}

.gallery-btn:hover, .gallery-btn:active {
  background: #5a6268;
}

.camera-icon, .gallery-icon {
  font-size: 24px;
  margin-bottom: 5px;
}

.selected-file {
  background: var(--input-bg);
  padding: 10px;
  border-radius: var(--button-radius);
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #aaa;
  min-height: 60px;
  justify-content: center;
}

.selected-file-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  word-break: break-word;
  text-align: center;
}

.file-name {
  font-weight: 500;
  color: #fff;
}

.file-size {
  font-size: 12px;
  color: #888;
}

.img-preview {
  margin: 10px 0;
  max-width: 100%;
  border-radius: 8px;
  overflow: hidden;
}

.img-preview img {
  max-width: 100%;
  max-height: 200px;
  display: block;
  margin: 0 auto;
}

.clear-file {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ccc;
  cursor: pointer;
  margin-top: 8px;
}

input[type="file"] {
  display: none;
}

textarea {
  width: 100%;
  padding: 15px;
  margin: 15px 0;
  border: none;
  border-radius: var(--button-radius);
  background-color: var(--input-bg);
  color: var(--text-color);
  resize: none;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100px;
  transition: box-shadow 0.3s;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

textarea:focus {
  outline: none;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.btn {
  display: inline-block;
  width: 100%;
  padding: 16px 20px;
  border: none;
  border-radius: var(--button-radius);
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: all 0.3s;
  margin: 5px 0;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn.submit {
  background: var(--success-color);
  color: #fff;
}

.btn.submit:hover, .btn.submit:active {
  background: var(--success-hover);
  transform: translateY(-2px);
}

.btn.confirm {
  background: var(--primary-color);
  color: #fff;
}

.btn.confirm:hover, .btn.confirm:active {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

.btn.retry {
  background: #6c757d;
  color: #fff;
}

.btn.retry:hover, .btn.retry:active {
  background: #5a6268;
  transform: translateY(-2px);
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 15px 0;
}

pre {
  background: var(--input-bg);
  padding: 15px;
  border-radius: var(--border-radius);
  overflow-x: auto;
  margin-bottom: 20px;
  font-size: 14px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Responzivní design pro pre */
@media (max-width: 480px) {
  pre {
    font-size: 12px;
    padding: 10px;
  }
}

.header-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--card-hover);
}

.header-nav h2 {
  margin-bottom: 0;
}

.btn.nav-btn {
  width: auto;
  background: #6c757d;
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  padding: 10px 15px;
  margin: 0;
}

.btn.nav-btn:hover, .btn.nav-btn:active {
  background: #5a6268;
}

.btn.back-btn {
  background: #6c757d;
  color: #fff;
  text-decoration: none;
  display: inline-block;
  margin-bottom: 20px;
  text-align: center;
  padding: 12px 20px;
  width: auto;
}

.history-list {
  margin-top: 20px;
}

.day-section {
  margin-bottom: 25px;
}

.day-header {
  background: var(--card-hover);
  border-radius: var(--border-radius);
  padding: 16px;
  margin-bottom: 5px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.day-header:hover, .day-header:active {
  background: #444;
  transform: translateY(-2px);
}

.day-header-content {
  flex: 1;
}

.day-header h2 {
  margin: 0;
  text-align: left;
  font-size: 18px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.day-total {
  font-size: 15px;
  color: #ccc;
  white-space: nowrap;
}

.day-macros {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.macro {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 13px;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.macro.protein {
  background: rgba(86, 180, 233, 0.3);
  border-left: 3px solid rgb(86, 180, 233);
}

.macro.carbs {
  background: rgba(240, 128, 128, 0.3);
  border-left: 3px solid rgb(240, 128, 128);
}

.macro.fat {
  background: rgba(152, 251, 152, 0.3);
  border-left: 3px solid rgb(152, 251, 152);
}

.macro.saturated {
  background: rgba(245, 222, 179, 0.3);
  border-left: 3px solid rgb(245, 222, 179);
}

.macro.sugars {
  background: rgba(218, 112, 214, 0.3);
  border-left: 3px solid rgb(218, 112, 214);
}

/* Responzivní design pro denní záhlaví */
@media (max-width: 480px) {
  .day-header h2 {
    font-size: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
  
  .day-total {
    font-size: 14px;
    margin-left: 0;
  }
}

.toggle-icon {
  font-size: 20px;
  font-weight: bold;
  width: 30px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.day-header:hover .toggle-icon {
  background: rgba(255, 255, 255, 0.2);
}

.day-entries {
  padding: 10px 0;
  display: none;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.history-item {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 15px;
  margin-bottom: 15px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.history-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 10px;
  margin-bottom: 15px;
}

.history-header h3 {
  margin: 0;
  text-align: left;
  font-size: 17px;
  color: #fff;
  word-break: break-word;
}

.timestamp {
  color: #aaa;
  font-size: 14px;
  white-space: nowrap;
  margin-left: 10px;
}

@media (max-width: 480px) {
  .history-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .timestamp {
    margin-left: 0;
    margin-top: 5px;
  }
}

.food-image {
  margin: 15px 0;
  text-align: center;
  background: #333;
  padding: 10px;
  border-radius: 8px;
}

.food-image img {
  max-width: 100%;
  max-height: 350px;
  border-radius: 6px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.nutrition-data ul {
  list-style: none;
}

.nutrition-data li {
  margin-bottom: 5px;
}

.error {
  color: #dc3545;
}

.no-entries {
  text-align: center;
  color: #aaa;
  padding: 20px;
}

/* Nutriskóre styly */
.nutriscore {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 15px 0;
  background: var(--card-hover);
  border-radius: var(--border-radius);
  padding: 15px;
}

.nutriscore-label {
  font-weight: bold;
  margin-right: 15px;
  font-size: 18px;
}

.nutriscore-value {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 6px;
  color: white;
  font-weight: bold;
  font-size: 22px;
}

.day-nutriscore {
  font-size: 14px;
  padding: 4px 8px;
  margin-left: 10px;
  vertical-align: middle;
}

/* Přidané styly pro nutrition-info */
.nutrition-info {
  background: var(--card-hover);
  border-radius: var(--border-radius);
  padding: 20px;
  margin: 15px 0;
}

.nutrition-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.nutrition-label {
  font-weight: bold;
  color: #eee;
}

.nutrition-value {
  color: #ccc;
  font-family: monospace;
  font-size: 16px;
}

.nutriscore-A {
  background-color: #038141;
}

.nutriscore-B {
  background-color: #85BB2F;
}

.nutriscore-C {
  background-color: #FECB02;
  color: #333;
}

.nutriscore-D {
  background-color: #EF8200;
}

.nutriscore-E {
  background-color: #E63E11;
}

/* Přihlašovací formuláře */
.auth-form {
  background: var(--card-bg);
  padding: 25px;
  border-radius: var(--border-radius);
  margin: 20px auto;
  max-width: 400px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: none;
  background-color: var(--input-bg);
  color: var(--text-color);
  border-radius: var(--button-radius);
  font-size: 16px;
}

.auth-links {
  margin-top: 20px;
  text-align: center;
}

.auth-links a {
  color: var(--primary-color);
  text-decoration: none;
}

.auth-links a:hover {
  text-decoration: underline;
}

.nav-buttons {
  display: flex;
  gap: 10px;
}

.public-info {
  background-color: var(--card-hover);
  padding: 15px;
  border-radius: var(--border-radius);
  margin-bottom: 20px;
  text-align: center;
}

.public-info a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: bold;
}

.public-info a:hover {
  text-decoration: underline;
}

/* Formulářové styly */
.main-option {
  background: var(--card-hover);
  border-radius: var(--border-radius);
  padding: 20px;
  margin-bottom: 20px;
}

.text-description {
  background: var(--card-hover);
  border-radius: var(--border-radius);
  padding: 20px;
  margin-bottom: 25px;
}

.main-option h3,
.text-description h3 {
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 16px;
  color: #ccc;
  text-align: left;
}

.note {
  margin-top: 10px;
  font-size: 14px;
  color: #888;
  font-style: italic;
  text-align: left;
}

@media (max-width: 767px) {
  .main-option,
  .text-description {
    padding: 15px;
  }
  
  .main-option h3,
  .text-description h3 {
    font-size: 15px;
  }
  
  .note {
    font-size: 13px;
  }
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

.loading-content {
  background: var(--card-bg);
  padding: 25px;
  border-radius: var(--border-radius);
  text-align: center;
  max-width: 80%;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  margin: 0 auto 15px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  margin-top: 15px;
  color: var(--text-color);
  font-size: 16px;
}

.loading-progress-bar {
  height: 6px;
  background: var(--input-bg);
  border-radius: 3px;
  margin-top: 15px;
  overflow: hidden;
}

.loading-progress-fill {
  height: 100%;
  background: var(--primary-color);
  width: 0%;
  transition: width 0.3s ease;
}

/* Collapsible sections for extra content */
.collapsible-section {
  margin-top: 20px;
}

.collapsible {
  background-color: var(--card-hover);
  color: #ccc;
  cursor: pointer;
  padding: 15px;
  width: 100%;
  border: none;
  border-radius: var(--border-radius);
  text-align: left;
  outline: none;
  font-size: 16px;
  transition: 0.3s;
  display: block;
  margin-bottom: 5px;
}

.active, .collapsible:hover {
  background-color: #444;
}

.collapsible:after {
  content: '\002B';
  color: white;
  font-weight: bold;
  float: right;
  margin-left: 5px;
}

.active:after {
  content: "\2212";
}

.content {
  padding: 0 18px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease-out;
  background-color: var(--card-bg);
  border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* Delete button for history items */
.history-item-actions {
  position: absolute;
  top: 15px;
  right: 15px;
  display: flex;
  gap: 5px;
}

.history-item {
  position: relative;
}

.delete-item-btn {
  background: rgba(220, 53, 69, 0.2);
  color: #dc3545;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s ease;
}

.delete-item-btn:hover {
  background: rgba(220, 53, 69, 0.4);
}

.flash {
  list-style: none;
  margin-bottom: 20px;
  text-align: center;
}

.flash li {
  background: #28a745;
  padding: 10px;
  border-radius: 5px;
  color: #fff;
}

/* Tlačítko exportu a akční tlačítka */
.header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.pdf-export-btn {
  background-color: #6c42c1;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.pdf-export-btn:hover {
  background-color: #5735a3;
  transform: translateY(-2px);
}

.pdf-icon {
  font-style: normal;
  font-size: 20px;
}

/* Modal pro export */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.8);
  animation: fadeIn 0.3s;
}

.modal-content {
  background-color: var(--card-bg);
  margin: 10% auto;
  padding: 25px;
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 500px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  position: relative;
}

.close-modal {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  position: absolute;
  top: 10px;
  right: 20px;
}

.close-modal:hover,
.close-modal:focus {
  color: #fff;
  text-decoration: none;
}

.export-options {
  display: flex;
  flex-direction: column;
  margin: 15px 0;
}

.export-options label {
  margin-bottom: 10px;
  padding: 10px;
  background-color: var(--card-hover);
  border-radius: var(--button-radius);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
}

.export-options label:hover {
  background-color: var(--input-bg);
}

.export-options input[type="radio"] {
  margin-right: 10px;
}

.date-range {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin: 15px 0;
}

.date-range .form-group {
  margin-bottom: 0;
}

.date-range input[type="date"] {
  width: 100%;
  padding: 10px;
  background-color: var(--input-bg);
  border: none;
  border-radius: var(--button-radius);
  color: var(--text-color);
}
