/* Cases Page Specific Styles */

/* Import CSS Variables */
:root {
  --color-primary: #00476b;
  --color-primary-dark: #003350;
  --color-secondary: #3b82f6;
}

/* Case Card Clickable Styles */
[data-case-id] {
  cursor: pointer;
}

[data-case-id] .aspect-w-16 {
  cursor: pointer;
}

[data-case-id] img {
  cursor: pointer;
}

/* Banner Section Styles */
.banner-section {
  position: relative;
  height: 70vh;
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.banner-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 5;
}

.bg-primary-overlay {
    background-color: rgba(0, 71, 107, 0.15);
    /* Primary color with 15% opacity - very light version */
}

.banner-content {
  color: white;
  max-width: 800px;
  z-index: 25;
}

.banner-content h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  margin-bottom: 1.5rem;
  line-height: 1.2;
}

.banner-content p {
  font-size: clamp(1rem, 2vw, 1.25rem);
  margin-bottom: 2rem;
  line-height: 1.6;
  max-width: 600px;
}

.banner-content .btn {
  padding: 0.875rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.3s ease;
  display: inline-block;
  cursor: pointer;
}

.banner-content .btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.banner-content .btn-primary:hover {
  background-color: #003d70 !important;
}

.banner-content .btn-secondary:hover {
  background-color: #f8f9fa !important;
  color: #003d70 !important;
}

/* Banner Section */
#cases-banner {
    position: relative;
    overflow: hidden;
}

#cases-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('../images/banner/banner2.jpg') center/cover no-repeat;
    opacity: 0.2;
    z-index: 0;
}

#cases-banner .container {
    position: relative;
    z-index: 1;
}

/* Search and Filter Section */
#cases-content .bg-gray-50 {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
}

/* Flexible Search and Filter Container */
#cases-content .search-filter-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Cases Content Header */
#cases-content .header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Search Section */
.search-section {
    position: relative;
    width: 100%;
}

#cases-search {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#cases-search:focus {
    outline: none;
    border-color: var(--primary-color, #0066cc);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* Search Icon */
.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    transition: color 0.3s ease;
    pointer-events: none;
}

#cases-search:focus ~ .search-icon {
    color: var(--primary-color, #0066cc);
}

/* Filter Controls */
.filter-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

/* Dropdown Styles */
.dropdown-container {
    position: relative;
    flex: 1;
    min-width: 160px;
}

#cases-sort, #cases-per-page {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    background-color: white;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#cases-sort:focus, #cases-per-page:focus {
    outline: none;
    border-color: var(--primary-color, #0066cc);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* Dropdown Icon */
.dropdown-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}

/* Publish Date Styles */
.publish-date {
    display: flex;
    align-items: center;
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    margin-top: 0.25rem;
}

.publish-date i {
    margin-right: 0.25rem;
    font-size: 0.75rem;
}

.publish-date .date-text {
    font-weight: 500;
}

/* View Toggle Buttons */
.view-toggle {
    display: flex;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    min-width: 100px;
}

.view-toggle button {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background-color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.view-toggle button:first-child {
    border-right: 1px solid #e5e7eb;
}

.view-toggle button.active {
    background-color: var(--primary-color, #0066cc);
    color: white;
}

.view-toggle button:hover:not(.active) {
    background-color: #f9fafb;
}

/* Tablet and Desktop Layout */
@media (min-width: 769px) {
    #cases-content .header {
        flex-direction: row;
        align-items: center;
    }
    
    .search-section {
        flex: 1;
        min-width: 250px;
    }
    
    .filter-controls {
        flex: 1;
        justify-content: flex-end;
    }
}

/* Medium Screen Adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .filter-controls {
        flex-wrap: wrap;
        justify-content: space-between;
    }
    
    .dropdown-container {
        min-width: calc(50% - 0.5rem);
    }
    
    .view-toggle {
        min-width: 100%;
        margin-top: 0.5rem;
    }
    
    /* 修正搜索图标位置 - 直接针对HTML中的<i>标签 */
    .w-full.md\:w-2\/5.relative i {
        position: absolute !important;
        left: 1.25rem !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        z-index: 10 !important;
    }
    
    /* 确保搜索框有足够的左侧内边距容纳图标 */
    #cases-search {
        padding-left: 3.5rem !important;
    }
}

