/* Service Archive Styles - Enhanced Version */
.service-archive-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    background: #fff;
}

.service-archive-header {
    text-align: center;
    margin-bottom: 50px;
}

.service-archive-header .archive-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
}

.service-archive-header .archive-description {
    font-size: 1.1rem;
    color: #7f8c8d;
    margin: 0;
    line-height: 1.6;
}

/* Grid Layout */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

/* Service Card */
.service-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    container-type: inline-size;
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.service-card:focus-within {
    outline: 2px solid #667eea;
    outline-offset: 4px;
}

/* Service Image */
.service-image {
    position: relative;
    height: 220px;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.service-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.service-card:hover .service-image img {
    transform: scale(1.05);
}

/* Price Badge */
.service-price-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.95);
    color: #2c3e50;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 1.2rem;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 2;
    backdrop-filter: blur(10px);
}

.service-price-badge span {
    font-size: 0.9rem;
    font-weight: 400;
    color: #7f8c8d;
}

/* Service Content */
.service-content {
    padding: 25px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.service-title {
    margin: 0 0 12px 0;
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.3;
}

.service-title a {
    color: #2c3e50;
    text-decoration: none;
    transition: color 0.3s ease;
}

.service-title a:hover,
.service-title a:focus {
    color: #667eea;
}

.service-title a:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
    border-radius: 2px;
}

.service-description {
    color: #7f8c8d;
    line-height: 1.6;
    margin: 0 0 20px 0;
    flex: 1;
    font-size: 0.95rem;
}

/* Service Meta */
.service-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding-top: 15px;
    border-top: 1px solid #ecf0f1;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #7f8c8d;
    font-size: 0.85rem;
}

.meta-item::before {
    content: "•";
    color: #667eea;
    font-weight: bold;
    display: none; /* Hidden by default, show only if no SVG */
}

.meta-item svg {
    color: #667eea;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.meta-item:has(svg)::before {
    display: none; /* Hide fallback when SVG is present */
}

/* Service Actions */
.service-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

/* More specific button styles to avoid theme conflicts */
.service-actions .btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    box-sizing: border-box;
    min-height: 44px; /* Better touch targets */
    line-height: 1.2;
}

.service-actions .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: 1px solid transparent;
}

.service-actions .btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #63408a 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.service-actions .btn-primary:focus {
    outline: 3px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
    border-color: #fff;
}

.service-actions .btn-secondary {
    background: #fff;
    color: #667eea;
    border: 2px solid #667eea;
}

.service-actions .btn-secondary:hover {
    background: #f8f9fa;
    border-color: #5568d3;
    color: #5568d3;
    transform: translateY(-2px);
}

.service-actions .btn-secondary:focus {
    outline: 3px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

/* No Services */
.no-services {
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 12px;
    grid-column: 1 / -1;
}

.no-services h2 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.8rem;
}

.no-services p {
    color: #7f8c8d;
    font-size: 1.1rem;
    margin: 0;
}

