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

/* CSS Variables */
:root {
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --warning-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --danger-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  --glass-bg: rgba(255, 255, 255, 0.95);
  --glass-border: rgba(255, 255, 255, 0.3);
  --shadow-light: 0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 16px 48px rgba(0, 0, 0, 0.15);
  --shadow-heavy: 0 24px 64px rgba(0, 0, 0, 0.2);
  --border-radius: 20px;
  --border-radius-small: 12px;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
}

/* Base Styles */
html {
  height: 100%;
  font-size: 16px;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--primary-gradient);
  color: white;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
}

/* Background Logo */
body::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  height: 400px;
  background: url("/placeholder.svg?height=400&width=400") center / contain no-repeat;
  opacity: 0.05;
  z-index: 0;
  pointer-events: none;
}

/* App Container */
.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem;
  position: relative;
  z-index: 1;
}

/* Logo Section */
.logo-section {
  text-align: center;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.logo {
  display: block;
  text-align: center;
  margin-bottom: 0px;
  text-decoration: none;
  transition: opacity 0.3s ease;
}

.logo:hover {
  opacity: 0.8;
}

.logo img {
  width: 150px;
  height: auto;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 2rem;
  flex-shrink: 0;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header p {
  font-size: 1.1rem;
  opacity: 0.9;
  font-weight: 300;
}

/* Main Content */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-height: 0;
}

/* Timer Section */
.timer-section {
  background: var(--glass-bg);
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--shadow-medium);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  flex: 1;
  display: flex;
  flex-direction: column;
  color: var(--text-primary);
}

.timer-inputs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

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

.input-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-group input {
  width: 100%;
  padding: 1rem;
  border: 2px solid #e2e8f0;
  border-radius: var(--border-radius-small);
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
  background: #f8fafc;
  transition: all 0.3s ease;
  -webkit-appearance: none;
  -moz-appearance: textfield;
}

.input-group input::-webkit-outer-spin-button,
.input-group input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.input-group input:focus {
  outline: none;
  border-color: #667eea;
  background: white;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
  transform: translateY(-1px);
}

/* Timer Display */
.timer-display {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border-radius: var(--border-radius);
  margin: 1.5rem 0;
  padding: 3rem 2rem;
  border: 1px solid #cbd5e1;
  position: relative;
  overflow: hidden;
}

.timer-display::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  transition: left 0.8s ease;
}

.timer-display:hover::before {
  left: 100%;
}

#display-time {
  font-size: 4rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: "Inter", monospace;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 1;
  font-variant-numeric: tabular-nums;
}

/* Timer Controls */
.timer-controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: auto;
}

.btn {
  padding: 1rem 2rem;
  border: none;
  border-radius: var(--border-radius-small);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  color: white;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.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: left 0.5s ease;
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

.btn-start {
  background: var(--success-gradient);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

.btn-start:hover:not(:disabled) {
  box-shadow: 0 12px 30px rgba(16, 185, 129, 0.4);
  transform: translateY(-2px);
}

.btn-pause {
  background: var(--warning-gradient);
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.3);
}

.btn-pause:hover:not(:disabled) {
  box-shadow: 0 12px 30px rgba(245, 158, 11, 0.4);
  transform: translateY(-2px);
}

.btn-reset {
  background: var(--danger-gradient);
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
}

.btn-reset:hover:not(:disabled) {
  box-shadow: 0 12px 30px rgba(239, 68, 68, 0.4);
  transform: translateY(-2px);
}

/* Settings Section */
.settings-section {
  background: var(--glass-bg);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-medium);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  flex-shrink: 0;
}

.settings-section h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--text-primary);
}

.setting-item {
  margin-bottom: 1.5rem;
}

.setting-item:last-child {
  margin-bottom: 0;
}

.setting-header {
  display: flex;
  align-items: center;
  margin-bottom: 0.8rem;
  gap: 0.8rem;
}

.setting-header input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #667eea;
  cursor: pointer;
}

.setting-header label {
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1rem;
  user-select: none;
}

.setting-item input[type="text"] {
  width: 100%;
  padding: 0.8rem;
  border: 2px solid #e2e8f0;
  border-radius: var(--border-radius-small);
  font-size: 0.9rem;
  background: #f8fafc;
  transition: all 0.3s ease;
}