/* Small Screen Adjustments */
@media (max-width: 768px) {
    #cases-content .bg-gray-50 {
        padding: 1.25rem;
    }
    
    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .dropdown-container {
        width: 100%;
    }
    
    .view-toggle {
        width: 100%;
    }
}

/* Extra Small Screen Adjustments */
@media (max-width: 480px) {
    #cases-content .bg-gray-50 {
        padding: 1rem;
    }
    
    #cases-search, #cases-sort, #cases-per-page {
        padding: 0.875rem;
        font-size: 0.95rem;
    }
    
    .search-icon {
        left: 0.875rem;
    }
    
    .dropdown-icon {
        right: 0.875rem;
    }
    
    .view-toggle button {
        padding: 0.875rem;
        font-size: 1rem;
    }
}

/* Category Tabs */
#cases-content .case-tab {
    transition: all 0.3s ease;
    white-space: nowrap;
    border: 2px solid transparent;
}

#cases-content .case-tab:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

#cases-content .case-tab.active {
    border-color: var(--primary-color, #0066cc);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

/* Case Cards Grid View */
.case-card {
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
}

.case-card .group {
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background-color: white;
}

.case-card .group:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.case-card .aspect-w-16 {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    overflow: hidden;
}

.case-card .aspect-w-16 img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.case-card .group:hover .aspect-w-16 img {
    transform: scale(1.05);
}

/* Cases Grid */
.cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    transition: all 0.4s ease;
}

/* Card Layout Fix - Ensure bottom elements stay fixed */
.cases-grid .bg-white.rounded-xl {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.cases-grid .bg-white.rounded-xl .p-6 {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.cases-grid .bg-white.rounded-xl .flex.items-center.justify-between {
    margin-top: auto;
    padding-top: 1rem;
}

/* Cases List View */
.cases-grid.cases-list {
    grid-template-columns: 1fr;
}

.cases-grid.cases-list .case-card .group {
    flex-direction: row;
    height: auto;
    padding: 1rem;
}

.cases-grid.cases-list .case-card .aspect-w-16 {
    width: 250px;
    height: 150px;
    padding-bottom: 0;
    margin-right: 1.5rem;
    flex-shrink: 0;
}

.cases-grid.cases-list .case-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.cases-grid.cases-list .case-card h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.cases-grid.cases-list .case-card .text-text-tertiary {
    margin-top: auto;
    margin-bottom: 0;
}

/* Animation for filter transitions */
.filter-animation {
    opacity: 0.8;
    transform: scale(0.98);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.filter-animation:hover {
    opacity: 1;
    transform: scale(1);
}

/* Empty State */
.case-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
    background-color: #f9fafb;
    border-radius: 8px;
    margin: 2rem 0;
}

.case-empty i {
    font-size: 3rem;
    color: #9ca3af;
    margin-bottom: 1rem;
}

.case-empty h3 {
    margin-bottom: 0.5rem;
    color: #374151;
}

.case-empty p {
    color: #6b7280;
    max-width: 400px;
    margin-bottom: 1.5rem;
}

/* Responsive Adjustments for List View */
@media (max-width: 768px) {
    .cases-grid.cases-list .case-card .group {
        flex-direction: column;
    }
    
    .cases-grid.cases-list .case-card .aspect-w-16 {
        width: 100%;
        height: 200px;
        margin-right: 0;
        margin-bottom: 1rem;
    }
    
    .cases-grid {
        grid-template-columns: 1fr;
    }
}

/* Case Categories */
.case-category {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* List View Styles */
.cases-list {
    grid-template-columns: 1fr !important;
}

.cases-list .bg-white.rounded-xl {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    height: 200px;
}

.cases-list .aspect-w-16 {
    width: 300px;
    height: 100%;
    padding-bottom: 0 !important;
    flex-shrink: 0;
}

.cases-list .aspect-w-16 img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cases-list .p-6 {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.5rem;
}

/* 发布时间样式 */
.publish-date {
    display: flex;
    align-items: center;
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.publish-date i {
    margin-right: 0.5rem;
    color: #9ca3af;
}

.publish-date .date-text {
    font-weight: 400;
}

/* 列表视图中的发布时间样式 */
.cases-list .publish-date {
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
}

.cases-list .publish-date i {
    font-size: 0.9rem;
}

/* 网格视图中的发布时间样式 */
.cases-grid:not(.cases-list) .publish-date {
    margin-top: 0.25rem;
}

.cases-list .p-6 h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.cases-list .publish-date {
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
}

.cases-list .publish-date i {
    font-size: 0.9rem;
}

.cases-list .flex.items-center.justify-between {
    margin-top: auto;
}

/* List view hover effects */
.cases-list .bg-white.rounded-xl:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

/* Featured Case Section */
#featured-case .hover-lift {
    transition: transform 0.5s ease;
}

#featured-case .hover-lift:hover {
    transform: translateY(-5px);
}

/* Pagination */
#cases-content nav a {
    transition: all 0.3s ease;
}

#cases-content nav a:hover:not(.bg-primary) {
    transform: translateY(-1px);
}

