:root {
  --accent: #61DBFB;
  --bg-light: #ffffff;
  --bg-dark: #121212;
  --text-light: #000000;
  --text-dark: #ffffff;
}

[data-theme="light"] {
  background: var(--bg-light);
  color: var(--text-light);
}

[data-theme="dark"] {
  background: var(--bg-dark);
  color: var(--text-dark);
}

* {
  max-width: 100vw;
  box-sizing: border-box;
}

body {
  visibility: hidden;
}

body.loaded {
  visibility: visible;
}


html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  background-color: #121212;
  color: #ffffff;
}


body, html {
  margin: 0;
  padding: 0;
  font-family: sans-serif;
  background-color: #121212;
  color: #ffffff;
  min-height: 100vh;
  display: block;
    overflow-x: hidden;
}

.timer-container {
  text-align: center;
  max-width: 700px; /* was 400px */
  width: 100%;
  padding: 2rem;
  margin: 0 auto;
}


.presets button,
.controls button {
  margin: 0.3rem;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border: none;
  background-color: var(--accent);
  color: white;
  cursor: pointer;
  border-radius: 5px;
}

.timer-visual {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 2rem auto;
}

svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

circle.bg {
  fill: none;
  stroke: #ccc;
  stroke-width: 10;
}

circle.progress {
  fill: none;
  stroke-width: 10;
  stroke-dasharray: 282.6;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear;
  transition: stroke 0.5s ease, stroke-dashoffset 1s linear;
}

.timer-display {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
    line-height: 1;
  min-width: 5ch; /* Prevent width shift from '0:00' → '25:00' */
  text-align: center;
}

/* === Distraction Log === */
.distraction-log {
  margin-top: 2rem;
  text-align: center;
}

#logPanel {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
#logPanel.hidden {
  display: none;
}
#logTextarea {
  width: 100%;
  height: 150px;
  padding: 0.5rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 5px;
  resize: vertical;
}
.log-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom:2em
}
.log-actions button {
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
  border: none;
  border-radius: 5px;
  background: #666;
  color: white;
  cursor: pointer;
}

/* === Flow Lock Mode === */
.flow-lock-section {
  margin-top: 2rem;
  text-align: center;
}

#toggleFlowLockBtn {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  background: #f39c12;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
      float: right;
    margin-top: -3em;
}

#flowOverlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 9999;
}

#flowOverlay.hidden {
  display: none;
}

.flow-message {
  text-align: center;
  color: white;
}

.flow-message h2 {
  margin-bottom: 0.5rem;
}

#exitFlowLockBtn {
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  background: #e74c3c;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

/* === Session History === */
.session-history {
  margin-top: 2rem;
  text-align: center;
}

#toggleHistoryBtn, #toggleLogBtn {
  padding: 1rem;
  font-size: 1rem;
  background: #1a5d89;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}


#historyPanel {
  margin-top: 1rem;
}

#historyPanel.hidden {
  display: none;
}

#historyList {
  list-style: none;
  padding: 0;
  max-height: 200px;
  overflow-y: auto;
  text-align: left;
  background: #f9f9f9;
  margin: 1rem auto;
  max-width: 400px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

#historyList li {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #ccc;
  font-size: 0.9rem;
}

#exportHistoryBtn {
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
  background: #16a085;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

/* === Dark Theme Colors (PhilForster.co.uk Style) === */
[data-theme="dark"] {
  background-color: #121212;
  color: #ffffff;
}

[data-theme="dark"] .timer-container,
[data-theme="dark"] .log-actions button,
[data-theme="dark"] .session-history,
[data-theme="dark"] .distraction-log,
[data-theme="dark"] .flow-lock-section,
[data-theme="dark"] .export-section,
[data-theme="dark"] #historyPanel,
[data-theme="dark"] #logTextarea {
  background-color: #1E1E1E;
  color: #ffffff;
      border-radius: 5px;
    margin-top: 2em;
}

[data-theme="dark"] .btn,
[data-theme="dark"] button {
  background-color: #2c2c2c;
  color: #ffffff;
  border: 1px solid #444;
}

/* === Branded Footer for Tools === */


.branded-footer a {
  color: #61DBFB;
  text-decoration: none;
  margin: 0 0.5rem;
}

.branded-footer a:hover {
  text-decoration: underline;
}

/* === Gradient Branded Footer === */


.branded-footer .gradient-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 4px;
  width: 100%;
  background: linear-gradient(270deg, #61DBFB, #8e44ad, #e67e22, #61DBFB);
  background-size: 600% 600%;
  animation: gradientMove 8s ease infinite;
}

