/* ============================================
   ILORIN CARS - Responsive Styles
   ============================================ */

/* Tablet: 768px - 1024px */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 280px;
  }

  .hero-content {
    max-width: 550px;
  }
  .about-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .about-image img {
    height: 400px;
  }
  .ceo-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .ceo-image img {
    height: 400px;
  }
  .ceo-quote {
    right: 10px;
    bottom: 10px;
  }
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .product-detail-grid {
    grid-template-columns: 1fr;
  }
  .product-detail-gallery {
    grid-template-columns: 80px 1fr;
  }
  .product-main-image {
    height: 400px;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .gallery-item:nth-child(1),
  .gallery-item:nth-child(5) {
    grid-column: span 2;
    grid-row: span 1;
    min-height: 300px;
  }
  .gallery-item:nth-child(2),
  .gallery-item:nth-child(4) {
    grid-column: span 1;
  }
}

/* Mobile: < 768px */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 100%;
    --header-height: 70px;
  }

  .section {
    padding: 60px 0;
  }
  .container {
    padding: 0 16px;
  }

  /* Login */
  .login-card {
    padding: 32px 20px;
  }
  .login-title {
    font-size: 1.5rem;
  }
  .form-row {
    grid-template-columns: 1fr;
  }

  /* Header */
  .header-logo {
    height: 40px;
  }

  /* Sidebar */
  .sidebar {
    padding: 100px 0 30px;
  }
  .sidebar-nav {
    padding: 0 20px;
  }

  /* Hero */
  .hero {
    min-height: 600px;
  }
  .hero-content {
    max-width: 100%;
  }
  .hero-title {
    font-size: clamp(2.2rem, 8vw, 3.5rem);
  }
  .hero-desc {
    font-size: 1rem;
  }
  .hero-buttons {
    flex-direction: column;
  }

  /* About */
  .about-image img {
    height: 300px;
  }
  .about-stats {
    grid-template-columns: 1fr 1fr;
  }
  .about-stat-number {
    font-size: 2rem;
  }

  /* Values */
  .values-grid {
    grid-template-columns: 1fr;
  }

  /* CEO */
  .ceo-image img {
    height: 350px;
  }
  .ceo-quote {
    position: relative;
    right: 0;
    bottom: 0;
    max-width: 100%;
    margin-top: 16px;
  }
  .ceo-achievements {
    flex-wrap: wrap;
    gap: 20px;
  }

  /* Services */
  .services-grid {
    grid-template-columns: 1fr;
  }

  /* Marketplace */
  .marketplace-header {
    flex-direction: column;
    align-items: stretch;
  }
  .category-tabs {
    overflow-x: auto;
    padding-bottom: 8px;
    flex-wrap: nowrap;
  }
  .category-tab {
    white-space: nowrap;
    font-size: 0.8rem;
    padding: 8px 16px;
  }
  .search-bar {
    max-width: 100%;
  }
  .filter-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 8px;
  }
  .filter-select {
    white-space: nowrap;
  }
  .products-grid {
    grid-template-columns: 1fr;
  }

  /* Product Detail */
  .product-detail-gallery {
    grid-template-columns: 1fr;
  }
  .product-thumbnails {
    flex-direction: row;
    overflow-x: auto;
    max-height: none;
  }
  .product-thumbnail {
    width: 70px;
    height: 50px;
    flex-shrink: 0;
  }
  .product-main-image {
    height: 300px;
  }
  .product-info h1 {
    font-size: 1.8rem;
  }

  /* Testimonials */
  .testimonial-inner {
    padding: 24px;
  }

  /* FAQ */
  .faq-question {
    font-size: 0.95rem;
    padding: 16px 20px;
  }

  /* Gallery */
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .gallery-item,
  .gallery-item:nth-child(1),
  .gallery-item:nth-child(2),
  .gallery-item:nth-child(4),
  .gallery-item:nth-child(5) {
    grid-column: span 1;
    grid-row: span 1;
    min-height: 180px;
  }

  /* Contact */
  .contact-grid {
    grid-template-columns: 1fr;
  }
  .contact-form-wrapper {
    padding: 24px;
  }
  .contact-map {
    height: 300px;
  }

  /* Footer */
  .footer {
    padding: 50px 0 0;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  .footer-bottom {
    margin-top: 40px;
  }

  /* Floating elements */
  .floating-whatsapp {
    bottom: 80px;
    right: 16px;
  }
  .scroll-to-top {
    bottom: 20px;
    right: 16px;
  }

  /* Toast */
  .toast {
    min-width: auto;
    max-width: calc(100vw - 32px);
  }
}

