/* ===============================================
   RECALIBRATE - MOBILE-FIRST CAREER PLATFORM
   Revolutionary mobile-optimized career intelligence
   Touch, Voice, Gesture optimized for all devices
   =============================================== */

/* CSS Custom Properties (Design System) */
:root {
  /* Colors - Professional & Modern */
  --primary-color: #2c5aa0;
  --primary-light: #4a7bc8;
  --primary-dark: #1d3f73;
  --secondary-color: #00c896;
  --accent-color: #ff6b6b;
  --warning-color: #ffa726;
  
  /* Neutrals */
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-tertiary: #999999;
  --background-primary: #ffffff;
  --background-secondary: #f8f9fa;
  --background-card: #ffffff;
  --border-color: #e1e5e9;
  --shadow-color: rgba(0, 0, 0, 0.1);
  
  /* Dark Mode */
  --dark-bg-primary: #121212;
  --dark-bg-secondary: #1e1e1e;
  --dark-bg-card: #2d2d2d;
  --dark-text-primary: #ffffff;
  --dark-text-secondary: #cccccc;
  --dark-border: #404040;
  
  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  
  /* Spacing - Mobile-Optimized */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  
  /* Touch Targets - WCAG 2.1 AA Compliant */
  --touch-target-min: 44px;
  --touch-target-comfortable: 48px;
  --touch-target-large: 56px;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.15);
  
  /* Z-Index Scale */
  --z-modal: 1000;
  --z-overlay: 900;
  --z-dropdown: 800;
  --z-sticky: 700;
  --z-fab: 600;
  --z-nav: 500;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--background-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

/* Touch-Friendly Focus States */
button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Remove default button styling */
button {
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
}

/* ===============================================
   LOADING SCREEN
   =============================================== */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  animation: fadeOut 0.5s ease-in-out 2s forwards;
}

.loading-container {
  text-align: center;
  color: white;
}

.loading-logo {
  font-size: 4rem;
  margin-bottom: var(--space-4);
  animation: pulse 2s infinite;
}

.loading-title {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.loading-subtitle {
  font-size: var(--font-size-lg);
  opacity: 0.9;
  margin-bottom: var(--space-8);
}

.loading-progress {
  width: 200px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  margin: 0 auto;
  overflow: hidden;
}

.loading-progress::after {
  content: '';
  display: block;
  width: 100%;
  height: 100%;
  background: white;
  transform: translateX(-100%);
  animation: loadingBar 2s ease-in-out forwards;
}

/* ===============================================
   AUTHENTICATION SCREEN
   =============================================== */
.auth-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--background-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: var(--z-modal);
}

.auth-card {
  background: var(--background-card);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-xl);
  text-align: center;
  max-width: 400px;
  width: 100%;
}

.auth-logo {
  font-size: 4rem;
  margin-bottom: var(--space-4);
}

.auth-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.auth-subtitle {
  color: var(--text-secondary);
  margin-bottom: var(--space-8);
}

.auth-btn {
  background: var(--primary-color);
  color: white;
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-8);
  font-size: var(--font-size-lg);
  font-weight: 600;
  min-height: var(--touch-target-comfortable);
  width: 100%;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-md);
}

.auth-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

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

/* ===============================================
   MAIN APPLICATION LAYOUT
   =============================================== */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--background-primary);
}

.hidden {
  display: none !important;
}

/* ===============================================
   HEADER
   =============================================== */
.app-header {
  background: var(--background-card);
  border-bottom: 1px solid var(--border-color);
  padding: var(--space-4) var(--space-4) var(--space-3);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  padding-top: max(var(--space-4), env(safe-area-inset-top));
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
}

.logo-section {
  flex: 1;
}

.app-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0;
}

.app-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin: 0;
}

.header-actions {
  display: flex;
  gap: var(--space-2);
}

.voice-btn,
.settings-btn {
  min-width: var(--touch-target-min);
  min-height: var(--touch-target-min);
  border-radius: var(--radius-sm);
  background: var(--background-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.voice-btn:hover,
.settings-btn:hover {
  background: var(--primary-color);
  color: white;
  transform: scale(1.05);
}

/* ===============================================
   VOICE ASSISTANT OVERLAY
   =============================================== */
.voice-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-overlay);
  backdrop-filter: blur(8px);
}