.setting-item input[type="text"]:focus {
  outline: none;
  border-color: #667eea;
  background: white;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.sound-controls {
  display: flex;
  align-items: center;
}

.sound-controls select {
  flex: 1;
  padding: 0.8rem;
  border: 2px solid #e2e8f0;
  border-radius: var(--border-radius-small);
  font-size: 0.9rem;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.3s ease;
  -webkit-appearance: none;
}

.sound-controls select:focus {
  outline: none;
  border-color: #667eea;
  background: white;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* Modal - Komplett überarbeitet */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 400px;
  text-align: center;
  color: var(--text-primary);
  box-shadow: var(--shadow-heavy);
  animation: modalSlideIn 0.3s ease-out;
  position: relative;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.modal-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.modal-content p {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* Neuer OK-Button mit besserer Touch-Unterstützung */
.btn-ok {
  display: block;
  width: 100%;
  max-width: 200px;
  height: 64px;
  margin: 0 auto;
  background: var(--primary-gradient);
  color: white;
  font-size: 1.2rem;
  font-weight: 600;
  border: none;
  border-radius: var(--border-radius-small);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
  touch-action: manipulation;
}

.btn-ok::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.btn-ok:active::after,
.btn-ok.active::after {
  opacity: 1;
}

.btn-ok:active {
  transform: translateY(2px) scale(0.98);
  box-shadow: 0 4px 10px rgba(102, 126, 234, 0.2);
}

/* Animations */
.running #display-time {
  color: #10b981;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  50% {
    transform: scale(1.02);
    text-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
  }
}

.finished .timer-display {
  background: linear-gradient(135deg, #fecaca 0%, #f87171 100%);
  animation: flash 1s infinite;
}

.finished #display-time {
  color: #dc2626;
  animation: shake 0.5s infinite;
}

@keyframes flash {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-2px);
  }
  75% {
    transform: translateX(2px);
  }
}

/* Responsive Design */

/* Tablets */
@media (max-width: 768px) {
  .app {
    padding: 1rem;
  }

  .logo-section {
    margin-bottom: 1rem;
  }

  .logo {
    padding: 0.6rem;
  }

  .logo img {
    height: 50px;
  }

  .header h1 {
    font-size: 2rem;
  }

  .timer-section {
    padding: 1.5rem;
  }

  #display-time {
    font-size: 3rem;
  }

  .timer-controls {
    gap: 0.8rem;
  }

  .btn {
    min-width: 100px;
    padding: 0.8rem 1.5rem;
    font-size: 0.8rem;
  }

  .sound-controls {
    gap: 0.8rem;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .app {
    padding: 0.8rem;
    gap: 1rem;
  }

  .logo-section {
    margin-bottom: 0.8rem;
  }

  .logo {
    padding: 0.5rem;
  }

  .logo img {
    height: 45px;
  }

  .header {
    margin-bottom: 1rem;
  }

  .header h1 {
    font-size: 1.8rem;
  }

  .header p {
    font-size: 1rem;
  }

  .timer-section {
    padding: 1.2rem;
  }

  .timer-inputs {
    gap: 1rem;
    margin-bottom: 1.5rem;
  }

  .input-group input {
    padding: 0.8rem;
    font-size: 1rem;
  }

  .timer-display {
    padding: 2rem 1rem;
    margin: 1rem 0;
  }

  #display-time {
    font-size: 2.5rem;
  }

  .timer-controls {
    flex-direction: column;
    gap: 0.8rem;
  }

  .btn {
    width: 100%;
    min-width: auto;
  }

  .settings-section {
    padding: 1.2rem;
    margin-bottom: 20px;
  }

  .sound-controls {
    flex-direction: column;
    gap: 1.5rem;
    align-items: stretch;
  }

  /* Größerer OK-Button für mobile Geräte */
  .btn-ok {
    height: 72px;
    font-size: 1.3rem;
    max-width: 100%;
  }
}

/* Very small screens */
@media (max-width: 360px) {
  .timer-inputs {
    grid-template-columns: 1fr;
  }

  #display-time {
    font-size: 2rem;
  }
}

/* Landscape mode for mobile */
@media (max-height: 600px) and (orientation: landscape) {
  .app {
    flex-direction: row;
    gap: 1rem;
    padding: 0.8rem;
  }

  .logo-section {
    display: none;
  }

  .header {
    display: none;
  }

  .timer-section {
    flex: 2;
  }

  .settings-section {
    flex: 1;
    min-width: 250px;
  }

  #display-time {
    font-size: 2rem;
  }

  .timer-display {
    padding: 1.5rem 1rem;
    margin: 1rem 0;
  }

  .timer-controls {
    flex-direction: row;
    gap: 0.5rem;
  }

  .btn {
    padding: 0.6rem 1rem;
    font-size: 0.7rem;
    min-width: 80px;
  }

  .sound-controls {
    flex-direction: row;
    gap: 0.5rem;
  }
}

/* Desktop hover effects */
@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled) {
    transform: translateY(-2px);
  }

  .input-group input:hover {
    border-color: #cbd5e1;
  }

  .setting-item input:hover,
  .sound-controls select:hover {
    border-color: #cbd5e1;
  }

  .btn-ok:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.4);
  }
}

/* Touch devices - Spezielle Behandlung für Play-Button */
@media (hover: none) and (pointer: coarse) {
  .input-group input,
  .setting-item input,
  .sound-controls select {
    font-size: 16px !important;
  }

  .timer-display:hover::before {
    left: -100%;
  }

  /* Vergrößere den Abstand zwischen Elementen auf Touch-Geräten */
  .sound-controls {
    gap: 1.5rem;
  }

  .setting-item {
    margin-bottom: 2rem;
  }
}

/* Touch optimizations */
html,
body {
  -webkit-touch-callout: none;
}

button,
input,
select {
  touch-action: manipulation;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .timer-section,
  .settings-section {
    border: 2px solid #333;
  }

  .btn {
    border: 2px solid currentColor;
  }
}