/* Pagination */
.service-pagination {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

.service-pagination .nav-links {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.service-pagination a,
.service-pagination span {
    padding: 10px 18px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #2c3e50;
    text-decoration: none;
    transition: all 0.3s ease;
    min-width: 44px;
    text-align: center;
    display: inline-block;
    min-height: 44px;
    line-height: 1.4;
}

.service-pagination a:hover {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
    transform: translateY(-1px);
}

.service-pagination a:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.service-pagination .current {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

/* Loading State */
.service-card.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.service-card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

/* Animation Keyframes */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Smooth scrolling for better UX */
html {
    scroll-behavior: smooth;
}

/* Container Queries for modern browsers */
@container (min-width: 400px) {
    .service-meta {
        flex-direction: row;
    }
}

@container (max-width: 399px) {
    .service-meta {
        flex-direction: column;
        gap: 8px;
    }
    
    .service-actions {
        flex-direction: column;
    }
}

/* Print Styles */
@media print {
    .service-archive-container {
        max-width: 100%;
        padding: 20px 0;
        background: #fff !important;
    }
    
    .service-card {
        page-break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        margin-bottom: 20px;
        background: #fff !important;
    }
    
    .service-actions,
    .service-pagination {
        display: none;
    }
    
    .service-price-badge {
        background: #fff !important;
        color: #000 !important;
        border: 1px solid #000;
        box-shadow: none !important;
    }
    
    /* Ensure good contrast for printing */
    .service-title a {
        color: #000 !important;
        text-decoration: underline;
    }
    
    .service-description {
        color: #333 !important;
    }
    
    /* Hide decorative elements */
    .service-image {
        height: 150px; /* Smaller for printing */
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .services-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }
    
    .service-archive-header .archive-title {
        font-size: 2rem;
    }
    
    .service-archive-header .archive-description {
        font-size: 1rem;
    }
    
    .service-content {
        padding: 20px;
    }
    
    .service-meta {
        flex-direction: column;
        gap: 10px;
    }
    
    .service-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .services-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .service-archive-container {
        padding: 20px 15px;
    }
    
    .service-archive-header {
        margin-bottom: 30px;
    }
    
    .service-archive-header .archive-title {
        font-size: 1.75rem;
    }
    
    .service-price-badge {
        font-size: 1rem;
        padding: 6px 12px;
    }
    
    .service-image {
        height: 180px;
    }
    
    .service-pagination .nav-links {
        gap: 5px;
    }
    
    .service-pagination a,
    .service-pagination span {
        padding: 8px 12px;
        min-width: 40px;
        min-height: 40px;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .service-card {
        border: 2px solid #000;
    }
    
    .service-actions .btn-primary {
        border: 2px solid #000;
    }
    
    .service-actions .btn-secondary {
        border: 2px solid #667eea;
    }
    
    .service-meta {
        border-top-width: 2px;
    }
    
    .service-price-badge {
        border: 1px solid #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .service-card,
    .service-image img,
    .service-actions .btn,
    .service-pagination a {
        transition: none;
    }
    
    .service-card:hover {
        transform: none;
    }
    
    .service-card:hover .service-image img {
        transform: none;
    }
    
    .service-actions .btn:hover,
    .service-pagination a:hover {
        transform: none;
    }
    
    html {
        scroll-behavior: auto;
    }
    
    .service-card.loading::after {
        animation: none;
        content: 'Loading...';
        border: none;
        width: auto;
        height: auto;
        background: transparent;
        color: #667eea;
        font-weight: 600;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .service-archive-container {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }
    
    .service-card {
        background: #2d2d2d;
        border: 1px solid #444;
    }
    
    .service-title a {
        color: #e0e0e0;
    }
    
    .service-title a:hover {
        color: #8b9dff;
    }
    
    .service-description {
        color: #cccccc;
    }
    
    .service-price-badge {
        background: rgba(45, 45, 45, 0.95);
        color: #e0e0e0;
        border: 1px solid #666;
    }
    
    .service-price-badge span {
        color: #b0b0b0;
    }
    
    .service-meta {
        border-top-color: #444;
    }
    
    .meta-item {
        color: #b0b0b0;
    }
    
    .meta-item::before {
        color: #8b9dff;
    }
    
    .meta-item svg {
        color: #8b9dff;
    }
    
    .service-actions .btn-primary {
        background: linear-gradient(135deg, #8b9dff 0%, #a68dcc 100%);
    }
    
    .service-actions .btn-primary:hover {
        background: linear-gradient(135deg, #7a8eff 0%, #957bb8 100%);
    }
    
    .service-actions .btn-secondary {
        background: #2d2d2d;
        border-color: #8b9dff;
        color: #8b9dff;
    }
    
    .service-actions .btn-secondary:hover {
        background: #3d3d3d;
        border-color: #7a8eff;
        color: #7a8eff;
    }
    
    .no-services {
        background: #2d2d2d;
        color: #e0e0e0;
    }
    
    .no-services h2 {
        color: #e0e0e0;
    }
    
    .no-services p {
        color: #b0b0b0;
    }
    
    .service-pagination a,
    .service-pagination span {
        background: #2d2d2d;
        border-color: #444;
        color: #e0e0e0;
    }
    
    .service-pagination a:hover {
        background: #8b9dff;
        color: #1a1a1a;
    }
    
    .service-pagination .current {
        background: #8b9dff;
        color: #1a1a1a;
        border-color: #8b9dff;
    }
}

/* Focus visible polyfill support */
.service-actions .btn:focus:not(:focus-visible) {
    outline: none;
}

.service-actions .btn:focus-visible {
    outline: 3px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

/* Selection styles */
.service-card ::selection {
    background: rgba(102, 126, 234, 0.3);
}

.service-card ::-moz-selection {
    background: rgba(102, 126, 234, 0.3);
}

/* Performance optimizations */
.services-grid {
    will-change: transform;
}

.service-image {
    transform: translateZ(0);
}