/* ===================================
   Marathi Speech Collection Platform
   Design System & Styles
   =================================== */

/* CSS Variables - Design Tokens */
:root {
  /* Colors */
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --primary-200: #c7d2fe;
  --primary-300: #a5b4fc;
  --primary-400: #818cf8;
  --primary-500: #6366f1;
  --primary-600: #4f46e5;
  --primary-700: #4338ca;
  --primary-800: #3730a3;
  --primary-900: #312e81;

  --accent-400: #a78bfa;
  --accent-500: #8b5cf6;
  --accent-600: #7c3aed;

  --success-400: #4ade80;
  --success-500: #22c55e;
  --success-600: #16a34a;

  --warning-400: #fbbf24;
  --warning-500: #f59e0b;

  --error-400: #f87171;
  --error-500: #ef4444;
  --error-600: #dc2626;

  /* Dark Theme Base */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a24;
  --bg-card: #16161f;
  --bg-elevated: #1e1e2a;
  --bg-hover: #252533;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --border-default: #2a2a3a;
  --border-hover: #3a3a4a;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --gradient-glow: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);

  /* Typography */
  --font-heading: 'Outfit', -apple-system, sans-serif;
  --font-marathi: 'Noto Sans Devanagari', 'Mangal', sans-serif;
  --font-mono: 'SF Mono', 'Consolas', monospace;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 3rem;
  --space-10: 4rem;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.3);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-heading);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.2;
}

.marathi,
.marathi-text {
  font-family: var(--font-marathi);
}

/* ===================================
   LOGIN PAGE
   =================================== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-4);
  background:
    radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
    var(--bg-primary);
}

.login-container {
  position: relative;
  width: 100%;
  max-width: 420px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.login-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-glow);
  opacity: 0.5;
  pointer-events: none;
}

.login-header {
  text-align: center;
  margin-bottom: var(--space-6);
  position: relative;
}

.logo-icon {
  display: inline-flex;
  margin-bottom: var(--space-4);
  animation: float 3s ease-in-out infinite;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

.login-header h1 {
  font-family: var(--font-marathi);
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: var(--space-2);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-header .subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Form Styles */
.login-form {
  position: relative;
}

.form-group {
  margin-bottom: var(--space-5);
}

.form-group label {
  display: block;
  font-family: var(--font-marathi);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.form-group input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: 1rem;
  font-family: var(--font-heading);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  transition: all var(--transition-base);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Error Message */
.error-message {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--error-500);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  color: var(--error-400);
  font-size: 0.875rem;
  text-align: center;
}

/* Login Button */
.btn-login {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  font-family: var(--font-marathi);
  font-size: 1rem;
  font-weight: 600;
  color: white;
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-md);
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.btn-login:active {
  transform: translateY(0);
}

.btn-login:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Login Footer */
.login-footer {
  margin-top: var(--space-6);
  text-align: center;
  position: relative;
}

.login-footer p {
  font-family: var(--font-marathi);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.login-footer .small {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  margin-top: var(--space-1);
}

/* ===================================
   DASHBOARD PAGE
   =================================== */
.dashboard-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-default);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.header-brand h1 {
  font-family: var(--font-marathi);
  font-size: 1.25rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-user {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.user-badge .avatar {
  width: 28px;
  height: 28px;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: white;
  font-size: 0.75rem;
}

.btn-logout {
  padding: var(--space-2) var(--space-4);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-logout:hover {
  color: var(--error-400);
  border-color: var(--error-500);
  background: rgba(239, 68, 68, 0.1);
}

/* Main Content */
.dashboard-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
    var(--bg-primary);
}

/* Progress Bar */
.progress-section {
  width: 100%;
  max-width: 700px;
  margin-bottom: var(--space-6);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
}

.progress-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.progress-count {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary-400);
}

.progress-bar {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

/* Sentence Card */
.sentence-card {
  width: 100%;
  max-width: 700px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.sentence-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-glow);
  opacity: 0.3;
  pointer-events: none;
}

.sentence-id-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-5);
}

.sentence-text {
  font-family: var(--font-marathi);
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: var(--space-8);
  position: relative;
}

/* Recording Controls */
.recording-controls {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Record Button */
.btn-record {
  width: 120px;
  height: 120px;
  border: none;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: white;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.btn-record::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--primary-500);
  opacity: 0;
  transition: all var(--transition-base);
}

.btn-record:hover::before {
  opacity: 0.5;
  inset: -12px;
}

.btn-record:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-glow);
}

.btn-record.recording {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  animation: pulse-recording 1.5s ease-in-out infinite;
}

@keyframes pulse-recording {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
  }

  50% {
    box-shadow: 0 0 0 20px rgba(239, 68, 68, 0);
  }
}

.btn-record .icon {
  width: 32px;
  height: 32px;
}

