

.launches-page {
    padding: 120px 0 80px;
}

.page-header {
    text-align: center;
    margin-bottom: 60px;
}

.page-header h1 {
    font-size: 2.5rem;
    color: var(--text-color);
    margin-bottom: 16px;
}

.page-header p {
    color: var(--gray-500);
    font-size: 1.1rem;
}

.launches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: var(--space-7);
}

.launch-card {
    background: var(--card-background);
    border-radius: var(--radius-card);
    overflow: hidden;
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.launch-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px var(--shadow-color);
    z-index: 10; /* Ensure hovered card appears above others */
    position: relative; /* Required for z-index to work */
}

.news-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px var(--shadow-color);
    z-index: 10; /* Ensure hovered card appears above others */
    position: relative; /* Required for z-index to work */
}

.launch-image-container {
    position: relative;
    height: 200px; /* Adjust based on your card design; ensures consistent height */
    width: 100%;
    overflow: hidden;
    background-color: #333; /* Dark background for better emoji visibility */
  }
  .no-image {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    font-size: 5em; /* Large emoji */
    opacity: 0.6; /* Slightly faded for subtlety */
    color: #fff; /* White for contrast on dark bg */
  }

.launch-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 1;
}

.launch-card:hover .launch-image {
    transform: scale(1.05);
}

.news-card:hover .news-image {
    transform: scale(1.05);
}

.launch-image-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        var(--border-color) 0%,
        var(--background-color) 50%,
        var(--border-color) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    opacity: 0;
}

.launch-image.loading,
.launch-image.error,
.launch-image:not([src]),
.launch-image[src=""] {
    opacity: 0;
}

.launch-image.loading + .launch-image-loading,
.launch-image.error + .launch-image-loading,
.launch-image:not([src]) + .launch-image-loading,
.launch-image[src=""] + .launch-image-loading {
    opacity: 1;
}

/* Error state shows a rocket icon */
.launch-image.error + .launch-image-loading::before {
    content: "🚀";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    animation: none;
    background: none;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.launch-content {
    padding: var(--space-5);
    background-color: var(--card-background);
    display: flex;
    flex-direction: column;
    flex: 1;
    position: relative;
}

/* Add style for the new launch-info container */
.launch-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    margin-bottom: var(--space-5); /* Add space between content and buttons */
}

.launch-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--space-3);
    color: var(--text-color);
}

.launch-provider {
    color: var(--primary-color);
    font-weight: 500;
    margin-bottom: var(--space-3);
}

.launch-details {
    margin-top: var(--space-4);
}

.launch-detail {
    display: flex;
    align-items: flex-start;
    margin-bottom: var(--space-2);
    font-size: 0.9rem;
}

.detail-label {
    color: var(--text-secondary);
    width: 100px;
    flex-shrink: 0;
}

.detail-value {
    color: var(--text-color);
}