.voice-content {
  text-align: center;
  color: white;
  padding: var(--space-8);
}

.voice-animation {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto var(--space-6);
}

.voice-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80px;
  height: 80px;
  background: var(--primary-color);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: voicePulse 1.5s infinite;
}

.voice-pulse::before {
  content: '🎤';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
}

.voice-title {
  font-size: var(--font-size-2xl);
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.voice-status {
  font-size: var(--font-size-lg);
  opacity: 0.8;
  margin-bottom: var(--space-8);
}

.close-voice-btn {
  background: var(--accent-color);
  color: white;
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-6);
  font-weight: 600;
  min-height: var(--touch-target-min);
  transition: all 0.2s ease;
}

.close-voice-btn:hover {
  background: #ff5252;
  transform: scale(1.05);
}

/* ===============================================
   MAIN CONTENT
   =============================================== */
.main-content {
  flex: 1;
  padding: var(--space-4);
  padding-bottom: calc(80px + var(--space-4)); /* Account for bottom nav */
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* ===============================================
   VIEWS & NAVIGATION
   =============================================== */
.view {
  display: none;
}

.view.active {
  display: block;
  animation: slideIn 0.3s ease-out;
}

/* ===============================================
   DASHBOARD GRID
   =============================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

/* ===============================================
   ACTION CARDS - MOBILE-OPTIMIZED
   =============================================== */
.action-card {
  background: var(--background-card);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  cursor: pointer;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.action-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.action-card:active {
  transform: translateY(-2px);
  transition: transform 0.1s ease;
}

.action-card.primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
  border: none;
}

.action-card.primary .card-title,
.action-card.primary .card-subtitle {
  color: white;
}

.card-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-3);
  opacity: 0.9;
}

.card-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.card-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}

.card-action {
  margin-top: auto;
}

.action-text {
  font-size: var(--font-size-xs);
  opacity: 0.7;
  font-style: italic;
}

/* ===============================================
   RECENT ACTIVITY SECTION
   =============================================== */
.recent-section {
  margin-top: var(--space-8);
}

.section-title {
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.activity-list {
  background: var(--background-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.activity-item {
  display: flex;
  align-items: center;
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s ease;
}

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

.activity-item:hover {
  background: var(--background-secondary);
}

.activity-icon {
  font-size: 1.5rem;
  margin-right: var(--space-3);
  opacity: 0.8;
}

.activity-content {
  flex: 1;
}

.activity-title {
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.activity-time {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

/* ===============================================
   RESUME BUILDER
   =============================================== */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-color);
}

.back-btn {
  color: var(--primary-color);
  font-weight: 500;
  min-height: var(--touch-target-min);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.back-btn:hover {
  background: var(--background-secondary);
}

.view-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-primary);
}

.voice-trigger-btn {
  background: var(--secondary-color);
  color: white;
  border-radius: 50%;
  width: var(--touch-target-min);
  height: var(--touch-target-min);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.2s ease;
}

.voice-trigger-btn:hover {
  background: #00b386;
  transform: scale(1.1);
}

.builder-steps {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-8);
  overflow-x: auto;
  padding-bottom: var(--space-2);
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.step.active {
  opacity: 1;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border-color);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  margin-bottom: var(--space-2);
  transition: all 0.2s ease;
}

.step.active .step-number {
  background: var(--primary-color);
  color: white;
}

.step-title {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  text-align: center;
}

.step.active .step-title {
  color: var(--text-primary);
  font-weight: 500;
}

.builder-content {
  background: var(--background-card);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  border: 1px solid var(--border-color);
  min-height: 400px;
}

.content-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
}

.voice-prompt {
  max-width: 300px;
}

.prompt-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  opacity: 0.8;
}

.voice-prompt h3 {
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.voice-prompt p {
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
}

.voice-start-btn {
  background: var(--secondary-color);
  color: white;
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-6);
  font-weight: 600;
  min-height: var(--touch-target-min);
  transition: all 0.2s ease;
}