.btn-record .label {
  font-family: var(--font-marathi);
  font-size: 1rem;
  font-weight: 600;
}

/* Recording Timer */
.recording-timer {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--error-400);
  display: none;
}

.recording-timer.visible {
  display: block;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin-top: var(--space-6);
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-base);
}

.action-buttons.visible {
  opacity: 1;
  pointer-events: auto;
}

.btn-action {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-play {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
}

.btn-play:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.btn-retry {
  background: transparent;
  border: 1px solid var(--warning-500);
  color: var(--warning-400);
}

.btn-retry:hover {
  background: rgba(245, 158, 11, 0.1);
}

.btn-submit {
  background: var(--success-500);
  border: none;
  color: white;
}

.btn-submit:hover {
  background: var(--success-600);
  transform: translateY(-2px);
}

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

/* Complete State */
.complete-message {
  text-align: center;
  padding: var(--space-8);
}

.complete-message .icon {
  font-size: 4rem;
  margin-bottom: var(--space-4);
}

.complete-message h2 {
  font-family: var(--font-marathi);
  font-size: 1.5rem;
  margin-bottom: var(--space-3);
  color: var(--success-400);
}

.complete-message p {
  color: var(--text-secondary);
}

/* ===================================
   ADMIN DASHBOARD
   =================================== */
.admin-page {
  min-height: 100vh;
  background: var(--bg-primary);
}

.admin-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-default);
  padding: var(--space-4) var(--space-6);
}

.admin-header h1 {
  font-size: 1.5rem;
  color: var(--text-primary);
}

.admin-header .subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.admin-content {
  padding: var(--space-6);
  max-width: 1200px;
  margin: 0 auto;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
}

.stat-card .header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-4);
}

.stat-card .user-info h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.stat-card .serial {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

.stat-card .percentage {
  font-size: 1.75rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-card .progress-bar {
  height: 6px;
  margin-bottom: var(--space-3);
}

.stat-card .counts {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Data Table */
.data-section {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: var(--space-6);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-default);
}

.section-header h2 {
  font-size: 1rem;
  font-weight: 600;
}

.btn-export {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
}

.btn-export:hover {
  background: var(--bg-hover);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border-default);
}

.data-table th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-tertiary);
}

.data-table td {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.data-table .status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
}

.status-badge.success {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success-400);
}

/* ===================================
   UTILITIES
   =================================== */
.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Loading Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===================================
   RESPONSIVE - Mobile First Design
   =================================== */

/* Touch-friendly improvements for all devices */
@media (hover: none) and (pointer: coarse) {

  /* Remove hover effects on touch devices */
  .btn-record:hover::before {
    opacity: 0;
  }

  .btn-record:active {
    transform: scale(0.95);
  }

  .btn-action:active {
    transform: scale(0.95);
  }

  .btn-nav:active {
    transform: scale(0.9);
  }
}

