/* ========================================
   RESPONSIVE DESIGN - MOBILE & TABLET
   Add this to your stylesheets folder
   ======================================== */

/* Base responsive meta tag needed in all layouts */
/* Add to each layout head: */
/* meta(name="viewport", content="width=device-width, initial-scale=1.0, maximum-scale=5.0") */

/* ========================================
   GLOBAL RESPONSIVE FIXES
   ======================================== */

* {
  box-sizing: border-box;
}

body {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

img {
  max-width: 100%;
  height: auto;
}

/* ========================================
   HEADER - MOBILE RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
  .site-header {
    flex-direction: column;
    padding: 15px 20px !important;
    gap: 15px;
  }

  .header-left,
  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  .site-title {
    font-size: 18px !important;
    letter-spacing: 3px !important;
  }

  /* Status indicator mobile */
  .status-wrapper {
    position: relative;
  }

  .status-popup {
    position: fixed !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 90vw !important;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 10000;
  }

  .status-popup::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: -1;
  }

  /* Search wrapper mobile */
  .search-wrapper {
    flex: 1;
    max-width: 100%;
  }

  .search-input {
    width: 100% !important;
    padding: 10px 12px !important;
    font-size: 14px !important;
  }

  .projects-button {
    padding: 10px 20px !important;
    font-size: 12px !important;
  }
}

/* ========================================
   HERO SECTION - MOBILE
   ======================================== */

@media (max-width: 768px) {
  .hero {
    min-height: 70vh !important;
    padding: 40px 20px !important;
  }

  .hero h1 {
    font-size: 48px !important;
    letter-spacing: 8px !important;
  }

  .hero p {
    font-size: 12px !important;
  }
}

/* ========================================
   SCROLL INDICATOR - MOBILE
   ======================================== */

@media (max-width: 768px) {
  .scroll-indicator {
    right: 10px !important;
    gap: 8px !important;
  }

  .indicator-point {
    width: 8px !important;
    height: 8px !important;
  }

  .entry-points {
    display: none !important; /* Hide on mobile for better UX */
  }
}

/* ========================================
   SECTIONS - MOBILE
   ======================================== */

@media (max-width: 768px) {
  .section {
    padding: 60px 20px !important;
    min-height: auto !important;
  }

  .section-content {
    max-width: 100% !important;
  }

  .section h2 {
    font-size: 32px !important;
    letter-spacing: 4px !important;
    margin-bottom: 20px !important;
  }

  .section p {
    font-size: 14px !important;
    line-height: 1.6 !important;
  }

  .contact-button {
    padding: 12px 30px !important;
    font-size: 12px !important;
  }
}

/* ========================================
   AI CHAT - MOBILE
   ======================================== */

@media (max-width: 768px) {
  .chat-container {
    max-width: 100% !important;
    height: 400px !important;
  }

  .chat-messages {
    padding: 15px !important;
  }

  .ai-message,
  .user-message {
    max-width: 85% !important;
  }

  .message-avatar {
    width: 30px !important;
    height: 30px !important;
    font-size: 10px !important;
  }

  .message-content {
    font-size: 13px !important;
    padding: 10px 12px !important;
  }

  .chat-input-wrapper {
    padding: 12px !important;
    gap: 8px !important;
  }

  .chat-input {
    font-size: 14px !important;
    padding: 10px 12px !important;
  }

  .chat-send-button {
    padding: 10px 16px !important;
    font-size: 12px !important;
  }
}

/* ========================================
   PROJECTS PAGE - MOBILE
   ======================================== */

@media (max-width: 768px) {
  .projects-header {
    padding: 40px 20px !important;
  }

  .projects-title {
    font-size: 36px !important;
    letter-spacing: 4px !important;
  }

  .projects-subtitle {
    font-size: 11px !important;
  }

  .projects-grid {
    grid-template-columns: 1fr !important;
    gap: 30px !important;
    padding: 20px !important;
  }

  .project-item {
    padding: 15px !important;
  }

  .project-meta-top {
    margin-bottom: 12px !important;
  }

  .project-number {
    font-size: 11px !important;
  }

  .status-tag {
    padding: 4px 10px !important;
    font-size: 9px !important;
  }

  .project-name {
    font-size: 20px !important;
    letter-spacing: 2px !important;
  }

  .project-desc {
    font-size: 13px !important;
  }

  .btn-details {
    padding: 10px 20px !important;
    font-size: 11px !important;
  }
}

/* ========================================
   PROJECT MODAL - MOBILE
   ======================================== */

