/**
 * Sen Restaurant - PWA Mobile Optimized Styles
 * Version: 3.0.0
 * Mobile-first responsive design with PWA support
 */

/* ============================
   CSS VARIABLES & RESET
   ============================ */
:root {
  /* Restaurant Color Palette */
  --primary-color: #E63946;
  --primary-dark: #C1121F;
  --primary-light: rgba(230, 57, 70, 0.1);
  --secondary-color: #F4A261;
  --secondary-dark: #E76F51;
  --accent-color: #2A9D8F;
  --accent-dark: #21867a;
  --dark-color: #264653;
  --dark-light: #2d535e;
  
  /* Background Colors */
  --bg-color: #FFF8F0;
  --card-bg: #FFFFFF;
  --bg-secondary: #FFF0E0;
  
  /* Text Colors */
  --text-color: #2D3436;
  --text-muted: #636E72;
  --text-light: #B2BEC3;
  
  /* Border Colors */
  --border-color: #E8D5B7;
  --border-light: #F0E6D6;
  
  /* Semantic Colors */
  --success-color: #2ECC71;
  --success-dark: #27AE60;
  --warning-color: #F39C12;
  --warning-dark: #E67E22;
  --danger-color: #E74C3C;
  --danger-dark: #C0392B;
  --info-color: #3498DB;
  --info-dark: #2980B9;
  
  /* Grays (warm tones) */
  --gray-100: #FFF5EB;
  --gray-200: #F0E6D6;
  --gray-300: #D5C4B0;
  --gray-400: #A89585;
  --gray-500: #7D6B5D;
  --gray-600: #5C4D3C;
  --gray-700: #3D3225;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --safe-area-top: env(safe-area-inset-top);
  --safe-area-bottom: env(safe-area-inset-bottom);
  --safe-area-left: env(safe-area-inset-left);
  --safe-area-right: env(safe-area-inset-right);
  --header-height: 60px;
  --bottom-nav-height: 64px;
  --touch-target: 44px;
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.pwa-mobile {
  padding-top: var(--header-height);
  padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
}

/* ============================
   APP WRAPPER & LAYOUT
   ============================ */
.app-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================
   APP HEADER
   ============================ */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--header-height) + var(--safe-area-top));
  padding-top: var(--safe-area-top);
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  box-shadow: var(--shadow-md);
  z-index: 1000;
}

.app-header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 1rem;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: white;
}

.app-logo img {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: white;
  padding: 4px;
}

.app-logo-text {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-btn {
  width: var(--touch-target);
  height: var(--touch-target);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: var(--radius);
  text-decoration: none;
  transition: all 0.2s ease;
  font-size: 1.125rem;
}

.header-btn:active {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(0.95);
}

/* ============================
   MAIN CONTENT AREA
   ============================ */
.app-content {
  flex: 1;
  padding: 1rem;
  padding-bottom: 2rem;
}

/* ============================
   MOBILE ALERTS
   ============================ */
.mobile-alert {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  animation: slideDown 0.3s ease;
}

.mobile-alert i:first-child {
  font-size: 1.125rem;
}

.mobile-alert span {
  flex: 1;
}

.alert-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.1);
  border: none;
  border-radius: var(--radius);
  color: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

.alert-close:active {
  background: rgba(0, 0, 0, 0.2);
}

.mobile-alert-success {
  background: #d1fae5;
  color: #065f46;
}

.mobile-alert-info {
  background: #dbeafe;
  color: #1e40af;
}

.mobile-alert-danger {
  background: #fee2e2;
  color: #991b1b;
}

.mobile-alert-warning {
  background: #fef3c7;
  color: #92400e;
}

/* ============================
   BOTTOM NAVIGATION
   ============================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
  padding-bottom: var(--safe-area-bottom);
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 1000;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  height: var(--bottom-nav-height);
  text-decoration: none;
  color: var(--gray-500);
  transition: all 0.2s ease;
  position: relative;
}

.bottom-nav-item i {
  font-size: 1.25rem;
  transition: all 0.2s ease;
}

.bottom-nav-item span {
  font-size: 0.6875rem;
  font-weight: 500;
}

.bottom-nav-item:active {
  background: var(--gray-100);
}

.bottom-nav-item.active {
  color: var(--primary-color);
}

.bottom-nav-item.active i {
  transform: scale(1.1);
}

/* Active indicator */
.bottom-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 3px;
  background: var(--primary-color);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ============================
   APP FOOTER
   ============================ */
.app-footer {
  padding: 1rem;
  text-align: center;
  color: var(--gray-500);
  font-size: 0.75rem;
  border-top: 1px solid var(--border-color);
  background: var(--card-bg);
}

.footer-content p {
  margin: 0;
}

/* ============================
   PWA INSTALL PROMPT
   ============================ */
.install-prompt {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom) + 1rem);
  left: 1rem;
  right: 1rem;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 999;
  animation: slideUp 0.3s ease;
}

.install-prompt-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
}

.install-prompt-text {
  flex: 1;
}