/* Small devices (phones, 576px and below) */
@media (max-width: 576px) {
  html {
    font-size: 15px;
  }

  /* Login Page */
  .login-page {
    padding: var(--space-3);
  }

  .login-card {
    padding: var(--space-5);
    border-radius: var(--radius-xl);
  }

  .login-header h1 {
    font-size: 1.5rem;
  }

  .form-group input {
    padding: var(--space-4);
    font-size: 1rem;
    /* Larger touch target */
    min-height: 50px;
  }

  .btn-login {
    padding: var(--space-4);
    min-height: 54px;
    font-size: 1.1rem;
  }

  /* Dashboard Header */
  .dashboard-header {
    padding: var(--space-3);
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .header-brand {
    flex: 1;
    min-width: 0;
  }

  .header-brand h1 {
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-brand svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
  }

  .header-user {
    gap: var(--space-2);
  }

  .user-badge {
    padding: var(--space-1) var(--space-2);
    font-size: 0.75rem;
  }

  .user-badge .avatar {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
  }

  .btn-logout {
    padding: var(--space-2) var(--space-3);
    font-size: 0.75rem;
    min-height: 36px;
  }

  /* Dashboard Main */
  .dashboard-main {
    padding: var(--space-3);
    padding-bottom: env(safe-area-inset-bottom, var(--space-6));
  }

  /* Progress Section */
  .progress-section {
    margin-bottom: var(--space-4);
  }

  .progress-header {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .progress-label {
    font-size: 0.75rem;
    flex: 1;
  }

  .progress-count {
    font-size: 0.875rem;
    font-weight: 700;
  }

  /* Sentence Card */
  .sentence-card {
    padding: var(--space-4);
    border-radius: var(--radius-xl);
  }

  /* Sentence Navigation */
  .sentence-nav {
    gap: 0.5rem;
    margin-bottom: var(--space-4);
  }

  .btn-nav {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }

  .sentence-number-input {
    padding: var(--space-2) var(--space-3);
    gap: 0.25rem;
  }

  .sentence-number-input input {
    width: 45px;
    font-size: 0.9rem;
  }

  .sentence-number-input span {
    font-size: 0.75rem;
  }

  .sentence-id-badge {
    padding: var(--space-2) var(--space-3);
    font-size: 0.7rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  /* Sentence Text - Larger for readability */
  .sentence-text {
    font-size: 1.35rem;
    line-height: 1.8;
    margin-bottom: var(--space-5);
    padding: 0 var(--space-2);
  }

  /* Record Button - Larger for easy touch */
  .btn-record {
    width: 130px;
    height: 130px;
  }

  .btn-record .icon {
    width: 36px;
    height: 36px;
  }

  .btn-record .label {
    font-size: 1rem;
  }

  /* Recording Timer */
  .recording-timer {
    top: -35px;
    font-size: 1.1rem;
  }

  /* Action Buttons - Stack vertically on small screens */
  .action-buttons {
    flex-direction: column;
    gap: var(--space-3);
    margin-top: var(--space-5);
    width: 100%;
    padding: 0 var(--space-2);
  }

  .btn-action {
    width: 100%;
    justify-content: center;
    padding: var(--space-4);
    min-height: 52px;
    font-size: 1rem;
    border-radius: var(--radius-lg);
  }

  /* Go to Next button */
  .go-to-next-btn {
    width: 100%;
    padding: var(--space-4);
    font-size: 1rem;
    min-height: 52px;
    margin-top: var(--space-4);
  }

  /* Recorded/Not Recorded Badge */
  .recorded-badge,
  .not-recorded-badge {
    margin-left: 0;
    margin-top: var(--space-1);
    font-size: 0.7rem;
    padding: var(--space-1) var(--space-2);
  }

  /* Complete Message */
  .complete-message {
    padding: var(--space-5);
  }

  .complete-message .icon {
    font-size: 3rem;
  }

  .complete-message h2 {
    font-size: 1.25rem;
  }

  .complete-message p {
    font-size: 0.875rem;
  }

  /* Admin Dashboard Mobile */
  .admin-header {
    padding: var(--space-3);
    flex-direction: column;
    gap: var(--space-3);
    text-align: center;
  }

  .admin-header h1 {
    font-size: 1.25rem;
  }

  .admin-content {
    padding: var(--space-3);
  }

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

  .data-section {
    border-radius: var(--radius-lg);
  }

  .section-header {
    flex-direction: column;
    gap: var(--space-3);
    text-align: center;
    padding: var(--space-3);
  }

  .section-header h2 {
    font-size: 0.9rem;
  }

  /* Table horizontal scroll on mobile */
  .data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 0.75rem;
  }

  .data-table th,
  .data-table td {
    padding: var(--space-2) var(--space-3);
    white-space: nowrap;
  }
}

/* Medium devices (tablets, 577px to 768px) */
@media (min-width: 577px) and (max-width: 768px) {
  .dashboard-header {
    padding: var(--space-3) var(--space-4);
  }

  .header-brand h1 {
    font-size: 1.1rem;
  }

  .dashboard-main {
    padding: var(--space-4);
  }

  .sentence-card {
    padding: var(--space-5);
  }

  .sentence-text {
    font-size: 1.5rem;
  }

  .btn-record {
    width: 110px;
    height: 110px;
  }

  .action-buttons {
    flex-wrap: wrap;
  }

  .btn-action {
    min-height: 48px;
  }
}

/* Landscape orientation on phones */
@media (max-height: 500px) and (orientation: landscape) {
  .dashboard-main {
    padding: var(--space-2);
    justify-content: flex-start;
  }

  .progress-section {
    margin-bottom: var(--space-2);
  }

  .sentence-card {
    padding: var(--space-3);
  }

  .sentence-nav {
    margin-bottom: var(--space-2);
  }

  .sentence-text {
    font-size: 1.1rem;
    margin-bottom: var(--space-3);
  }

  .btn-record {
    width: 80px;
    height: 80px;
  }

  .btn-record .label {
    font-size: 0.75rem;
  }

  .action-buttons {
    flex-direction: row;
    margin-top: var(--space-3);
  }

  .btn-action {
    padding: var(--space-2) var(--space-3);
    min-height: 40px;
    font-size: 0.75rem;
  }
}

/* Safe area insets for notched phones */
@supports (padding: env(safe-area-inset-bottom)) {
  .dashboard-main {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .admin-content {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

/* Prevent zoom on input focus for iOS */
@media screen and (-webkit-min-device-pixel-ratio: 0) {

  input[type="text"],
  input[type="password"],
  input[type="number"] {
    font-size: 16px !important;
  }
}

/* Dark mode adjustments for OLED screens */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
  }
}