/* Compact phones: keep everything polished below the problem width */
@media (max-width: 602px) {
  html,
  body {
    overflow-x: hidden;
  }

  .container {
    padding: 0 14px;
  }

  .section {
    padding: 48px 0;
  }

  .section-header {
    margin-bottom: 34px;
  }

  .section-header .section-subtitle {
    font-size: 0.72rem;
    letter-spacing: 2px;
  }

  .section-header .section-title {
    font-size: 1.9rem;
    line-height: 1.16;
  }

  .section-header .section-desc {
    font-size: 0.95rem;
  }

  .header-inner {
    height: var(--header-height);
    padding: 0 14px;
  }

  .hero {
    min-height: 560px;
    height: auto;
    padding: 120px 0 72px;
  }

  .hero-content {
    padding-right: 0;
  }

  .hero-tag {
    padding: 7px 14px;
    font-size: 0.72rem;
  }

  .hero-title {
    font-size: 2.25rem;
    line-height: 1.08;
    margin-bottom: 18px;
  }

  .hero-desc {
    max-width: 32rem;
    margin-bottom: 26px;
    line-height: 1.65;
  }

  .hero-buttons {
    gap: 10px;
  }

  .hero-buttons .btn {
    width: 100%;
    min-height: 48px;
    justify-content: center;
  }

  .about-grid,
  .ceo-grid,
  .contact-grid {
    gap: 28px;
  }

  .about-image img,
  .ceo-image img {
    height: auto;
    aspect-ratio: 4 / 3;
  }

  .about-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .about-stat {
    padding: 18px 10px;
  }

  .about-stat-number {
    font-size: 1.65rem;
  }

  .value-card,
  .service-card,
  .testimonial-inner,
  .contact-info-item,
  .contact-form-wrapper {
    padding: 22px 18px;
    border-radius: var(--radius-md);
  }

  .ceo-name {
    font-size: 2rem;
  }

  .ceo-message,
  .testimonial-text {
    font-size: 0.95rem;
    line-height: 1.7;
  }

  .ceo-achievements {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .ceo-achievement .number {
    font-size: 1.5rem;
  }

  .marketplace-header {
    gap: 14px;
  }

  .category-tabs,
  .filter-bar {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 10px;
    scrollbar-width: none;
  }

  .category-tabs::-webkit-scrollbar,
  .filter-bar::-webkit-scrollbar {
    display: none;
  }

  .category-tab,
  .filter-select {
    font-size: 0.78rem;
    min-height: 40px;
  }

  .filter-select {
    max-width: 210px;
  }

  .search-bar {
    min-height: 48px;
  }

  .search-bar input {
    min-width: 0;
    padding: 12px 14px;
  }

  .search-bar button {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
  }

  .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }

  .product-card-image {
    height: auto;
    aspect-ratio: 4 / 3;
  }

  .product-card-body {
    padding: 12px;
  }

  .product-card-category {
    font-size: 0.65rem;
    line-height: 1.2;
  }

  .product-card-name {
    font-size: 0.9rem;
    margin-bottom: 10px;
  }

  .product-card-specs {
    grid-template-columns: 1fr;
    gap: 6px;
    margin-bottom: 10px;
  }

  .product-card-spec {
    font-size: 0.72rem;
  }

  .product-card-spec svg {
    width: 12px;
    height: 12px;
  }

  .product-card-footer {
    align-items: flex-start;
    gap: 8px;
    flex-direction: column;
    padding: 12px;
  }

  .product-card-price {
    font-size: 0.95rem;
  }

  .product-card-footer .btn {
    width: 100%;
    min-height: 36px;
    padding: 8px 10px;
    font-size: 0.75rem;
    justify-content: center;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .gallery-item,
  .gallery-item:nth-child(1),
  .gallery-item:nth-child(2),
  .gallery-item:nth-child(4),
  .gallery-item:nth-child(5) {
    min-height: auto;
    aspect-ratio: 1 / 1;
  }

  .gallery-item:nth-child(3),
  .gallery-item:nth-child(6) {
    aspect-ratio: 4 / 5;
  }

  .faq-question {
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    line-height: 1.45;
  }

  .faq-answer,
  .faq-item.open .faq-answer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .contact-info-item {
    gap: 12px;
  }

  .contact-info-text {
    min-width: 0;
  }

  .contact-info-text p {
    overflow-wrap: anywhere;
  }

  .footer-grid {
    gap: 24px;
  }
}

/* Small Mobile: < 480px */
@media (max-width: 480px) {
  .hero-title {
    font-size: 2.05rem;
  }
  .hero-scroll-indicator {
    display: none;
  }
  .about-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .product-card-image {
    height: auto;
  }
  .section-header .section-title {
    font-size: 1.75rem;
  }
  .login-logo {
    width: 70px;
  }
}

@media (max-width: 380px) {
  .container {
    padding: 0 12px;
  }

  .hero-title {
    font-size: 1.85rem;
  }

  .hero-desc,
  .section-header .section-desc {
    font-size: 0.9rem;
  }

  .about-stats,
  .ceo-achievements {
    grid-template-columns: 1fr;
  }

  .gallery-grid {
    gap: 8px;
  }

  .products-grid {
    gap: 10px;
  }

  .product-card-body,
  .product-card-footer {
    padding: 10px;
  }

  .product-card-name {
    font-size: 0.82rem;
  }

  .product-card-spec {
    font-size: 0.68rem;
  }

  .product-card-price {
    font-size: 0.85rem;
  }

  .product-card-footer .btn {
    font-size: 0.7rem;
    padding: 7px 8px;
  }
}


/* Admin Dashboard Responsive */
@media (max-width: 1024px) {
  .admin-sidebar {
    transform: translateX(-100%);
    position: fixed;
    z-index: 3000;
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }
  .admin-sidebar-close {
    display: flex;
  }
  .admin-main {
    margin-left: 0;
  }
  .admin-header .hamburger-admin {
    display: flex;
  }
  .admin-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .admin-main {
    padding: 16px;
  }

  .admin-header {
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 20px;
    padding-bottom: 14px;
  }

  .admin-header-left {
    min-width: 0;
  }

  .admin-header-left h1 {
    font-size: 1.25rem;
  }

  .admin-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .admin-stat-card {
    padding: 16px;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .admin-stat-icon {
    width: 40px;
    height: 40px;
  }

  .admin-stat-value {
    font-size: 1.35rem;
  }

  .admin-stat-label {
    font-size: 0.75rem;
  }

  .admin-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
  }

  .admin-table {
    min-width: 680px;
  }

  .admin-table th,
  .admin-table td {
    padding: 12px 14px;
    font-size: 0.82rem;
  }

  .admin-form-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .admin-modal-overlay {
    align-items: flex-start;
    padding: 16px;
    overflow-y: auto;
  }

  .admin-modal {
    width: 100%;
    max-width: none;
    max-height: none;
    padding: 20px;
    margin: 24px 0;
  }

  .admin-modal-header {
    margin-bottom: 18px;
    padding-bottom: 12px;
  }

  .admin-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 420px) {
  .admin-main {
    padding: 12px;
  }

  .admin-stats-grid {
    grid-template-columns: 1fr;
  }

  .admin-header-right {
    gap: 10px;
  }

  .admin-avatar {
    width: 34px;
    height: 34px;
  }
}

/* Admin phones: fix clipping and overlap below the problem width */
@media (max-width: 604px) {
  .admin-layout {
    display: block;
    width: 100%;
    overflow-x: hidden;
  }

  .admin-sidebar {
    width: min(300px, 88vw);
    max-width: 88vw;
  }

  .admin-main {
    width: 100%;
    max-width: 100vw;
    margin-left: 0;
    padding: 12px;
    overflow-x: hidden;
  }

  #adminContent {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .admin-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    margin-bottom: 18px;
  }

  .admin-header-left {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    column-gap: 10px;
    row-gap: 2px;
    align-items: center;
    min-width: 0;
    flex: 1 1 auto;
  }

  .admin-header-left .hamburger-admin {
    grid-row: 1 / span 2;
    grid-column: 1;
    width: 34px;
    height: 34px;
  }

  .admin-header-left h1 {
    grid-column: 2;
    min-width: 0;
    font-size: 1.15rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }

  .admin-header-left p {
    grid-column: 2;
    min-width: 0;
    font-size: 0.76rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  .admin-header-right {
    flex: 0 0 auto;
    gap: 8px;
  }

  .admin-header-right .theme-toggle {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
  }

  .admin-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    font-size: 0.9rem;
  }

  .admin-stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
  }

  .admin-stat-card {
    width: 100%;
    min-width: 0;
    padding: 14px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
  }

  .admin-stat-icon {
    width: 42px;
    height: 42px;
  }

  .admin-stat-value {
    font-size: 1.35rem;
    line-height: 1.1;
  }

  .admin-stat-label {
    font-size: 0.78rem;
    line-height: 1.3;
  }

  .admin-table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .admin-table {
    min-width: 720px;
    width: max-content;
  }

  .admin-table th,
  .admin-table td {
    padding: 10px 12px;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  .admin-table td:nth-child(2),
  .admin-table td:nth-child(3),
  .admin-table td:nth-child(4) {
    white-space: normal;
    min-width: 120px;
    max-width: 180px;
  }

  .admin-table img {
    max-width: 52px;
  }

  .btn-icon {
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    font-size: 0.75rem;
  }

  .admin-modal-overlay {
    padding: 10px;
  }

  .admin-modal {
    width: 100%;
    margin: 12px 0;
    padding: 16px;
    border-radius: var(--radius-md);
  }
}
