/* POS System - Адаптивная ориентация: 
   - Телефоны (< 768px): вертикальная ориентация
   - Планшеты (>= 768px): горизонтальная ориентация */

/* ПЛАНШЕТЫ: Принудительная горизонтальная ориентация для устройств >= 768px */
@media screen and (min-device-width: 768px) {
  html, body {
    /* Принудительная горизонтальная ориентация */
    -webkit-screen-orientation: landscape;
    -moz-screen-orientation: landscape;
    -ms-screen-orientation: landscape;
    screen-orientation: landscape;
    
    /* Отключить масштабирование и прокрутку */
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    
    /* Отключить выделение текста */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    
    /* Отключить context menu */
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
  }
}

/* ТЕЛЕФОНЫ: Разрешить любую ориентацию для устройств < 768px */
@media screen and (max-device-width: 767px) {
  html, body {
    /* Разрешить вертикальную ориентацию */
    -webkit-screen-orientation: auto;
    -moz-screen-orientation: auto;
    -ms-screen-orientation: auto;
    screen-orientation: auto;
    
    /* Разрешить прокрутку и масштабирование */
    overflow: auto;
    position: relative;
    
    /* Разрешить выделение текста */
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    
    /* Включить стандартные touch события */
    -webkit-touch-callout: default;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
  }
}

/* ПЛАНШЕТЫ: Уведомление о повороте только для планшетов в портретной ориентации */
@media screen and (orientation: portrait) and (min-device-width: 768px) {
  .rotate-device-notice {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1e293b;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  }
  
  .rotate-device-notice .icon {
    font-size: 64px;
    margin-bottom: 24px;
    animation: rotate 2s ease-in-out infinite;
  }
  
  .rotate-device-notice h1 {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 16px 0;
    text-align: center;
  }
  
  .rotate-device-notice p {
    font-size: 16px;
    opacity: 0.8;
    margin: 0;
    text-align: center;
    max-width: 300px;
    line-height: 1.5;
  }
  
  @keyframes rotate {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(90deg); }
    50% { transform: rotate(90deg); }
    75% { transform: rotate(90deg); }
    100% { transform: rotate(90deg); }
  }
  
  /* Скрыть основное приложение в портретной ориентации */
  flutter-view, flt-glass-pane {
    display: none !important;
  }
}

/* ПЛАНШЕТЫ: Показать приложение в горизонтальной ориентации, скрыть уведомление */
@media screen and (orientation: landscape) and (min-device-width: 768px) {
  .rotate-device-notice {
    display: none !important;
  }
  
  flutter-view {
    width: 100vw !important;
    height: 100vh !important;
  }
  
  /* Оптимизация для iOS Safari на планшетах */
  html.ios {
    height: 100vh;
    height: -webkit-fill-available;
  }
  
  html.ios body {
    height: 100vh;
    height: -webkit-fill-available;
  }
}

/* ТЕЛЕФОНЫ: Всегда скрывать уведомление о повороте, разрешить любую ориентацию */
@media screen and (max-device-width: 767px) {
  .rotate-device-notice {
    display: none !important;
  }
  
  /* Адаптивная высота для мобильных */
  flutter-view {
    width: 100vw !important;
    height: 100vh !important;
  }
  
  /* Оптимизация для мобильных iOS */
  html.ios {
    height: 100vh;
    height: -webkit-fill-available;
  }
  
  html.ios body {
    height: 100vh;
    height: -webkit-fill-available;
  }
} 