/* Mobile Portfolio/Works Carousel - iOS-inspired Design */
/* ====================================================== */

@media screen and (max-width: 991px) {
  /* Hide desktop filter */
  .portfolio-filter {
    display: none !important;
  }

  /* Portfolio section adjustments */
  #works {
    padding: 60px 0 40px 0 !important;
    overflow: hidden;
  }

  /* Mobile filter as segmented control (iOS style) */
  .pf-filter-wrapper {
    margin-bottom: 30px;
    padding: 0 20px;
  }

  .portfolio-filter-mobile {
    width: 100%;
    background: rgba(255, 76, 96, 0.05);
    border: 2px solid rgba(255, 76, 96, 0.2);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 500;
    color: #454360;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ff4c60' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
    transition: all 0.3s ease;
  }

  .portfolio-filter-mobile:focus {
    outline: none;
    border-color: #ff4c60;
    box-shadow: 0 0 0 4px rgba(255, 76, 96, 0.1);
  }

  /* Convert portfolio wrapper to carousel */
  .portfolio-wrapper {
    display: flex !important;
    flex-direction: column;
    gap: 20px;
    margin: 0 -20px;
  }

  /* Individual content rows as carousels */
  #developmentContent,
  #videoContent,
  #photographyContent {
    display: flex !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    padding: 20px !important;
    gap: 20px !important;
    margin: 0 !important;
  }

  #developmentContent::-webkit-scrollbar,
  #videoContent::-webkit-scrollbar,
  #photographyContent::-webkit-scrollbar {
    display: none !important;
  }

  /* Large portfolio cards for mobile */
  .portfolio-wrapper .col-md-4,
  .portfolio-wrapper .col-sm-6,
  .portfolio-wrapper .grid-item {
    flex: 0 0 85% !important;
    max-width: 85% !important;
    scroll-snap-align: center !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* First and last card spacing */
  .portfolio-wrapper .grid-item:first-child {
    margin-left: calc((100% - 85%) / 2) !important;
  }

  .portfolio-wrapper .grid-item:last-child {
    margin-right: calc((100% - 85%) / 2) !important;
  }

  /* Enhanced card design for mobile */
  .work-content {
    display: block !important;
    height: 100% !important;
    text-decoration: none !important;
  }

  .ios-card {
    background: white;
    border-radius: 20px !important;
    overflow: hidden;
    box-shadow: 
      0 10px 30px rgba(0, 0, 0, 0.08),
      0 2px 10px rgba(0, 0, 0, 0.05) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border: 1px solid rgba(0, 0, 0, 0.05);
    height: 450px !important;
    display: flex;
    flex-direction: column;
  }

  /* Card image container */
  .ios-card .card-image {
    width: 100%;
    height: 250px;
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
  }

  .ios-card .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
  }

  /* Card content */
  .ios-card .card-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  .ios-card .card-category {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #ff4c60;
    letter-spacing: 1px;
    margin-bottom: 8px;
  }

  .ios-card .card-title {
    font-size: 18px;
    font-weight: 700;
    color: #454360;
    margin-bottom: 10px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .ios-card .card-description {
    font-size: 14px;
    color: #7c7c8a;
    line-height: 1.6;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
  }

  .ios-card .card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
  }

  .ios-card .card-date {
    font-size: 13px;
    color: #a8a8b8;
  }

  .ios-card .card-action {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
    color: #ff4c60;
  }

  .ios-card .card-action i {
    font-size: 12px;
    transition: transform 0.3s ease;
  }

  /* Active card state */
  .ios-card:active {
    transform: scale(0.98);
    box-shadow: 
      0 5px 20px rgba(0, 0, 0, 0.1),
      0 2px 8px rgba(0, 0, 0, 0.05) !important;
  }

  /* Dark mode support */
  [data-theme="dark"] .ios-card {
    background: linear-gradient(135deg, 
      rgba(22, 22, 31, 0.95) 0%, 
      rgba(30, 30, 41, 0.95) 100%);
    border-color: rgba(255, 76, 96, 0.1);
    box-shadow: 
      0 10px 30px rgba(0, 0, 0, 0.3),
      0 2px 10px rgba(255, 76, 96, 0.05) !important;
  }

  [data-theme="dark"] .ios-card .card-title {
    color: #ffffff;
  }

  [data-theme="dark"] .ios-card .card-description {
    color: #a8a8b8;
  }

  [data-theme="dark"] .ios-card .card-meta {
    border-top-color: rgba(255, 255, 255, 0.1);
  }

  [data-theme="dark"] .portfolio-filter-mobile {
    background: rgba(255, 76, 96, 0.1);
    border-color: rgba(255, 76, 96, 0.3);
    color: #ffffff;
  }

  /* Scroll indicators */
  .portfolio-scroll-indicator {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    padding-bottom: 10px;
  }

  .scroll-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 76, 96, 0.2);
    transition: all 0.3s ease;
    cursor: pointer;
  }

  .scroll-dot.active {
    width: 24px;
    border-radius: 4px;
    background: #ff4c60;
  }

  /* Category headers */
  .portfolio-category-header {
    padding: 0 20px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .category-title {
    font-size: 16px;
    font-weight: 600;
    color: #454360;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .category-title i {
    color: #ff4c60;
    font-size: 14px;
  }

  .category-count {
    font-size: 13px;
    color: #a8a8b8;
    background: rgba(255, 76, 96, 0.1);
    padding: 4px 10px;
    border-radius: 12px;
  }

  [data-theme="dark"] .category-title {
    color: #ffffff;
  }

  [data-theme="dark"] .category-count {
    background: rgba(255, 76, 96, 0.15);
    color: #ff7a8a;
  }

  /* View all link */
  .view-all-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    font-weight: 500;
    color: #ff4c60;
    text-decoration: none;
    margin: 20px auto;
    padding: 10px 20px;
    background: rgba(255, 76, 96, 0.1);
    border-radius: 20px;
    transition: all 0.3s ease;
  }

  .view-all-link:hover {
    background: rgba(255, 76, 96, 0.15);
    transform: translateX(5px);
  }

  .view-all-link i {
    transition: transform 0.3s ease;
  }

  .view-all-link:hover i {
    transform: translateX(3px);
  }

  /* Loading skeleton for cards */
  .ios-card.loading {
    position: relative;
    overflow: hidden;
  }

  .ios-card.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
      90deg,
      transparent,
      rgba(255, 255, 255, 0.2),
      transparent
    );
    animation: loading-skeleton 1.5s infinite;
  }

  @keyframes loading-skeleton {
    0% { left: -100%; }
    100% { left: 100%; }
  }

  /* Small mobile adjustments */
  @media screen and (max-width: 576px) {
    .portfolio-wrapper .col-md-4,
    .portfolio-wrapper .col-sm-6,
    .portfolio-wrapper .grid-item {
      flex: 0 0 90% !important;
      max-width: 90% !important;
    }

    .portfolio-wrapper .grid-item:first-child {
      margin-left: 5% !important;
    }

    .portfolio-wrapper .grid-item:last-child {
      margin-right: 5% !important;
    }

    .ios-card {
      height: 400px !important;
    }

    .ios-card .card-image {
      height: 220px;
    }

    .ios-card .card-title {
      font-size: 16px;
    }

    .ios-card .card-description {
      font-size: 13px;
      -webkit-line-clamp: 2;
    }
  }

  /* Landscape adjustments */
  @media screen and (max-width: 991px) and (orientation: landscape) {
    .portfolio-wrapper .col-md-4,
    .portfolio-wrapper .col-sm-6,
    .portfolio-wrapper .grid-item {
      flex: 0 0 60% !important;
      max-width: 60% !important;
    }

    .ios-card {
      height: 350px !important;
    }

    .ios-card .card-image {
      height: 180px;
    }
  }
}

/* Desktop - keep original layout */
@media screen and (min-width: 992px) {
  .portfolio-scroll-indicator,
  .portfolio-category-header,
  .view-all-link {
    display: none !important;
  }
}