@keyframes gradientMove {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.branded-footer a {
  color: #61DBFB;
  text-decoration: none;
  margin: 0 0.5rem;
}

.branded-footer a:hover {
  text-decoration: underline;
}

/* === Force Dark Mode === */
html, body {
  background-color: #121212;
  color: #ffffff;
}

/* === Footer with Moving Gradient === */


@keyframes gradientMove {
  0% {background-position: 0% 50%;}
  50% {background-position: 100% 50%;}
  100% {background-position: 0% 50%;}
}

.branded-footer a {
  color: #ffffff;
  text-decoration: underline;
  margin: 0 0.5rem;
  font-weight: bold;
}

.branded-footer a:hover {
  opacity: 0.85;
}

.page-wrapper {
  min-height: calc(100vh - 120px); /* Ensures footer appears after main content */
  padding-bottom: 2rem;
}

body {
  overflow-x: hidden;
}

.page-wrapper {
  min-height: calc(100vh - 120px);
  padding-bottom: 2rem;
  width: 100%;
}




.branded-footer .footer-border {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(to right,
      #1976d2, #007acc, #7b61ff, #d473d4, #9c27b0,
      #e26d5c, #ff9800, #ffa600, #ffae42, #92b25a,
      #2e7d32, #3aa76d, #1976d2);
  background-size: 200% auto;
  animation: borderScrollHorizontal 30s linear infinite;
}

@keyframes borderScrollHorizontal {
  0% {
    background-position: 200% center;
  }
  100% {
    background-position: 0% center;
  }
}

.footer-text {
  margin: 1.5em auto 2.5em;
  font-size: 0.95rem;
  max-width: 90%;
  line-height: 1.6;
}

.footer-text a {
  color: #61DBFB;
  text-decoration: none;
  margin: 0 0.4em;
  transition: color 0.3s ease;
}

.footer-text a:hover {
  color: #ffffff;
}

.branded-footer {
  width: 100%;
  clear: both;
  padding: 30px 1rem 20px;
  text-align: center;
  font-weight: bold;
  background-color: #1E1E1E;
  color: #ccc;
  position: relative;
  z-index: 1;
}

.branded-footer .footer-border {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(to right,
      #1976d2, #007acc, #7b61ff, #d473d4, #9c27b0,
      #e26d5c, #ff9800, #ffa600, #ffae42, #92b25a,
      #2e7d32, #3aa76d, #1976d2);
  background-size: 200% auto;
  animation: borderScrollHorizontal 30s linear infinite;
}

@keyframes borderScrollHorizontal {
  0% { background-position: 200% center; }
  100% { background-position: 0% center; }
}

.footer-text {
  margin: 1.5em auto 0;
  font-size: 0.95rem;
  max-width: 90%;
  line-height: 1.6;
}

.footer-text a {
  color: #61DBFB;
  text-decoration: none;
  margin: 0 0.4em;
  transition: color 0.3s ease;
}

.footer-text a:hover {
  color: #ffffff;
}

/* Ensure body has no margin padding */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background-color: #121212;
  color: #ffffff;
  font-family: sans-serif;
  overflow-x: hidden;
}
input#taskInput {
  padding: 1em;
  width: 100%;
  max-width: 600px;
  margin: 0 0 2em;
  box-sizing: border-box;
}


/* === Custom Time Modal === */
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}
.modal.hidden {
  display: none;
}
.modal-content {
  background: #1e1e1e;
  color: white;
  padding: 2rem;
  border-radius: 10px;
  text-align: center;
  width: 90%;
  max-width: 320px;
}
.modal-content h2 {
  margin-bottom: 1rem;
}
.modal-content label {
  display: block;
  margin: 0.5rem 0;
}
.modal-content input {
  width: 100%;
  padding: 0.5rem;
  margin-top: 0.25rem;
  border: none;
  border-radius: 5px;
}
.modal-buttons {
  margin-top: 1rem;
  display: flex;
  justify-content: space-around;
}
.modal-buttons button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}
/* === Last 3 Buttons Wrapper === */
.feature-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
}

.feature-buttons > section {
  flex: 1 1 200px;
  max-width: 300px;
}

/* Stack on small screens */
@media (max-width: 600px) {
  .feature-buttons {
    flex-direction: column;
    align-items: center;
  }

  .feature-buttons > section {
    width: 100%;
    max-width: none;
  }
}
#toastContainer {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.toast {
  background-color: #2c2c2c;
  color: #fff;
  padding: 1rem 1.5rem;
  margin-top: 0.5rem;
  border-radius: 8px;
  font-size: 1rem;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
  opacity: 0;
  animation: fadeInOut 4s ease forwards;
}