@media (max-width: 768px) {
  .modal-content {
    width: 95vw !important;
    max-width: 95vw !important;
    height: 90vh !important;
    max-height: 90vh !important;
    margin: 0 !important;
  }

  .modal-grid {
    grid-template-columns: 1fr !important;
    max-height: 100%;
  }

  .modal-image-side {
    max-height: 250px !important;
    min-height: 200px !important;
  }

  .modal-info-side {
    padding: 20px !important;
    max-height: calc(90vh - 250px);
    overflow-y: auto;
  }

  .modal-label {
    font-size: 9px !important;
  }

  #modalTitle {
    font-size: 24px !important;
    letter-spacing: 2px !important;
  }

  .modal-meta-row {
    flex-direction: column !important;
    gap: 15px !important;
  }

  .info-section label {
    font-size: 10px !important;
  }

  .info-section p {
    font-size: 13px !important;
  }

  .btn-live-action {
    padding: 12px 24px !important;
    font-size: 12px !important;
  }

  .close-modal {
    font-size: 32px !important;
    padding: 10px !important;
  }
}

/* ========================================
   CONTACTS PAGE - MOBILE
   ======================================== */

@media (max-width: 768px) {
  .contacts-page {
    padding: 20px !important;
  }

  .contact-header h1 {
    font-size: 32px !important;
    letter-spacing: 4px !important;
  }

  .contact-body {
    flex-direction: column !important;
    gap: 30px !important;
  }

  .contact-text h2 {
    font-size: 24px !important;
  }

  .contact-text p {
    font-size: 14px !important;
  }

  .contact-form input,
  .contact-form textarea {
    font-size: 14px !important;
    padding: 12px !important;
  }

  .contact-form button {
    padding: 12px 30px !important;
    font-size: 12px !important;
  }
}

/* ========================================
   SEARCH PAGE - MOBILE
   ======================================== */

@media (max-width: 768px) {
  .search-results-wrapper {
    padding: 30px 20px !important;
  }

  .search-results-wrapper h1 {
    font-size: 32px !important;
    letter-spacing: 4px !important;
  }

  .search-query {
    font-size: 14px !important;
  }

  .results-count {
    font-size: 12px !important;
  }

  .result-item {
    padding: 15px !important;
  }

  .result-item h3 {
    font-size: 18px !important;
  }

  .result-item p {
    font-size: 13px !important;
  }
}

/* ========================================
   ADMIN PANEL - MOBILE
   ======================================== */

@media (max-width: 1024px) {
  .studio-layout {
    grid-template-columns: 1fr !important;
    gap: 30px !important;
    padding: 30px 20px !important;
  }

  .studio-sidebar {
    position: static !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 20px !important;
  }

  .studio-nav {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    width: 100%;
  }

  .nav-item {
    flex: 1;
    min-width: 120px;
    text-align: center !important;
    padding: 10px 15px !important;
    font-size: 11px !important;
  }

  .logout-btn {
    margin-top: 0 !important;
  }

  .tool-card {
    padding: 20px !important;
  }

  .grid-2 {
    grid-template-columns: 1fr !important;
  }

  .field label {
    font-size: 9px !important;
  }

  .field input,
  .field textarea,
  .field select {
    font-size: 14px !important;
    padding: 10px !important;
  }

  .tool-actions {
    flex-direction: column !important;
  }

  .btn-primary,
  .btn-danger {
    width: 100%;
    padding: 12px !important;
  }

  .project-head {
    padding: 15px 20px !important;
    flex-direction: column !important;
    gap: 10px !important;
  }

  .module-body {
    padding: 20px !important;
  }
}

/* ========================================
   MAP PAGE - MOBILE
   ======================================== */

@media (max-width: 768px) {
  #canvas-container,
  #labels-container {
    touch-action: pan-y pinch-zoom !important;
  }
}

/* ========================================
   COOKIE CONSENT - MOBILE
   ======================================== */

@media (max-width: 768px) {
  #cookieConsentOverlay {
    padding: 20px !important;
  }

  .cookie-content {
    width: 100% !important;
    max-width: 100% !important;
    padding: 25px !important;
    max-height: 90vh;
    overflow-y: auto;
  }

  .cookie-content h3 {
    font-size: 20px !important;
    letter-spacing: 3px !important;
  }

  .cookie-content p {
    font-size: 13px !important;
  }

  .cookie-content label {
    font-size: 12px !important;
    padding: 10px 0 !important;
  }

  .cookie-content button {
    padding: 12px 30px !important;
    font-size: 12px !important;
  }
}