/* Loading Animation */
.case-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 300px;
}

.case-loading::after {
    content: '';
    width: 50px;
    height: 50px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color, #0066cc);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Pagination styling */
.cases-pagination {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.pagination-btn {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e5e7eb;
    background: white;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.pagination-btn:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #9ca3af;
    transform: translateY(-1px);
}

.pagination-btn.bg-primary {
    background: var(--color-primary, #00476b);
    color: white;
    border-color: var(--color-primary, #00476b);
}

.pagination-btn.bg-primary:hover {
    background: var(--color-primary-dark, #003350);
    border-color: var(--color-primary-dark, #003350);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.pagination-btn:disabled:hover {
    background: white;
    border-color: #e5e7eb;
}

.pagination-numbers {
    gap: 0.25rem;
}

.pagination-numbers .pagination-btn {
    min-width: 36px;
    height: 36px;
    font-size: 13px;
}

/* Empty State */
.case-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary, #666);
}

.case-empty i {
    font-size: 4rem;
    margin-bottom: 16px;
    color: var(--text-tertiary, #999);
}

.case-empty h3 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: var(--text-primary, #333);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .cases-list .bg-white.rounded-xl {
        flex-direction: column;
        height: auto;
    }
    
    .cases-list .aspect-w-16 {
        width: 100%;
        height: 200px;
    }
    
    .cases-list .p-6 {
        width: 100%;
    }
}

@media (max-width: 768px) {
    #cases-content .case-tab {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    #cases-content .case-tab.active {
        padding: 0.75rem 1rem;
    }
    
    #cases-content .grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    #featured-case .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    #featured-case .order-2,
    #featured-case .order-1 {
        order: initial;
    }
    
    .sort-dropdown select {
        padding: 6px 24px 6px 8px;
        font-size: 13px;
    }
    
    .results-counter {
        font-size: 13px;
    }
    
    .publish-date {
        top: 8px;
        right: 8px;
        font-size: 11px;
        padding: 3px 6px;
    }
    
    .pagination-btn {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
    }
    
    .pagination-numbers .pagination-btn {
        min-width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .cases-pagination {
        gap: 0.5rem;
    }
}

@media (max-width: 640px) {
    #cases-content .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    #cases-banner {
        padding-top: 12rem;
        padding-bottom: 12rem;
    }
    
    #cases-banner h1 {
        font-size: 1.75rem;
    }
}

/* Fade in animation for pagination */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.4s ease-out;
}

/* Custom Scrollbar for Category Tabs */
#cases-content .overflow-x-auto {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color, #0066cc) transparent;
}

#cases-content .overflow-x-auto::-webkit-scrollbar {
    height: 6px;
}

#cases-content .overflow-x-auto::-webkit-scrollbar-track {
    background: transparent;
}

#cases-content .overflow-x-auto::-webkit-scrollbar-thumb {
    background-color: var(--primary-color, #0066cc);
    border-radius: 3px;
}

/* View Toggle Buttons */
#view-grid, #view-list {
    transition: all 0.2s ease;
}

#view-grid:hover:not(.bg-primary),
#view-list:hover:not(.bg-primary) {
    background-color: var(--gray-100, #f3f4f6);
}

/* Animation for filtering */
.filter-animation {
    animation: filterIn 0.4s ease-out;
}

@keyframes filterIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Sort dropdown specific styles */
#cases-sort {
    min-width: 160px;
}

/* Loading state for case cards */
.case-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    text-align: center;
}

/* Highlight animation for active category text */
#active-category-text .text-primary {
    animation: highlight 1s ease-out;
}

@keyframes highlight {
    0% {
        background-color: rgba(0, 102, 204, 0.2);
        padding: 0.25rem 0.5rem;
        border-radius: 4px;
    }
    100% {
        background-color: transparent;
        padding: 0;
    }
}