@keyframes fadeInOut {
  0% { opacity: 0; transform: translateY(20px); }
  10% { opacity: 1; transform: translateY(0); }
  90% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-10px); }
}


.session-history-cards {
  margin: 2rem auto;
  max-width: 1200px;
  padding: 0 1rem;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

/* Style for distraction cards */
.history-card {
  background: #121212;
  color: #fff;
  padding: 1rem;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.25rem; /* reduced from 0.5rem to tighten spacing */
}

.card-title {
  color: #32CD32; /* bright green */
  margin-bottom: 0.5rem;
}

.card-text {
  color: #f0f0f0; /* off-white */
  flex-grow: 1;
}

.card-time {
  color: darkorange;
  font-size: 0.85rem;
  margin-top: auto;
}


.history-card h3 {
    color: #ff69b4; /* hot pink */
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

/* Task text in off-white */
.history-card p:nth-of-type(1) {
  color: #f0f0f0; /* soft white */
}

/* Start in green */
.history-card p:nth-of-type(2) {
  color: #00ff99; /* minty green */
}

/* End in red */
.history-card p:nth-of-type(3) {
  color: #ff4c4c; /* rich red */
}

.history-card p {
  margin: 0.3rem 0;
}

.history-card button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: #e74c3c;
  color: white;
  border: none;
  border-radius: 5px;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  font-size: 0.8rem;
}
.hidden {
  display: none !important;
}





.toggle-button-group {
  display: flex;
  justify-content: flex-start;   /* Avoid artificial spacing */
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0 1em;
  max-width: 100%;
  box-sizing: border-box;
  margin: 2rem auto;
}

.toggle-button-group button {
  flex: 1 1 calc(50% - 0.5rem);
  min-width: 140px;
  padding: 1rem;
  font-size: 1rem;
  background: #1a5d89;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  text-align: center;
  box-sizing: border-box;
}

/* 👇 Stack buttons only on narrow screens */
@media (max-width: 767px) {
  .toggle-button-group button {
    flex: 1 1 100%;
    min-width: 0;
  }
}



/* Stack on small screens */
@media (max-width: 480px) {
  .toggle-button-group {
    flex-direction: column;
    gap: 1rem;
  }

  .toggle-button-group button {
    width: 100%;
  }
}

small {
    color: #FF5722;

}


/* === Mobile-Only Fixes === */
@media (max-width: 768px) {
  .toggle-button-group {
    flex-direction: column;
    gap: 1rem;
  }

  .toggle-button-group button {
    width: 100%;
    min-width: 0;
    flex: 1 1 100%;
    box-sizing: border-box;
  }

  .feature-buttons {
    flex-direction: column;
    align-items: center;
  }

  .feature-buttons > section {
    width: 100%;
    max-width: none;
  }

  .session-history-cards,
  #logPanel {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  .history-grid {
    grid-template-columns: 1fr;
  }

  #logPanel {
    max-height: 200px;
    overflow-y: auto;
    margin: 0 auto 1rem auto;
    scrollbar-width: thin;
    scrollbar-color: #666 transparent;
  }

  #logPanel::-webkit-scrollbar {
    width: 6px;
  }

  #logPanel::-webkit-scrollbar-thumb {
    background-color: #666;
    border-radius: 4px;
  }

  #logPanel::-webkit-scrollbar-track {
    background-color: transparent;
  }
}

@media (max-width: 414px) {
  .history-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}
#toastContainer {
  min-height: 60px; /* or whatever average height your toasts are */
}
#distractionCardPanel,
#sessionCardPanel {
  min-height: 200px; /* or estimated average height */
}

#exportCSVBtn {
    margin-top: 0.5em;
    margin-bottom: 2em;
    padding: 1rem;
    font-size: 1rem;
    background: #1a5d89;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}
/* === Button Hover States === */
button:hover,
button:focus-visible {
  filter: brightness(1.15);
}

/* Specific background hover shifts (if needed for clarity) */
#toggleFlowLockBtn:hover {
  background: #ffb84d; /* Lighter orange */
}

#exitFlowLockBtn:hover {
  background: #ff6b6b; /* Lighter red */
}

#exportCSVBtn:hover,
#toggleLogBtn:hover,
#toggleHistoryBtn:hover {
  background: #218ac3;
}

.log-actions button:hover {
  background: #888;
}

.modal-buttons button:hover {
  background: #444;
}