.voice-start-btn:hover {
  background: #00b386;
  transform: translateY(-1px);
}

/* ===============================================
   BOTTOM NAVIGATION - THUMB-ZONE OPTIMIZED
   =============================================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--background-card);
  border-top: 1px solid var(--border-color);
  display: flex;
  padding: var(--space-2) var(--space-2) calc(var(--space-2) + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
  z-index: var(--z-nav);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
  min-height: var(--touch-target-comfortable);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  color: var(--text-secondary);
}

.nav-item:hover {
  background: var(--background-secondary);
}

.nav-item.active {
  color: var(--primary-color);
  background: rgba(44, 90, 160, 0.1);
}

.nav-icon {
  font-size: 1.5rem;
  margin-bottom: var(--space-1);
}

.nav-label {
  font-size: var(--font-size-xs);
  font-weight: 500;
}

/* ===============================================
   FLOATING ACTION BUTTON (FAB)
   =============================================== */
.fab {
  position: fixed;
  bottom: calc(80px + var(--space-4));
  right: var(--space-4);
  width: var(--touch-target-large);
  height: var(--touch-target-large);
  border-radius: 50%;
  background: var(--secondary-color);
  color: white;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-fab);
  transition: all 0.3s ease;
}

.fab:hover {
  background: #00b386;
  transform: scale(1.1);
  box-shadow: var(--shadow-xl);
}

.fab:active {
  transform: scale(1.05);
}

.fab-icon {
  font-size: 1.5rem;
}

/* ===============================================
   TOAST NOTIFICATIONS
   =============================================== */
.toast-container {
  position: fixed;
  top: calc(var(--space-4) + env(safe-area-inset-top));
  left: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-modal);
  pointer-events: none;
}

.toast {
  background: var(--background-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-2);
  box-shadow: var(--shadow-lg);
  transform: translateY(-100px);
  animation: toastSlideIn 0.3s ease-out forwards;
  pointer-events: auto;
}

.toast.success {
  border-color: var(--secondary-color);
  background: rgba(0, 200, 150, 0.1);
}

.toast.error {
  border-color: var(--accent-color);
  background: rgba(255, 107, 107, 0.1);
}

.toast.warning {
  border-color: var(--warning-color);
  background: rgba(255, 167, 38, 0.1);
}

/* ===============================================
   OFFLINE BANNER
   =============================================== */
.offline-banner {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 60px);
  left: var(--space-4);
  right: var(--space-4);
  background: var(--warning-color);
  color: white;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  box-shadow: var(--shadow-md);
  z-index: var(--z-overlay);
  font-size: var(--font-size-sm);
  font-weight: 500;
}

.offline-icon {
  font-size: 1.2rem;
}

/* ===============================================
   RESPONSIVE BREAKPOINTS
   =============================================== */
@media (min-width: 768px) {
  .dashboard-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .main-content {
    padding: var(--space-6);
    padding-bottom: calc(80px + var(--space-6));
  }
  
  .action-card {
    min-height: 180px;
  }
  
  .fab {
    width: 64px;
    height: 64px;
    bottom: calc(80px + var(--space-6));
    right: var(--space-6);
  }
}

@media (min-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .header-content,
  .main-content {
    max-width: 1200px;
    margin: 0 auto;
  }
}

/* ===============================================
   ANIMATIONS
   =============================================== */
@keyframes fadeOut {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

@keyframes loadingBar {
  to {
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

@keyframes voicePulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 0.7;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

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

@keyframes toastSlideIn {
  to {
    transform: translateY(0);
  }
}

/* ===============================================
   ACCESSIBILITY IMPROVEMENTS
   =============================================== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border-color: #000000;
    --text-secondary: #000000;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --text-primary: var(--dark-text-primary);
    --text-secondary: var(--dark-text-secondary);
    --background-primary: var(--dark-bg-primary);
    --background-secondary: var(--dark-bg-secondary);
    --background-card: var(--dark-bg-card);
    --border-color: var(--dark-border);
  }
}