/* Layout Page Styles */

/* Typing Demo Area */
.typing-demo-area {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.demo-text-display {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  min-height: 80px;
  font-family: 'Noto Sans Sinhala', Arial, sans-serif;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 1rem;
  word-wrap: break-word;
}

.demo-input-area {
  display: flex;
  gap: 1rem;
  align-items: center;
}

#demo-input {
  flex: 1;
  padding: 0.8rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-family: 'Noto Sans Sinhala', Arial, sans-serif;
  font-size: 1rem;
  background: var(--background);
  color: var(--text);
}

#demo-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.demo-btn {
  padding: 0.8rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.demo-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

/* Keyboard Container */
.keyboard-container {
  margin: 2rem 0;
  display: flex;
  justify-content: center;
}

.keyboard {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  max-width: 900px;
  width: 100%;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 0.3rem;
  margin-bottom: 0.3rem;
}

.keyboard-row:last-child {
  margin-bottom: 0;
}

/* Individual Keys */
.key {
  width: 50px;
  height: 50px;
  background: var(--background);
  border: 2px solid var(--border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Roboto Mono', monospace;
  font-size: 0.8rem;
  font-weight: bold;
  color: var(--text);
  position: relative;
  user-select: none;
  text-align: center;
}

.key:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.key:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(74, 144, 226, 0.3);
}

.key.pressed {
  background: var(--primary);
  color: white;
  transform: translateY(1px);
}

/* Sinhala Characters */
.sinhala-char {
  font-family: 'Noto Sans Sinhala', Arial, sans-serif;
  font-size: 1rem;
  font-weight: bold;
  margin-top: 0.1rem;
  color: var(--primary);
}

.altgr-char {
  font-family: 'Noto Sans Sinhala', Arial, sans-serif;
  font-size: 0.8rem;
  font-weight: bold;
  margin-top: 0.1rem;
  color: #e11d48;
}

.key:hover .sinhala-char,
.key:hover .altgr-char {
  color: white;
}

/* Special Keys */
.tab-key {
  width: 70px;
  font-size: 0.7rem;
}

.caps-key {
  width: 80px;
  font-size: 0.7rem;
}

.shift-key {
  width: 70px;
  font-size: 0.7rem;
}

.enter-key {
  width: 70px;
  font-size: 0.7rem;
}

.backspace-key {
  width: 90px;
  font-size: 0.7rem;
}

.space-key {
  width: 400px;
  font-size: 0.8rem;
}

/* Keyboard State Controls */
.keyboard-controls {
  margin-top: 2rem;
  text-align: center;
}

.control-group {
  display: inline-block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}

.control-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
  color: var(--text);
}

.state-buttons {
  display: flex;
  gap: 0.5rem;
}

.state-btn {
  padding: 0.5rem 1rem;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.state-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.state-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Instructions */
.instructions {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 2rem;
}

.instructions h3 {
  margin: 0 0 1rem 0;
  color: var(--primary);
  font-size: 1.2rem;
}

.instructions ul {
  margin: 0;
  padding-left: 1.5rem;
}

.instructions li {
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

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

.instructions a:hover {
  text-decoration: underline;
}

/* Dark Mode Adjustments */
body.dark .key {
  background: var(--background);
  border-color: var(--border);
  color: var(--text);
}

body.dark .key:hover {
  background: var(--primary);
  color: white;
}

body.dark .sinhala-char {
  color: var(--primary);
}

body.dark .altgr-char {
  color: #f87171;
}

body.dark .key:hover .sinhala-char,
body.dark .key:hover .altgr-char {
  color: white;
}

/* Mobile Responsive */
@media (max-width: 700px) {
  .keyboard {
    padding: 1rem;
  }
  
  .key {
    width: 35px;
    height: 35px;
    font-size: 0.6rem;
  }
  
  .sinhala-char {
    font-size: 0.8rem;
  }
  
  .altgr-char {
    font-size: 0.6rem;
  }
  
  .tab-key, .caps-key, .shift-key, .enter-key {
    width: 50px;
    font-size: 0.6rem;
  }
  
  .backspace-key {
    width: 70px;
    font-size: 0.6rem;
  }
  
  .space-key {
    width: 250px;
    font-size: 0.7rem;
  }
  
  .demo-input-area {
    flex-direction: column;
    align-items: stretch;
  }
  
  .demo-btn {
    width: 100%;
  }
  
  .state-buttons {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .keyboard {
    padding: 0.75rem;
  }
  
  .key {
    width: 28px;
    height: 28px;
    font-size: 0.5rem;
  }
  
  .sinhala-char {
    font-size: 0.7rem;
  }
  
  .altgr-char {
    font-size: 0.5rem;
  }
  
  .tab-key, .caps-key, .shift-key, .enter-key {
    width: 40px;
    font-size: 0.5rem;
  }
  
  .backspace-key {
    width: 60px;
    font-size: 0.5rem;
  }
  
  .space-key {
    width: 200px;
    font-size: 0.6rem;
  }
  
  .keyboard-row {
    gap: 0.2rem;
  }
}

/* Touch-friendly improvements for mobile */
@media (max-width: 700px) {
  .key {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  
  .key::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    z-index: -1;
  }
}

/* Animation for key press */
@keyframes keyPress {
  0% { transform: translateY(0); }
  50% { transform: translateY(2px); }
  100% { transform: translateY(0); }
}

.key.pressed {
  animation: keyPress 0.1s ease;
}

/* Focus styles for accessibility */
.key:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .key {
    border-width: 3px;
  }
  
  .key:hover {
    border-color: var(--text);
  }
} 