/* === Reset & Base === */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f0f2f5;
  color: #333;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* === Header === */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  background: #3498db;
  color: white;
  font-weight: bold;
  font-size: 1.3rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  flex-wrap: wrap;
}

.logo {
  cursor: pointer;
}

nav a {
  color: white;
  margin-left: 25px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  transition: color 0.3s ease;
}

nav a:hover {
  color: #f1c40f;
}

/* === Main Container === */
main {
  flex: 1;
  width: 90%;
  max-width: 1000px;
  margin: 30px auto 50px;
  display: flex;
  flex-direction: column;
  gap: 50px;
}

/* === Timer Section === */
.timer-section {
  background: white;
  padding: 30px 25px;
  border-radius: 15px;
  box-shadow: 0 12px 25px rgba(52, 152, 219, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timer {
  display: flex;
  gap: 10px;
  font-size: 3rem;
  align-items: center;
  margin-bottom: 25px;
  flex-wrap: wrap;
  transition: font-size 0.3s;
}

.time-block {
  background: rgba(52, 152, 219, 0.85);
  padding: 20px 30px;
  border-radius: 12px;
  min-width: 70px;
  text-align: center;
  font-weight: bold;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  outline: none;
  user-select: none;
  transition: transform 0.3s ease, background 0.3s;
}

.time-block[contenteditable="false"] {
  cursor: not-allowed;
}

.timer.running .time-block {
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.bounce {
  animation: bounce 0.3s;
}

@keyframes bounce {
  0%   { transform: translateY(0); }
  30%  { transform: translateY(-15px); }
  100% { transform: translateY(0); }
}

/* === Controls === */
.controls {
  margin-top: 10px;
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
  min-width: 100px;
}

.btn:hover {
  transform: scale(1.05);
}

.blue { background-color: #3498db; }
.blue:hover { background-color: #2980b9; }

.red { background-color: #e74c3c; }
.red:hover { background-color: #c0392b; }

.green { background-color: #27ae60 !important; }
.green:hover { background-color: #219150 !important; }

/* === Sound Toggle === */
.sound-toggle {
  margin-top: 15px;
  font-size: 1rem;
  color: #333;
  user-select: none;
}

.sound-toggle input[type="checkbox"] {
  transform: scale(1.2);
  margin-right: 8px;
  cursor: pointer;
}

/* === Timer Message === */
.timer-message {
  margin-top: 15px;
  font-size: 1.2rem;
  font-weight: 600;
  color: #27ae60;
  min-height: 28px;
  text-align: center;
}

/* === Info Section === */
.info-section {
  background: #fff;
  padding: 30px 25px;
  border-radius: 15px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.06);
  text-align: center;
}

.info-section h2 {
  font-size: 1.8rem;
  margin-bottom: 15px;
  color: #2980b9;
}

.info-section p {
  font-size: 1rem;
  line-height: 1.6;
  color: #555;
}

/* === Footer === */
footer {
  background: #1a252f; /* Darker slate blue/gray */
  color: #b0bec5;      /* Soft light blue-gray text */
  padding: 20px 30px;
  text-align: center;
  font-size: 0.9rem;
  border-top: 3px solid #f39c12; /* Accent orange top border */
}

footer a {
  color: #90caf9;      /* Light blue links */
  margin: 0 12px;
  text-decoration: none;
  font-weight: 500;
}

footer a:hover {
  text-decoration: underline;
  color: #ffb74d;      /* Warm amber hover */
}

/* === Animations === */
.fade-in-up {
  opacity: 0;
  transform: translateY(40px);
  animation: fadeInUp 0.8s ease-out forwards;
  animation-delay: 0.2s;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === Help Tooltip === */
.help-tooltip {
  position: relative;
  cursor: help;
  color: #3498db;
  font-weight: 700;
  border-bottom: 1px dotted #3498db;
}

.help-tooltip:hover::after {
  content: attr(data-tip);
  position: absolute;
  top: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: #3498db;
  color: white;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 1000;
}

/* === Section Hover === */
section {
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

section:hover:not(.timer-section):not(.rating-section) {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.08);
}

/* === Responsive Styles === */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    text-align: center;
  }

  nav {
    margin-top: 10px;
  }

  .timer {
    font-size: 2.5rem;
  }

  .time-block {
    padding: 15px 25px;
    min-width: 60px;
  }
}

@media (max-width: 480px) {
  main {
    width: 95%;
  }

  .timer {
    font-size: 2rem;
  }

  .time-block {
    padding: 12px 18px;
    min-width: 55px;
  }

  .btn {
    font-size: 0.9rem;
    padding: 10px 18px;
    min-width: 90px;
  }
}

/* To prevent header/nav being hidden behind fixed top bar, add top margin */
/* === Completion Popup === */
.completion-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  animation: fadeIn 0.4s ease forwards;
}

.popup-content {
  background: #ffffff;
  padding: 40px 30px;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  max-width: 400px;
  animation: popUp 0.4s ease-out forwards;
}

.popup-content h2 {
  font-size: 1.8rem;
  color: #27ae60;
  margin-bottom: 15px;
}

.popup-content p {
  font-size: 1rem;
  margin-bottom: 25px;
  color: #333;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popUp {
  0% {
    transform: scale(0.7);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Keeping bookmark toast CSS */
    .bookmark-toast {
      position: fixed;
      bottom: 20px;
      right: 20px;
      background: #2c3e50;
      color: #fff;
      padding: 14px 20px;
      border-radius: 8px;
      display: flex;
      align-items: center;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
      z-index: 999;
      animation: slideUp 0.6s ease forwards;
    }

    .hidden {
      display: none !important;
    }

    .toast-icon {
      font-size: 1.4rem;
      margin-right: 10px;
    }

    .toast-close {
      background: none;
      border: none;
      color: #fff;
      font-size: 1.2rem;
      margin-left: 12px;
      cursor: pointer;
    }

    @keyframes slideUp {
      from { transform: translateY(100px); opacity: 0; }
      to { transform: translateY(0); opacity: 1; }
    }
    /* ===== Desktop Right Vertical Ad ===== */
/* ===== Page Layout With Sidebar ===== */
.page-layout {
  display: flex;
  justify-content: center;
  gap: 40px;
  width: 95%;
  max-width: 1300px;
  margin: 30px auto 50px;
}

.page-layout main {
  flex: 1;
  max-width: 1000px;
}

/* ===== Desktop Sidebar Ad ===== */
.desktop-ad {
  width: 300px;
  flex-shrink: 0;
  display: none;
}

.desktop-ad .ad-box {
  width: 300px;
  height: 600px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
  font-weight: bold;
  position: sticky;
  top: 120px;
}

/* Show sidebar only on desktop */
@media (min-width: 1024px) {
  .desktop-ad {
    display: block;
  }
}

/* On smaller screens use normal centered layout */
@media (max-width: 1023px) {
  .page-layout {
    display: block;
  }
}
/* ===== Mobile Sticky Bottom Ad ===== */
.mobile-sticky-ad {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  display: none;
  justify-content: center;
  background: #ffffff;
  box-shadow: 0 -4px 10px rgba(0,0,0,0.1);
  z-index: 1000;
  padding: 5px 0;
}

.mobile-ad-box {
  width: 320px;
  height: 60px;
  background: #f8f8f8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #888;
}

/* Show only on mobile */
@media (max-width: 768px) {
  .mobile-sticky-ad {
    display: flex;
  }

  body {
    padding-bottom: 80px; /* Prevent overlap with footer */
  }
}
/* ===== Timer Grid Section ===== */
#timerGridContainer {
  margin: 30px 0;
  text-align: center;
}

.grid-heading {
  font-size: 1.2rem;
  margin-bottom: 12px;
  color: #2980b9;
  font-weight: bold;
}

/* Compact grid layout */
.timer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(35px, 1fr));
  gap: 6px;
  justify-items: center;
}

/* Numeric buttons */
.grid-btn {
  display: inline-block;
  padding: 6px 8px;
  background-color: #3498db;
  color: #fff;
  text-decoration: none;
  font-weight: bold;
  border-radius: 6px;
  font-size: 0.85rem;
  transition: background 0.3s, transform 0.2s;
  text-align: center;
}

/* Hover effect */
.grid-btn:hover {
  background-color: #2980b9;
  transform: scale(1.05);
}

/* Highlight current timer with subtle shadow/glow */
/* Highlight current timer with glow + pulse */
.grid-btn.current-timer {
  background-color: #27ae60 !important;
  color: #fff;
  cursor: default;
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(39, 174, 96, 0.4), 
              0 0 8px rgba(39, 174, 96, 0.3);
  animation: pulseCurrent 1.8s infinite ease-in-out;
}

/* Pulse animation */
@keyframes pulseCurrent {
  0% {
    box-shadow: 0 4px 8px rgba(39, 174, 96, 0.4), 
                0 0 8px rgba(39, 174, 96, 0.3);
  }
  50% {
    box-shadow: 0 6px 14px rgba(39, 174, 96, 0.6), 
                0 0 14px rgba(39, 174, 96, 0.5);
  }
  100% {
    box-shadow: 0 4px 8px rgba(39, 174, 96, 0.4), 
                0 0 8px rgba(39, 174, 96, 0.3);
  }
}

/* ===== Responsive Adjustments ===== */

/* Small tablets / landscape phones */
@media (max-width: 768px) {
  .timer-grid {
    grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
    gap: 5px;
  }

  .grid-btn {
    padding: 5px 6px;
    font-size: 0.8rem;
  }
}

/* Mobile phones */
@media (max-width: 480px) {
  .timer-grid {
    grid-template-columns: repeat(auto-fill, minmax(28px, 1fr));
    gap: 4px;
  }

  .grid-btn {
    padding: 4px 5px;
    font-size: 0.75rem;
  }
}
.grid-bottom-ad {
  margin: 20px 0;
  display: flex;
  justify-content: center;
}

.grid-bottom-ad .ad-box {
  width: 100%;
  max-width: 728px; /* Optional: keeps desktop ad not too wide */
  text-align: center;
}
/* Style for the small label inside the timer tool */
.tool-label {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: 1.25rem;
  text-align: center;
  margin-bottom: 12px;
  color: #007BFF;
  text-transform: uppercase;
}