.launch-status {
    display: inline-block;
    padding: var(--space-1) var(--space-3);
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: var(--space-4);
    color: white;
    width: fit-content;
    max-width: 100%;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.launch-status:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Status color classes defined globally in styles.css */

.loading {
    text-align: center;
    padding: 40px;
    color: var(--gray-500);
    grid-column: 1 / -1;
}

.no-results {
    text-align: center;
    padding: 24px;
    color: var(--gray-500);
}

.load-more-btn {
    display: block;
    margin: 16px auto;
    padding: 10px 16px;
    width: fit-content;
}

.mission-description {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin: 12px 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    box-orient: vertical;
    overflow: hidden;
    /* Fallback for browsers that don't support -webkit-line-clamp */
    max-height: 4.5em; /* 3 lines × 1.5 line height */
    position: relative;
    line-height: 1.5;
}

/* Fallback ellipsis for browsers that don't support -webkit-line-clamp */
@supports not (-webkit-line-clamp: 3) {
    .mission-description::after {
        content: '...';
        position: absolute;
        right: 0;
        bottom: 0;
        background: var(--card-background);
        padding-left: 4px;
    }
}

.launch-date {
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 12px;
}

.launch-location {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.launch-actions {
    width: 100%;
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: auto; /* Push buttons to bottom of flex container */
}

/* TODO: Future improvements for launch cards:
 * - Consider standardizing the height of all cards for more consistency
 * - Add transition effects when hovering over action buttons
 * - Consider adding tooltip descriptions for buttons on hover
 * - Implement a proper grid layout system with equal card heights
 * - Optimize card layout for very small mobile screens
 */

.details-link-container {
    display: flex;
    flex: 1;
}

.launch-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 500;
    transition: background-color 0.2s, transform 0.2s;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.launch-button.primary {
    background-color: var(--primary-color);
    color: white;
}

.launch-button.secondary {
    background-color: var(--button-secondary-bg);
    color: var(--text-color);
}

.launch-button:hover {
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .launches-page {
        padding: 80px 0 40px;
    }

    .page-header {
        padding: 0 20px;
        margin-bottom: 40px;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    .page-header p {
        font-size: 1rem;
    }

    .launches-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 20px;
    }

    .launch-card {
        margin: 0;
        width: 100%;
    }

    .launch-image-container {
        height: 180px;
    }

    .launch-content {
        padding: var(--space-4);
    }
    
    .launch-name {
        font-size: 1.1rem;
    }

    .launch-details {
        margin-top: var(--space-3);
    }

    .launch-detail {
        font-size: 0.85rem;
    }
    
    .launch-info {
        margin-bottom: var(--space-4);
    }
    
    .launch-actions {
        flex-direction: column;
        gap: var(--space-2);
        margin-top: var(--space-4); /* Add extra space between content and buttons on mobile */
    }

    .launch-button,
    .button {
        width: 100%;
        padding: 12px 16px; /* Slightly taller buttons for better tap targets */
        text-align: center;
    }
    
    .details-link-container {
        width: 100%;
    }
    
    .launch-actions a.button {
        height: 44px; /* Make buttons slightly taller on mobile for easier tapping */
    }
}

@media (max-width: 480px) {
    .launches-page {
        padding: 70px 0 30px;
    }

    .page-header h1 {
        font-size: 1.75rem;
    }

    .launch-image-container {
        height: 160px;
    }

    .launch-content {
        padding: 14px;
    }
    
    .launch-info {
        margin-bottom: 14px;
    }
    
    .launch-actions {
        gap: 10px;
    }

    .launch-status {
        font-size: 0.8rem;
        padding: 3px 10px;
    }

    .mission-description {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        max-height: 3em;
    }

    .theme-toggle {
        bottom: 16px;
        right: 16px;
        width: 40px;
        height: 40px;
    }
}

/* Theme toggle button */
.theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px var(--shadow-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 1000;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
    fill: var(--text-color);
}

.theme-toggle-icon {
    width: 24px;
    height: 24px;
}

/* Show/hide appropriate icon based on theme */
.theme-toggle-icon .sun-icon {
    display: none;
}

.theme-toggle-icon .moon-icon {
    display: block;
}

[data-theme="dark"] .theme-toggle-icon .sun-icon {
    display: block;
}

[data-theme="dark"] .theme-toggle-icon .moon-icon {
    display: none;
} 

/* Search bar styles */
.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;  /* Center it on larger screens */
    margin: 0 auto 32px auto;  /* Space below header, above grid */
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 40px;  /* Left padding for icon */
    border: 1px solid var(--border-color);
    border-radius: 8px;  /* Match button/card radius */
    background-color: var(--card-background);
    color: var(--text-color);
    font-size: 1rem;
    box-shadow: 0 1px 3px var(--shadow-color);
    transition: all 0.2s ease;
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 2px 6px rgba(var(--primary-color-rgb), 0.2);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;  /* Don't block input */
}

.search-icon svg {
    width: 16px;
    height: 16px;
    stroke: var(--text-secondary);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .search-wrapper {
        max-width: none;  /* Full width on mobile */
        padding: 0 16px;  /* Match page padding */
        margin-bottom: 24px;
    }
    
    .search-input {
        font-size: 0.95rem;
        padding: 10px 16px 10px 36px;
    }
    
    .search-icon svg {
        width: 14px;
        height: 14px;
    }
}

/* Adjust page header spacing */
.page-header {
    text-align: center;
    margin-bottom: 40px;  /* Reduced from 60px for tighter layout */
}

/* Equalize card heights in grid */
.launches-grid {
    grid-auto-rows: 1fr;  /* Makes rows equal height */
}

/* Search bar enhancements */
.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px;  /* Wider for better usability (was 600px) */
    margin: 0 auto 24px auto;  /* Tighter bottom margin */
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 40px;  /* Padding for icons on both sides */
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--card-background);
    color: var(--text-color);
    font-size: 1rem;
    box-shadow: 0 1px 3px var(--shadow-color);
    transition: all 0.2s ease;
}

