/* ===== Pastel Cat Cafe - Responsive Styles ===== */

/* ===== Mobile First Base (0-479px) ===== */
@media (max-width: 479px) {
  .container {
    padding: 0 1rem;
  }
  
  /* Hero Section - Stack vertically on mobile */
  .hero-section {
    padding: 1.25rem;
    border-radius: 20px;
  }
  
  .hero-content {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }
  
  .hero-image {
    width: 100px;
    height: 100px;
  }
  
  .hero-text h1 {
    font-size: 1.25rem;
  }
  
  .hero-text p {
    font-size: 0.9rem;
  }
  
  .hero-cta {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
  }
  
  /* Feed tabs - scrollable on mobile */
  .feed-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    padding: 0.5rem;
    gap: 0.5rem;
    -webkit-overflow-scrolling: touch;
  }
  
  .feed-tab {
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }
  
  /* Post Grid - 1 column on mobile */
  .post-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    padding: 0.5rem 0;
  }
  
  .post-card-content {
    padding: 1rem;
  }
  
  .post-card-name {
    font-size: 1rem;
  }
  
  .snack-btn {
    padding: 0.5rem 0.9rem;
    font-size: 0.85rem;
  }
  
  /* Upload page */
  .upload-page {
    padding: 1.5rem 0.5rem;
  }
  
  .upload-page h1 {
    font-size: 1.5rem;
  }
  
  .upload-form {
    padding: 1.25rem;
    border-radius: 20px;
  }
  
  .upload-dropzone {
    padding: 2rem 1rem;
    border-radius: 16px;
  }
  
  .upload-dropzone-icon {
    font-size: 2.5rem;
  }
  
  .upload-dropzone h3 {
    font-size: 1rem;
  }
  
  .input-pill {
    gap: 0.5rem;
  }
  
  .input-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    font-size: 1rem;
  }
  
  .form-input {
    padding: 0.75rem 0.5rem;
    font-size: 0.95rem;
  }
  
  /* Captcha mini-game */
  .captcha-box {
    padding: 1rem;
    border-radius: 20px;
  }
  
  .captcha-game-grid {
    max-width: 240px;
    gap: 0.5rem;
  }
  
  .captcha-game-emoji {
    font-size: 1.5rem;
  }
  
  /* Post detail */
  .post-detail {
    padding: 1rem;
  }
  
  .post-detail-media {
    border-radius: 16px;
    padding: 8px;
  }
  
  .post-detail-content {
    padding: 1rem;
    border-radius: 20px;
  }
  
  .post-detail-info h1 {
    font-size: 1.25rem;
  }
  
  /* About page */
  .about-page {
    padding: 1.5rem 0.5rem;
  }
  
  .about-section {
    padding: 1.25rem;
    border-radius: 20px;
  }
  
  /* Navbar */
  .navbar-brand span {
    font-size: 1.25rem;
  }
  
  .navbar-logo {
    width: 36px;
    height: 36px;
  }
}

/* ===== Small Mobile (360px-) ===== */
@media (max-width: 359px) {
  .container {
    padding: 0 0.75rem;
  }
  
  .hero-section {
    padding: 1rem;
  }
  
  .hero-image {
    width: 80px;
    height: 80px;
  }
  
  .hero-text h1 {
    font-size: 1.1rem;
  }
  
  .feed-tab {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
  }
  
  .post-card-content {
    padding: 0.75rem;
  }
  
  .snack-btn {
    padding: 0.4rem 0.7rem;
    font-size: 0.8rem;
  }
  
  .captcha-game-grid {
    max-width: 200px;
  }
  
  .captcha-game-emoji {
    font-size: 1.25rem;
  }
}

/* ===== Mobile Large (480px+) ===== */
@media (min-width: 480px) {
  .container {
    padding: 0 1.5rem;
  }
  
  .hero-section {
    padding: 1.5rem 2rem;
  }
  
  .hero-content {
    flex-direction: row;
    text-align: left;
    gap: 1.5rem;
  }
  
  .hero-image {
    width: 120px;
    height: 120px;
  }
  
  .hero-text h1 {
    font-size: 1.5rem;
  }
  
  /* Post Grid - 2 columns */
  .post-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }
  
  .upload-form {
    padding: 1.75rem;
  }
  
  .upload-dropzone {
    padding: 3rem 1.5rem;
  }
}