/* ========================================
   FOOTER - MOBILE
   ======================================== */

@media (max-width: 768px) {
  .footer {
    padding: 30px 20px !important;
  }

  .footer-inner {
    flex-direction: column !important;
    gap: 15px !important;
    text-align: center;
  }

  .footer-brand {
    font-size: 16px !important;
    letter-spacing: 4px !important;
  }

  .footer-link {
    font-size: 11px !important;
  }
}

/* ========================================
   PRIVACY & LICENSE PAGES - MOBILE
   ======================================== */

@media (max-width: 768px) {
  .privacy-wrapper,
  .license-wrapper {
    padding: 30px 20px !important;
    max-width: 100% !important;
  }

  .privacy-wrapper h1,
  .license-wrapper h1 {
    font-size: 32px !important;
    letter-spacing: 4px !important;
  }

  .privacy-wrapper h2,
  .license-wrapper h2 {
    font-size: 22px !important;
    letter-spacing: 2px !important;
  }

  .privacy-wrapper p,
  .license-wrapper p,
  .privacy-wrapper li,
  .license-wrapper li {
    font-size: 14px !important;
    line-height: 1.6 !important;
  }

  .back-button {
    top: 15px !important;
    left: 15px !important;
    padding: 8px 12px !important;
    font-size: 12px !important;
  }
}

/* ========================================
   ERROR PAGE - MOBILE
   ======================================== */

@media (max-width: 768px) {
  .error-wrapper {
    padding: 40px 20px !important;
    flex-direction: column !important;
  }

  .error-text h1 {
    font-size: 72px !important;
  }

  .error-text h2 {
    font-size: 24px !important;
  }

  .error-text p {
    font-size: 14px !important;
  }

  .error-actions {
    flex-direction: column !important;
    gap: 15px !important;
  }

  .error-button {
    width: 100%;
    padding: 12px 30px !important;
    font-size: 12px !important;
  }

  .error-image {
    max-width: 200px !important;
    margin-top: 30px;
  }
}

/* ========================================
   TABLET SPECIFIC (768px - 1024px)
   ======================================== */

@media (min-width: 769px) and (max-width: 1024px) {
  .site-header {
    padding: 20px 40px !important;
  }

  .projects-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 25px !important;
  }

  .section {
    padding: 80px 40px !important;
  }

  .modal-content {
    width: 85vw !important;
    max-width: 85vw !important;
  }
}

/* ========================================
   TOUCH DEVICE IMPROVEMENTS
   ======================================== */

@media (hover: none) and (pointer: coarse) {
  /* Larger tap targets for touch */
  button,
  a,
  input[type="submit"],
  .btn-details,
  .nav-item {
    min-height: 44px !important;
    min-width: 44px !important;
  }

  /* Remove hover states on touch devices */
  .project-item:hover,
  .result-item:hover,
  .footer-link:hover {
    transform: none !important;
  }

  /* Improve scrolling on touch */
  .chat-messages,
  .modal-info-side,
  .cookie-content {
    -webkit-overflow-scrolling: touch;
  }
}

/* ========================================
   LANDSCAPE MODE MOBILE
   ======================================== */

@media (max-width: 768px) and (orientation: landscape) {
  .hero {
    min-height: 100vh !important;
  }

  .section {
    min-height: auto !important;
  }

  .scroll-indicator {
    display: none !important;
  }

  .modal-content {
    height: 95vh !important;
  }

  .modal-image-side {
    max-height: 200px !important;
  }
}

/* ========================================
   VERY SMALL DEVICES (< 360px)
   ======================================== */

@media (max-width: 360px) {
  .hero h1 {
    font-size: 36px !important;
    letter-spacing: 4px !important;
  }

  .site-title {
    font-size: 16px !important;
  }

  .projects-title {
    font-size: 28px !important;
  }

  .search-input {
    font-size: 13px !important;
  }
}

/* ========================================
   UTILITY CLASSES FOR RESPONSIVE
   ======================================== */

.hide-mobile {
  display: block;
}

.show-mobile {
  display: none;
}

@media (max-width: 768px) {
  .hide-mobile {
    display: none !important;
  }

  .show-mobile {
    display: block !important;
  }
}

/* Prevent text selection on UI elements */
.status-indicator,
.nav-item,
.btn-details,
.projects-button {
  -webkit-user-select: none;
  user-select: none;
}

/* Smooth scrolling for all devices */
html {
  scroll-behavior: smooth;
}