.search-input:hover {
    border-color: var(--primary-color);
}

.search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    display: none;  /* Shown via JS */
}

.search-clear:hover {
    color: var(--primary-color);
}

/* No results message */
.no-results {
    grid-column: 1 / -1;  /* Span full grid */
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Mobile tweaks */
@media (max-width: 768px) {
    .search-wrapper {
        max-width: none;
        padding: 0 16px;
        margin-bottom: 20px;
    }
    
    .search-input {
        padding: 10px 36px 10px 36px;
    }
}

/* Ensure grid section doesn't collapse when empty */
.launches-grid-section {
    min-height: 40vh;  /* Minimum height to fill space nicely */
    display: flex;
    flex-direction: column;
    justify-content: center;  /* Vertically center no-results */
    align-items: center;  /* Horizontally center */
}

/* No results message with icon */
.no-results {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
    padding: 40px 20px;
    max-width: 400px;
    margin: auto;
}

.no-results-icon {
    margin-bottom: 16px;
    font-size: 48px;  /* For emoji sizing */
    color: var(--text-secondary);
    opacity: 0.7;
}

.no-results p {
    margin: 0;
    line-height: 1.5;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .launches-grid-section {
        min-height: 50vh;  /* Taller on mobile for better feel */
    }
    
    .no-results {
        font-size: 1rem;
        padding: 30px 16px;
    }
    
    .no-results-icon {
        font-size: 40px;
    }
}

/* launches.css */
.launches-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.launches-grid-section {
    width: 100%;
}

.launches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
    width: 100%;
    margin: 0 auto;
    justify-content: center;
}

.launch-card { width: 100%; max-width: 360px; margin: 0 auto; border-radius: var(--radius-card); overflow: hidden; }

/* Button layout to match the image */
.launch-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    width: 100%;
}

/* Make both buttons take equal width */
.details-link-container, 
.launch-actions > a.button {
    flex: 1;
}

.launch-actions a.button {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 10px;
    height: 40px;
    font-size: 0.95rem;
}

@media (max-width: 1200px) {
    .launches-content {
        max-width: 900px;
    }
}

@media (max-width: 768px) {    
    .launches-content {
        padding: 0 16px;
    }
    
    /* Adapt buttons to mobile view */
    .launch-actions {
        flex-direction: column;
    }
}

/* launches.css */
/* ... (existing content from the provided launches.css document) ... */

/* Append the banner/media query styles from launches.js */
.launches-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.launches-grid-section {
    width: 100%;
}

.launches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
    width: 100%;
    margin: 0 auto;
    justify-content: center;
}

.launch-card {
    width: 100%;
    max-width: 350px;
    margin: 0 auto;
}

/* Button layout to match the image */
.launch-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    width: 100%;
}

/* Make both buttons take equal width */
.details-link-container, 
.launch-actions > a.button {
    flex: 1;
}

.launch-actions a.button {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 10px;
    height: 40px;
    font-size: 0.95rem;
}

@media (max-width: 1200px) {
    .launches-content {
        max-width: 900px;
    }
}

@media (max-width: 768px) {    
    .launches-content {
        padding: 0 16px;
    }
    
    /* Adapt buttons to mobile view */
    .launch-actions {
        flex-direction: column;
    }
}