/* ===== Tablet (768px+) ===== */
@media (min-width: 768px) {
  .container {
    padding: 0 2rem;
  }
  
  .main-content {
    padding-top: 90px;
    padding-bottom: 2rem;
  }
  
  .navbar {
    height: 80px;
  }
  
  /* Hero */
  .hero-section {
    padding: 2rem 2.5rem;
    border-radius: var(--radius-xl);
  }
  
  .hero-content {
    gap: 2rem;
  }
  
  .hero-image {
    width: 150px;
    height: 150px;
  }
  
  .hero-text h1 {
    font-size: 1.75rem;
  }
  
  .hero-cta {
    padding: 0.9rem 1.5rem;
  }
  
  /* Feed */
  .feed-header {
    padding: 2rem 0;
  }
  
  .feed-title h1 {
    font-size: 2.25rem;
  }
  
  .feed-tabs {
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .feed-tab {
    padding: 0.65rem 1.3rem;
    font-size: 0.9rem;
  }
  
  /* Post Grid - 3 columns */
  .post-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
  
  .post-card-content {
    padding: 1.25rem;
  }
  
  .post-card-name {
    font-size: 1.1rem;
  }
  
  /* Upload */
  .upload-page {
    padding: 3rem 1.5rem;
    max-width: 600px;
  }
  
  .upload-form {
    padding: 2rem;
    border-radius: 30px;
  }
  
  .upload-dropzone {
    padding: 3rem 2rem;
    border-radius: 28px;
  }
  
  .captcha-game-grid {
    max-width: 280px;
  }
  
  .captcha-game-emoji {
    font-size: 2rem;
  }
  
  /* Post Detail */
  .post-detail {
    padding: 2rem;
    max-width: 900px;
  }
  
  .post-detail-media {
    border-radius: 20px;
    padding: 12px;
  }
  
  .post-detail-content {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
  }
  
  .post-detail-info h1 {
    font-size: 1.75rem;
  }
  
  /* About */
  .about-page {
    padding: 3rem 1.5rem;
    max-width: 700px;
  }
  
  .about-section {
    padding: 2rem;
    border-radius: var(--radius-lg);
  }
}

/* ===== Desktop (1024px+) ===== */
@media (min-width: 1024px) {
  .container {
    max-width: 1200px;
  }
  
  /* Hero - larger on desktop */
  .hero-section {
    padding: 2.5rem 3rem;
  }
  
  .hero-image {
    width: 180px;
    height: 180px;
  }
  
  .hero-text h1 {
    font-size: 2rem;
  }
  
  .hero-text p {
    font-size: 1.05rem;
  }
  
  /* Feed */
  .feed-title h1 {
    font-size: 2.5rem;
  }
  
  /* Post Grid - 4 columns */
  .post-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.75rem;
  }
  
  .post-card-name {
    font-size: 1.15rem;
  }
  
  /* Upload - centered nicely */
  .upload-page {
    max-width: 650px;
  }
  
  /* Post Detail */
  .post-detail {
    max-width: 950px;
  }
  
  /* About */
  .about-page {
    max-width: 750px;
  }
}

/* ===== Large Desktop (1280px+) ===== */
@media (min-width: 1280px) {
  .container {
    max-width: 1280px;
    padding: 0 2.5rem;
  }
  
  .hero-section {
    padding: 3rem 4rem;
  }
  
  .hero-image {
    width: 200px;
    height: 200px;
  }
  
  .hero-text h1 {
    font-size: 2.25rem;
  }
  
  .post-grid {
    gap: 2rem;
  }
}

/* ===== Extra Large Desktop (1440px+) ===== */
@media (min-width: 1440px) {
  .container {
    max-width: 1400px;
  }
  
  .post-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ===== Touch Device Optimizations ===== */
@media (hover: none) and (pointer: coarse) {
  .post-card:hover {
    transform: none;
  }
  
  .post-card:hover .post-card-media img,
  .post-card:hover .post-card-media video {
    transform: none;
  }
  
  .snack-btn:hover {
    transform: none;
    box-shadow: none;
  }
  
  .snack-btn:active {
    transform: scale(0.95);
  }
  
  .btn:hover {
    transform: none;
  }
  
  .btn:active {
    transform: scale(0.97);
  }
  
  /* Larger touch targets */
  .feed-tab {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .snack-btn {
    min-height: 44px;
  }
  
  .mobile-nav-item {
    min-width: 44px;
    min-height: 44px;
  }
}

/* ===== Landscape Mobile ===== */
@media (max-height: 500px) and (orientation: landscape) {
  .main-content {
    padding-top: 60px;
    padding-bottom: 70px;
  }
  
  .navbar {
    height: 60px;
  }
  
  .mobile-nav {
    height: 60px;
  }
  
  .upload-dropzone {
    padding: 2rem 1rem;
  }
  
  .upload-dropzone-icon {
    font-size: 2rem;
  }
}

/* ===== High DPI Screens ===== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Sharper borders */
  .post-card,
  .upload-form,
  .form-input {
    border-width: 0.5px;
  }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  html {
    scroll-behavior: auto;
  }
}

/* ===== Dark Mode Support ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-light: #1a1a2e;
    --bg-card: #25253d;
    --text-primary: #f5f5f5;
    --text-secondary: #a0a0a0;
    --text-muted: #6a6a6a;
  }
  
  .form-input {
    background: #2d2d4a;
    border-color: #3d3d5c;
    color: var(--text-primary);
  }
  
  .form-input:focus {
    background: #35355a;
    border-color: var(--primary);
  }
  
  .upload-dropzone {
    border-color: #3d3d5c;
  }
  
  .upload-dropzone:hover,
  .upload-dropzone.dragover {
    background: rgba(255, 107, 107, 0.1);
  }
  
  .feed-tab {
    background: var(--bg-card);
  }
  
  .post-card {
    background: var(--bg-card);
  }
  
  .navbar,
  .mobile-nav {
    background: var(--bg-card);
  }
  
  .modal {
    background: var(--bg-card);
  }
  
  .btn-secondary {
    background: var(--bg-card);
    border-color: #3d3d5c;
  }
  
  .btn-secondary:hover {
    border-color: var(--primary);
  }
  
  .skeleton {
    background: linear-gradient(90deg, #2d2d4a 25%, #3d3d5c 50%, #2d2d4a 75%);
    background-size: 200% 100%;
  }
  
  .post-detail-meta,
  .about-section {
    border-color: #3d3d5c;
  }
}

/* ===== Print Styles ===== */
@media print {
  .navbar,
  .mobile-nav,
  .snack-btn,
  .btn-upload-nav,
  .feed-tabs {
    display: none !important;
  }
  
  .main-content {
    padding: 0;
  }
  
  .post-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* ===== Focus Visible for Accessibility ===== */
:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

/* ===== Safe Area for Notched Phones ===== */
@supports (padding: env(safe-area-inset-bottom)) {
  .mobile-nav {
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(70px + env(safe-area-inset-bottom));
  }
  
  .main-content {
    padding-bottom: calc(100px + env(safe-area-inset-bottom));
  }
  
  @media (min-width: 768px) {
    .main-content {
      padding-bottom: 2rem;
    }
  }
}
