/* ========================================
   Kenneth is Sorry - Complete Stylesheet
   Modern, responsive, warm aesthetic
   ======================================== */

/* ---------- Base & Reset ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 25%, #e8b4f8 50%, #b8cbb8 75%, #b465da 100%);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  padding: 20px;
  line-height: 1.6;
}

/* ---------- Animations ---------- */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

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

@keyframes bounce {
  0%, 20%, 53%, 80%, 100% {
    transform: translateY(0);
  }
  40%, 43% {
    transform: translateY(-20px);
  }
  70% {
    transform: translateY(-10px);
  }
  90% {
    transform: translateY(-5px);
  }
}

@keyframes heartPulse {
  0% { transform: scale(1); }
  25% { transform: scale(1.1); }
  50% { transform: scale(1); }
  75% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes checkmarkDraw {
  0% {
    stroke-dashoffset: 100;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ---------- Main Container ---------- */
.container {
  max-width: 600px;
  width: 100%;
  padding: 40px;
  text-align: center;
  animation: fadeIn 0.6s ease-out;
}

/* ---------- Typography ---------- */
h1 {
  font-size: 2.5rem;
  color: #2d2d2d;
  margin-bottom: 10px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

h2 {
  font-size: 1.8rem;
  color: #333;
  margin-bottom: 15px;
  font-weight: 600;
}

h3 {
  font-size: 1.4rem;
  color: #444;
  margin-bottom: 10px;
  font-weight: 600;
}

.subtitle {
  font-size: 1.2rem;
  color: #666;
  margin-bottom: 30px;
  font-weight: 400;
}

.message {
  font-size: 1.8rem;
  color: #e74c3c;
  font-weight: bold;
  margin: 20px 0;
  line-height: 1.4;
}

.message.warning {
  color: #c0392b;
}

.message.success {
  color: #27ae60;
}

p {
  color: #555;
  margin-bottom: 15px;
  font-size: 1rem;
}

/* ---------- Emoji Styles ---------- */
.emoji-big {
  font-size: 4rem;
  margin-bottom: 10px;
  display: block;
  animation: bounce 1s ease infinite;
}

.emoji {
  font-size: 2rem;
  margin: 10px 0;
}

/* ---------- Heart Animation ---------- */
.heart-animation {
  display: inline-block;
  color: #e74c3c;
  animation: heartPulse 1s ease-in-out infinite;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 15px 40px;
  border: none;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  margin: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 7px 20px rgba(0, 0, 0, 0.2);
}

.btn:active {
  transform: translateY(-1px);
}

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

.btn-primary:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.btn-success {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  color: white;
}

.btn-success:hover {
  background: linear-gradient(135deg, #38ef7d 0%, #11998e 100%);
}

.btn-danger {
  background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
  color: white;
}

.btn-danger:hover {
  background: linear-gradient(135deg, #f45c43 0%, #eb3349 100%);
}

.btn-warning {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
}

.btn-secondary {
  background: linear-gradient(135deg, #868f96 0%, #596164 100%);
  color: white;
}

.btn-small {
  padding: 10px 25px;
  font-size: 0.9rem;
}

.btn-large {
  padding: 18px 50px;
  font-size: 1.2rem;
}

.btn-block {
  display: block;
  width: 100%;
  margin: 10px 0;
}

/* ---------- Form Elements ---------- */
.punishment-select {
  width: 100%;
  padding: 15px 20px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 1rem;
  background: white;
  color: #333;
  cursor: pointer;
  transition: all 0.3s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
}

.punishment-select:hover {
  border-color: #667eea;
}

.punishment-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.input-group {
  margin: 15px 0;
  text-align: left;
}

.input-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #444;
  font-size: 0.95rem;
}

.input-group input,
.input-group textarea {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  box-sizing: border-box;
  transition: all 0.3s ease;
  background: #fafafa;
}

.input-group input:focus,
.input-group textarea:focus {
  border-color: #667eea;
  outline: none;
  background: white;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.input-group input::placeholder,
.input-group textarea::placeholder {
  color: #aaa;
}

.input-group textarea {
  min-height: 120px;
  resize: vertical;
  font-family: inherit;
}

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

.visible {
  display: block !important;
}

.fade-in {
  animation: fadeIn 0.6s ease-out;
}

.bounce-in {
  animation: bounce 0.8s ease;
}

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.flex-column {
  flex-direction: column;
}

.gap-1 { gap: 10px; }
.gap-2 { gap: 20px; }

/* ---------- Timer Display ---------- */
.timer-display {
  font-family: 'Courier New', Courier, monospace;
  font-size: 3.5rem;
  font-weight: 700;
  color: #e74c3c;
  letter-spacing: 3px;
  margin: 20px 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.timer-display.warning {
  animation: shake 0.5s ease-in-out infinite;
}

.timer-display.large {
  font-size: 5rem;
}

/* ---------- Word Count Display ---------- */
.word-count-display {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 15px 0;
  padding: 10px 20px;
  border-radius: 8px;
  display: inline-block;
}

.word-count-display.insufficient {
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.1);
  border: 2px solid #e74c3c;
}

.word-count-display.sufficient {
  color: #27ae60;
  background: rgba(39, 174, 96, 0.1);
  border: 2px solid #27ae60;
}

/* ---------- Progress Bar ---------- */
.progress-container {
  width: 100%;
  height: 12px;
  background: #e0e0e0;
  border-radius: 6px;
  margin: 20px 0;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 6px;
  transition: width 0.3s ease;
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ---------- Done/Success Checkmark ---------- */
.done-checkmark {
  width: 100px;
  height: 100px;
  margin: 30px auto;
  position: relative;
}

.done-checkmark svg {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  box-shadow: 0 10px 30px rgba(56, 239, 125, 0.3);
}

.done-checkmark .checkmark-path {
  stroke: white;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: checkmarkDraw 0.6s ease-out forwards;
  animation-delay: 0.3s;
}

/* ---------- Card Styles ---------- */
.card {
  background: white;
  border-radius: 15px;
  padding: 25px;
  margin: 15px 0;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.card-header {
  border-bottom: 2px solid #f0f0f0;
  padding-bottom: 15px;
  margin-bottom: 20px;
}

.card-footer {
  border-top: 2px solid #f0f0f0;
  padding-top: 15px;
  margin-top: 20px;
}

/* ---------- Alert/Notification Styles ---------- */
.alert {
  padding: 15px 20px;
  border-radius: 10px;
  margin: 15px 0;
  font-weight: 500;
}

.alert-success {
  background: linear-gradient(135deg, rgba(17, 153, 142, 0.1) 0%, rgba(56, 239, 125, 0.1) 100%);
  color: #11998e;
  border-left: 4px solid #11998e;
}

.alert-error {
  background: linear-gradient(135deg, rgba(235, 51, 73, 0.1) 0%, rgba(244, 92, 67, 0.1) 100%);
  color: #eb3349;
  border-left: 4px solid #eb3349;
}

.alert-warning {
  background: linear-gradient(135deg, rgba(240, 147, 251, 0.1) 0%, rgba(245, 87, 108, 0.1) 100%);
  color: #f5576c;
  border-left: 4px solid #f5576c;
}

.alert-info {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
  color: #667eea;
  border-left: 4px solid #667eea;
}

/* ---------- Divider ---------- */
.divider {
  height: 2px;
  background: linear-gradient(90deg, transparent, #e0e0e0, transparent);
  margin: 25px 0;
}

/* ---------- List Styles ---------- */
.list {
  text-align: left;
  margin: 20px 0;
}

.list-item {
  padding: 12px 15px;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.2s ease;
}

.list-item:hover {
  background: #f9f9f9;
}

.list-item:last-child {
  border-bottom: none;
}

/* ---------- Image Styles ---------- */
.image-container {
  margin: 20px 0;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.image-container img {
  width: 100%;
  height: auto;
  display: block;
}

/* ---------- Loading Spinner ---------- */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ---------- Badge Styles ---------- */
.badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

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

.badge-success {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  color: white;
}

.badge-danger {
  background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
  color: white;
}

/* ---------- Tooltip ---------- */
.tooltip {
  position: relative;
  cursor: help;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
}

/* ---------- Responsive Design ---------- */
@media (max-width: 768px) {
  body {
    padding: 15px;
    align-items: flex-start;
    padding-top: 40px;
  }

  .container {
    padding: 30px 25px;
    border-radius: 15px;
    max-width: 100%;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 1.1rem;
  }

  .message {
    font-size: 1.5rem;
  }

  .btn {
    padding: 14px 30px;
    font-size: 1rem;
    margin: 8px 0;
    min-height: 48px;
  }

  .btn-large {
    padding: 16px 40px;
    font-size: 1.1rem;
  }

  .timer-display {
    font-size: 2.8rem;
  }

  .timer-display.large {
    font-size: 3.5rem;
  }

  .emoji-big {
    font-size: 3rem;
  }

  .word-count-display {
    font-size: 1rem;
    padding: 8px 15px;
  }

  .done-checkmark {
    width: 80px;
    height: 80px;
  }

  .done-checkmark svg {
    width: 80px;
    height: 80px;
  }

  .punishment-select {
    font-size: 16px; /* prevents iOS zoom on focus */
  }

  .input-group input,
  .input-group textarea {
    font-size: 16px; /* prevents iOS zoom on focus */
  }

  .form-select,
  .form-input {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 10px;
    padding-top: 30px;
  }

  .container {
    padding: 25px 18px;
    border-radius: 12px;
  }

  h1 {
    font-size: 1.6rem;
    margin-bottom: 8px;
  }

  h2 {
    font-size: 1.3rem;
  }

  .subtitle {
    font-size: 1rem;
    margin-bottom: 20px;
  }

  .message {
    font-size: 1.2rem;
    line-height: 1.5;
  }

  .btn {
    padding: 14px 20px;
    font-size: 1rem;
    width: 100%;
    margin: 6px 0;
    min-height: 50px;
  }

  .btn-large {
    padding: 16px 25px;
    font-size: 1.05rem;
  }

  .button-group {
    gap: 12px;
  }

  .timer-display {
    font-size: 2.2rem;
  }

  .timer-display.large {
    font-size: 2.8rem;
  }

  .input-group input,
  .input-group textarea {
    padding: 14px;
    font-size: 16px;
  }

  .punishment-select {
    padding: 14px;
    font-size: 16px;
    min-height: 50px;
  }

  .card {
    padding: 20px 15px;
  }

  .heart-decoration {
    font-size: 2.5rem;
  }

  .checkmark-decoration {
    font-size: 2.5rem;
  }

  .form-group label {
    font-size: 1rem;
  }
}

/* ---------- Dark Mode Support (Optional) ---------- */
@media (prefers-color-scheme: dark) {
  /* Uncomment for dark mode support
  body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  }
  
  .container {
    background: rgba(30, 30, 30, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
  }
  
  h1, h2, h3, p {
    color: #f0f0f0;
  }
  
  .subtitle {
    color: #b0b0b0;
  }
  
  .btn {
    background: rgba(255, 255, 255, 0.1);
  }
  
  .input-group input,
  .input-group textarea {
    background: #2a2a2a;
    border-color: #444;
    color: #f0f0f0;
  }
  */
}

/* ---------- Print Styles ---------- */
@media print {
  body {
    background: white;
    padding: 0;
  }
  
  .container {
    box-shadow: none;
    border: 1px solid #ccc;
  }
  
  .btn {
    border: 1px solid #333;
  }
  
  .no-print {
    display: none !important;
  }
}

/* ---------- Button Group ---------- */
.button-group {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
  margin: 20px 0;
}

/* ---------- Form Group ---------- */
.form-group {
  margin: 20px 0;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #444;
  font-size: 0.95rem;
}

.form-select,
.form-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  box-sizing: border-box;
  background: #fafafa;
  color: #333;
  transition: all 0.3s ease;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  cursor: pointer;
}

.form-select:focus,
.form-input:focus {
  border-color: #667eea;
  outline: none;
  background: white;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.hint {
  display: block;
  margin-top: 6px;
  font-size: 0.85rem;
  color: #888;
}

/* ---------- Heart / Checkmark Decorations ---------- */
.heart-decoration {
  font-size: 3rem;
  color: #e74c3c;
  animation: heartPulse 1.2s ease-in-out infinite;
  margin-bottom: 10px;
}

.checkmark-decoration {
  font-size: 3rem;
  color: #27ae60;
  margin-bottom: 10px;
}

/* ---------- Safe Area (notch phones) ---------- */
@supports (padding: env(safe-area-inset-top)) {
  body {
    padding-left: calc(20px + env(safe-area-inset-left));
    padding-right: calc(20px + env(safe-area-inset-right));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    padding-top: calc(20px + env(safe-area-inset-top));
  }
}

/* ---------- Custom Scrollbar ---------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

/* ---------- Selection Styling ---------- */
::selection {
  background: #667eea;
  color: white;
}

/* ---------- Focus Visible (Accessibility) ---------- */
:focus-visible {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

/* ---------- Skip Link (Accessibility) ---------- */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #667eea;
  color: white;
  padding: 8px;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}