.install-prompt-text h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-color);
  margin: 0 0 0.25rem 0;
}

.install-prompt-text p {
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin: 0;
  line-height: 1.4;
}

.install-btn {
  flex-shrink: 0;
  padding: 0.625rem 1.25rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.install-btn:active {
  background: var(--primary-dark);
  transform: scale(0.98);
}

.install-close-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  border: none;
  border-radius: var(--radius);
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.2s ease;
}

.install-close-btn:active {
  background: var(--gray-200);
}

/* ============================
   OFFLINE INDICATORS
   ============================ */
.offline-indicator {
  position: fixed;
  top: calc(var(--header-height) + var(--safe-area-top) + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  background: var(--success-color);
  color: white;
  padding: 0.625rem 1rem;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  z-index: 998;
  animation: fadeIn 0.3s ease;
}

.offline-indicator i {
  font-size: 0.875rem;
}

.offline-banner {
  position: fixed;
  top: calc(var(--header-height) + var(--safe-area-top));
  left: 0;
  right: 0;
  background: var(--danger-color);
  color: white;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  z-index: 998;
  animation: slideDown 0.3s ease;
}

/* ============================
   CARDS & CONTAINERS
   ============================ */
.mobile-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1rem;
  transition: all 0.2s ease;
}

.mobile-card:active {
  box-shadow: var(--shadow-md);
}

.mobile-card-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.mobile-card-body {
  padding: 1rem;
}

.mobile-card-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
}

/* ============================
   BUTTONS (Touch-Optimized)
   ============================ */
.mobile-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--touch-target);
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
}

.mobile-btn:active {
  transform: scale(0.98);
}

.mobile-btn-primary {
  background: var(--primary-color);
  color: white;
}

.mobile-btn-primary:active {
  background: var(--primary-dark);
}

.mobile-btn-success {
  background: var(--success-color);
  color: white;
}

.mobile-btn-success:active {
  background: var(--success-dark);
}

.mobile-btn-danger {
  background: var(--danger-color);
  color: white;
}

.mobile-btn-danger:active {
  background: var(--danger-dark);
}

.mobile-btn-outline {
  background: transparent;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
}

.mobile-btn-outline:active {
  background: var(--primary-color);
  color: white;
}

.mobile-btn-block {
  width: 100%;
}

.mobile-btn i {
  font-size: 1rem;
}

/* ============================
   FORM CONTROLS
   ============================ */
.mobile-form-group {
  margin-bottom: 1rem;
}

.mobile-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-color);
}

.mobile-input {
  width: 100%;
  min-height: var(--touch-target);
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: all 0.2s ease;
  background: var(--card-bg);
}

.mobile-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.mobile-textarea {
  min-height: 120px;
  resize: vertical;
}

/* ============================
   LOADING STATES
   ============================ */
.mobile-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.mobile-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ============================
   EMPTY STATES
   ============================ */
.mobile-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
}

.mobile-empty i {
  font-size: 4rem;
  color: var(--gray-300);
  margin-bottom: 1rem;
}

.mobile-empty h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 0.5rem;
}

.mobile-empty p {
  font-size: 0.875rem;
  color: var(--gray-500);
}

/* ============================
   ANIMATIONS
   ============================ */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

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

.animate-slide-up {
  animation: slideUp 0.3s ease;
}

.animate-slide-down {
  animation: slideDown 0.3s ease;
}

.animate-fade-in {
  animation: fadeIn 0.3s ease;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* ============================
   UTILITY CLASSES
   ============================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }

.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* ============================
   RESPONSIVE BREAKPOINTS
   ============================ */
@media (min-width: 640px) {
  .app-content {
    max-width: 640px;
    margin: 0 auto;
  }
}

@media (min-width: 768px) {
  :root {
    --header-height: 64px;
  }
  
  .app-logo img {
    width: 40px;
    height: 40px;
  }
  
  .app-logo-text {
    font-size: 1.25rem;
  }
}

@media (min-width: 1024px) {
  body.pwa-mobile {
    padding-bottom: 0;
  }
  
  .bottom-nav {
    display: none;
  }
  
  .app-content {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem;
  }
}

/* ============================
   DARK MODE SUPPORT (Optional)
   ============================ */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --gray-100: #1e293b;
    --gray-200: #334155;
    --gray-300: #475569;
    --gray-400: #64748b;
    --gray-500: #94a3b8;
    --gray-600: #cbd5e1;
    --gray-700: #e2e8f0;
  }
  
  .mobile-input {
    background: var(--card-bg);
    color: var(--text-color);
  }
  
  .bottom-nav {
    background: var(--card-bg);
  }
  
  .bottom-nav-item:active {
    background: var(--gray-200);
  }
}

/* ============================
   PRINT STYLES
   ============================ */
@media print {
  .app-header,
  .bottom-nav,
  .install-prompt,
  .offline-indicator,
  .offline-banner {
    display: none !important;
  }
  
  body.pwa-mobile {
    padding: 0;
  }
  
  .app-content {
    padding: 0;
  }
}
