/* ==================== MOBILE RESPONSIVE IMPROVEMENTS ==================== */
/* Enhanced mobile layout for all pages */
/* Add this AFTER style.css in your HTML: <link rel="stylesheet" href="/css/mobile-responsive.css"> */

/* ==================== BASE MOBILE ADJUSTMENTS ==================== */

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

/* Prevent horizontal scroll on mobile */
body {
  overflow-x: hidden;
  width: 100%;
}

/* Better touch targets for mobile */
a, button, .btn, input, select, textarea {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* ==================== TABLET (1024px and below) ==================== */
@media (max-width: 1024px) {
  .container {
    max-width: 100%;
    padding: 0 2rem;
  }
  
  /* Two column grids on tablet */
  .features-grid,
  .executors-grid,
  .projects-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1.5rem;
  }
}

/* ==================== MOBILE (768px and below) ==================== */
@media (max-width: 768px) {
  
  /* ===== NAVBAR MOBILE ===== */
  .navbar {
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
  }
  
  .nav-container {
    padding: 0 1rem;
    flex-wrap: nowrap;
  }
  
  .nav-brand {
    font-size: 1.25rem;
    flex-shrink: 0;
  }
  
  .nav-brand img {
    height: 32px;
    width: auto;
  }
  
  /* Hide desktop nav links */
  .nav-links {
    display: none;
  }
  
  /* Mobile menu toggle button */
  .mobile-menu-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    cursor: pointer;
    margin-left: auto;
  }
  
  .mobile-menu-toggle i {
    font-size: 1.5rem;
    color: var(--text-primary);
  }
  
  /* Mobile navigation actions */
  .nav-actions {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    align-items: center;
  }
  
  .nav-actions .btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    white-space: nowrap;
  }
  
  .nav-actions .user-menu {
    position: relative;
  }
  
  .nav-actions .dropdown-menu {
    right: 0;
    left: auto;
    min-width: 200px;
  }
  
  /* ===== HERO SECTIONS MOBILE ===== */
  .hero,
  .executors-hero,
  .projects-hero,
  .dashboard-header {
    padding: 2.5rem 1rem !important;
    text-align: center;
    margin-bottom: 2rem;
  }
  
  .hero h1,
  .executors-hero h1,
  .projects-hero h1 {
    font-size: 1.75rem !important;
    line-height: 1.3;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .hero h1 i,
  .executors-hero h1 i,
  .projects-hero h1 i {
    font-size: 2rem;
  }
  
  .hero p,
  .executors-hero p,
  .projects-hero p {
    font-size: 1rem !important;
    max-width: 100%;
    padding: 0 1rem;
  }
  
  .hero-buttons {
    flex-direction: column;
    width: 100%;
    gap: 0.75rem;
  }
  
  .hero-buttons .btn {
    width: 100%;
    padding: 0.875rem;
  }
  
  /* ===== EXECUTORS PAGE MOBILE ===== */
  .version-cards {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
  
  .version-card {
    padding: 1.5rem !important;
  }
  
  .version-header h3 {
    font-size: 1.25rem;
  }
  
  .version-badges {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .version-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }
  
  .executors-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
  
  .executor-card {
    padding: 1.25rem;
  }
  
  .executor-header h3 {
    font-size: 1.125rem;
  }
  
  .executor-tags {
    flex-wrap: wrap;
  }
  
  .executor-tag {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
  }
  
  .executor-stats {
    gap: 1rem;
  }
  
  .executor-stat span:first-child {
    font-size: 0.75rem;
  }
  
  /* ===== PROJECTS PAGE MOBILE ===== */
  .projects-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
  
  .project-card {
    padding: 1.25rem;
  }
  
  .project-header h3 {
    font-size: 1.125rem;
  }
  
  .project-tags {
    flex-wrap: wrap;
  }
  
  .project-tag {
    font-size: 0.7rem;
  }
  
  /* ===== FEATURES GRID MOBILE ===== */
  .features-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
  
  .feature-card {
    padding: 1.5rem;
  }
  
  .feature-card i {
    font-size: 2rem;
  }
  
  .feature-card h3 {
    font-size: 1.125rem;
  }
  
  /* ===== DASHBOARD MOBILE ===== */
  .dashboard-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
    padding: 0 1rem;
  }
  
  .dashboard-card {
    padding: 1.5rem;
  }
  
  .dashboard-card h3 {
    font-size: 1.125rem;
  }
  
  .stat-card {
    padding: 1.25rem;
  }
  
  .stat-value {
    font-size: 1.75rem;
  }
  
  /* ===== TICKETS PAGE MOBILE ===== */
  .tickets-container {
    padding: 0 1rem;
    margin-top: 80px;
  }
  
  .tickets-header {
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem 1rem;
  }
  
  .tickets-header h1 {
    font-size: 1.5rem;
  }
  
  .tickets-filters {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }
  
  .filter-group {
    width: 100%;
  }
  
  .filter-group select,
  .search-box input {
    width: 100%;
  }
  
  /* ===== TICKET VIEW MOBILE ===== */
  .ticket-view-container {
    grid-template-columns: 1fr !important;
    gap: 1rem;
    margin: 80px auto 40px;
    padding: 0 1rem;
  }
  
  .sidebar-content {
    position: static;
    order: 2; /* Show after main content */
  }
  
  .ticket-header {
    padding: 1.25rem;
    flex-direction: column;
    gap: 1rem;
  }
  
  .ticket-title {
    font-size: 1.25rem !important;
    word-break: break-word;
  }
  
  .ticket-meta {
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
  }
  
  .meta-item {
    width: 100%;
    justify-content: space-between;
  }
  
  .ticket-messages {
    padding: 1rem;
  }
  
  .message-bubble {
    padding: 1rem;
    max-width: 100%;
  }
  
  .message-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .message-content {
    font-size: 0.95rem;
    word-break: break-word;
  }
  
  .message-attachments {
    flex-direction: column;
  }
  
  .attachment-item {
    width: 100%;
  }
  
  .reply-form {
    padding: 1rem;
  }
  
  .reply-form textarea {
    min-height: 120px;
    font-size: 1rem;
  }
  
  .form-actions {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .form-actions .btn {
    width: 100%;
  }
  
  /* ===== SETTINGS PAGE MOBILE ===== */
  .settings-container {
    padding: 0 1rem;
    margin-top: 80px;
  }
  
  .settings-header h1 {
    font-size: 1.5rem;
  }
  
  .settings-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
  
  .settings-section {
    padding: 1.5rem;
  }
  
  .settings-section h2 {
    font-size: 1.25rem;
  }
  
  .form-group label {
    font-size: 0.9rem;
  }
  
  /* ===== CONTACT PAGE MOBILE ===== */
  .contact-container {
    padding: 0 1rem;
    margin-top: 80px;
  }
  
  .contact-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }
  
  .contact-info,
  .contact-form-container {
    padding: 1.5rem;
  }
  
  /* ===== CARDS & COMPONENTS MOBILE ===== */
  .card {
    padding: 1.25rem;
    margin: 0.75rem 0;
    border-radius: 12px;
  }
  
  .card-header {
    flex-direction: column;
    gap: 1rem;
  }
  
  .card-title {
    font-size: 1.125rem;
  }
  
  .card-actions {
    width: 100%;
  }
  
  .card-actions .btn {
    width: 100%;
  }
  
  /* ===== TABLES MOBILE ===== */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1rem;
    padding: 0 1rem;
  }
  
  table {
    font-size: 0.875rem;
    min-width: 600px;
  }
  
  table th,
  table td {
    padding: 0.75rem;
    white-space: nowrap;
  }
  
  /* Mobile table alternative - stacked layout */
  .table-mobile {
    display: none;
  }
  
  @media (max-width: 480px) {
    .table-desktop {
      display: none;
    }
    
    .table-mobile {
      display: block;
    }
    
    .table-mobile-item {
      background: var(--surface-color);
      border: 1px solid var(--border-color);
      border-radius: 8px;
      padding: 1rem;
      margin-bottom: 1rem;
    }
    
    .table-mobile-row {
      display: flex;
      justify-content: space-between;
      padding: 0.5rem 0;
      border-bottom: 1px solid var(--border-color);
    }
    
    .table-mobile-row:last-child {
      border-bottom: none;
    }
    
    .table-mobile-label {
      font-weight: 600;
      color: var(--text-secondary);
    }
    
    .table-mobile-value {
      color: var(--text-primary);
      text-align: right;
    }
  }
  
  /* ===== MODALS MOBILE ===== */
  .modal-content {
    width: 95%;
    max-width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    margin: 5vh auto;
    padding: 1.5rem;
  }
  
  .modal-header h2 {
    font-size: 1.25rem;
  }
  
  .modal-body {
    padding: 1rem 0;
  }
  
  .modal-footer {
    flex-direction: column-reverse;
    gap: 0.75rem;
  }
  
  .modal-footer .btn {
    width: 100%;
  }
  
  /* ===== ALERTS & TOASTS MOBILE ===== */
  .alert {
    padding: 1rem;
    font-size: 0.9rem;
    border-radius: 8px;
  }
  
  .toast {
    width: calc(100% - 2rem);
    max-width: 100%;
    left: 1rem;
    right: 1rem;
    border-radius: 8px;
  }
  
  /* ===== NOTIFICATION BELL MOBILE ===== */
  .notification-bell {
    position: relative;
  }
  
  .notification-dropdown {
    position: fixed !important;
    top: 60px;
    right: 1rem;
    left: 1rem;
    width: auto;
    max-height: 60vh;
    overflow-y: auto;
  }
  
  .notification-item {
    padding: 1rem;
  }
  
  .notification-content {
    font-size: 0.9rem;
  }
  
  /* ===== BADGES & TAGS MOBILE ===== */
  .badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }
  
  .tag {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
  }
  
  /* ===== BUTTONS MOBILE ===== */
  .btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    border-radius: 8px;
    white-space: nowrap;
  }
  
  .btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
  }
  
  .btn-lg {
    padding: 1rem 1.5rem;
    font-size: 1rem;
  }
  
  .btn-block {
    width: 100%;
    display: block;
  }
  
  /* ===== FORMS MOBILE ===== */
  .form-group {
    margin-bottom: 1.25rem;
  }
  
  .form-label {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
  }
  
  .form-control,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px !important; /* Prevents zoom on iOS */
    padding: 0.75rem;
    border-radius: 8px;
  }
  
  textarea {
    min-height: 120px;
    resize: vertical;
  }
  
  .form-row {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
  
  /* ===== FOOTER MOBILE ===== */
  .footer {
    padding: 2rem 1rem;
  }
  
  .footer-content {
    flex-direction: column;
    gap: 2rem;
    text-align: center;
  }
  
  .footer-section {
    width: 100%;
  }
  
  .footer-links {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .footer-bottom {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .social-links {
    justify-content: center;
  }
  
  /* ===== UTILITY CLASSES MOBILE ===== */
  .hide-mobile {
    display: none !important;
  }
  
  .show-mobile {
    display: block !important;
  }
  
  .text-center-mobile {
    text-align: center !important;
  }
  
  .full-width-mobile {
    width: 100% !important;
  }
}

/* ==================== EXTRA SMALL MOBILE (480px and below) ==================== */
@media (max-width: 480px) {
  /* Even smaller adjustments for very small phones */
  body {
    font-size: 13px;
  }
  
  .container {
    padding: 0 0.75rem;
  }
  
  .hero h1,
  .executors-hero h1,
  .projects-hero h1 {
    font-size: 1.5rem !important;
  }
  
  .hero p,
  .executors-hero p,
  .projects-hero p {
    font-size: 0.9rem !important;
  }
  
  .card {
    padding: 1rem;
  }
  
  .btn {
    padding: 0.625rem 1rem;
    font-size: 0.85rem;
  }
  
  .ticket-header {
    padding: 1rem;
  }
  
  .ticket-title {
    font-size: 1.125rem !important;
  }
  
  .message-bubble {
    padding: 0.875rem;
  }
  
  .reply-form {
    padding: 0.875rem;
  }
}

/* ==================== LANDSCAPE MODE (max-height: 500px) ==================== */
@media (max-height: 500px) and (orientation: landscape) {
  /* Reduce padding for landscape mode */
  .hero,
  .executors-hero,
  .projects-hero,
  .dashboard-header {
    padding: 1.5rem 1rem !important;
  }
  
  .hero h1,
  .executors-hero h1,
  .projects-hero h1 {
    font-size: 1.5rem !important;
  }
  
  .modal-content {
    max-height: 95vh;
  }
}

/* ==================== SAFE AREA INSETS (iPhone X, etc.) ==================== */
@supports (padding: max(0px)) {
  body {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
  
  .navbar {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
  
  .footer {
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
  }
}
