/* ============================================
   iOS App Importer - Frontend Styles
   Complete Enhanced Version with Version History
   ============================================ */

/* ===================
   App Badges
   =================== */
.ios-app-badge {
    display: inline-block;
    background: #007aff;
    color: #fff;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.android-app-badge {
    display: inline-block;
    background: #3ddc84;
    color: #fff;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Version Badge */
.ios-version-badge {
    background: #28a745;
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    margin-left: 8px;
}

/* Recently Updated Badge */
.recently-updated-badge {
    background: #ff9500;
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
    margin-left: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.85;
        transform: scale(1.05);
    }
}

/* ===================
   Download Links
   =================== */
.ios-download-links {
    margin: 30px 0;
}

.download-links-list {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.download-links-list li {
    margin-bottom: 15px;
}

.download-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #007aff;
    color: #fff;
    padding: 14px 28px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

.download-button:hover {
    background: #0051d5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.4);
    color: #fff;
    text-decoration: none;
}

.download-button:active {
    transform: translateY(0);
}

.download-button .dashicons {
    vertical-align: middle;
    font-size: 20px;
}

.download-button .version {
    font-size: 13px;
    opacity: 0.9;
    margin-left: 8px;
    font-weight: 400;
}

/* Multiple download buttons */
.download-links-list .download-button {
    width: 100%;
    max-width: 400px;
    justify-content: center;
}

/* ===================
   Screenshots
   =================== */
.ios-screenshots {
    margin: 30px 0;
}

.screenshots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.screenshot-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.screenshot-item img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: block;
}

.screenshot-item img:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

/* Lightbox support */
.screenshot-item a {
    display: block;
    text-decoration: none;
}

/* ===================
   App Card
   =================== */
.ios-app-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    margin: 30px 0;
}

.ios-app-card .app-header {
    display: flex;
    gap: 20px;
    align-items: start;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.app-icon {
    flex-shrink: 0;
}

.app-icon img {
    width: 120px;
    height: 120px;
    border-radius: 24px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.app-info {
    flex: 1;
    min-width: 250px;
}

.app-info h3 {
    margin: 0 0 10px 0;
    font-size: 24px;
    color: #333;
}

.app-developer {
    color: #666;
    font-size: 16px;
    margin: 0 0 15px 0;
}

.app-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 15px;
    color: #666;
    margin-top: 15px;
}

.app-meta > div {
    display: flex;
    align-items: center;
    gap: 5px;
}

.app-meta strong {
    color: #333;
}

.app-meta .rating {
    color: #f5a623;
}

/* ===================
   Version History Table
   =================== */
.ios-version-history {
    margin: 30px 0;
}

.ios-version-history h3,
.ios-version-history h4 {
    margin-bottom: 15px;
    color: #333;
}

.version-history-table {
    overflow-x: auto;
    margin-top: 20px;
}

.version-history-table table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.version-history-table thead th {
    padding: 12px 15px;
    background: #f9f9f9;
    font-weight: 600;
    text-align: left;
    border-bottom: 2px solid #e0e0e0;
    color: #333;
    font-size: 14px;
}

.version-history-table tbody td {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #555;
}

.version-history-table tbody tr {
    transition: background-color 0.2s ease;
}

.version-history-table tbody tr:last-child td {
    border-bottom: none;
}

.version-history-table tbody tr:hover {
    background: #f8f9fa;
}

/* Current version row highlight */
.version-history-table tbody tr.current-version {
    background: #e7f3ff;
    font-weight: 500;
}

.version-history-table tbody tr.current-version td {
    border-bottom-color: #cce5ff;
}

/* Version badges in table */
.version-history-table .current-badge {
    background: #007aff;
    color: #fff;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    margin-left: 5px;
    font-weight: 600;
}

/* Download buttons in table */
.version-history-table .button-small {
    padding: 4px 10px;
    font-size: 12px;
    line-height: 1.4;
    text-decoration: none;
    background: #007aff;
    color: #fff;
    border-radius: 4px;
    display: inline-block;
    margin: 2px;
    transition: background 0.3s ease;
}

.version-history-table .button-small:hover {
    background: #0051d5;
    color: #fff;
}

/* ===================
   Version Timeline
   =================== */
.ios-version-timeline {
    margin: 30px 0;
}

.timeline-wrapper {
    position: relative;
    padding: 20px 0;
    max-width: 800px;
}

.timeline-item {
    position: relative;
    padding-left: 40px;
    margin-bottom: 30px;
}

.timeline-item.current {
    border-left: 3px solid #007aff;
}

.timeline-item:not(.current) {
    border-left: 3px solid #ddd;
}

.timeline-marker {
    position: absolute;
    left: -8px;
    top: 0;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #ddd;
}

.timeline-item.current .timeline-marker {
    background: #007aff;
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px #007aff;
}

.timeline-content {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.timeline-item.current .timeline-content {
    border: 2px solid #007aff;
    background: #f8fbff;
}

.timeline-content h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #333;
}

.timeline-content .version-number {
    font-size: 18px;
    font-weight: 700;
    color: #007aff;
}

.timeline-content .latest-badge {
    background: #007aff;
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 10px;
}

.timeline-content .version-meta {
    color: #666;
    font-size: 13px;
    margin: 10px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.timeline-content .release-notes {
    margin-top: 10px;
    padding: 10px;
    background: #fff;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.6;
}

.timeline-content .release-notes strong {
    display: block;
    margin-bottom: 5px;
    color: #333;
}

/* ===================
   Version Comparison
   =================== */
.version-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.version-comparison-item {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
}

.version-comparison-item.current {
    border-color: #007aff;
}

.version-comparison-item h4 {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
    font-size: 18px;
}

.version-comparison-item .meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #666;
    font-size: 14px;
}

.version-comparison-item .meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ===================
   Version Stats
   =================== */
.version-stats {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.version-stat {
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    flex: 1;
    min-width: 150px;
    text-align: center;
}

.version-stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #007aff;
    display: block;
    line-height: 1.2;
}

.version-stat-label {
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 5px;
    display: block;
}

/* ===================
   Image Optimization Notice
   =================== */
.image-optimization-notice {
    background: #e7f3ff;
    border-left: 4px solid #007aff;
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
}

.image-optimization-notice strong {
    display: block;
    margin-bottom: 8px;
    color: #007aff;
    font-size: 15px;
}

.image-optimization-notice p {
    margin: 0;
    color: #555;
    font-size: 14px;
    line-height: 1.6;
}

/* ===================
   Info Boxes
   =================== */
.ios-info-box {
    padding: 15px;
    margin: 20px 0;
    border-radius: 8px;
    border-left: 4px solid;
}

.ios-info-box.info {
    background: #e7f3ff;
    border-color: #007aff;
}

.ios-info-box.success {
    background: #d4edda;
    border-color: #28a745;
}

.ios-info-box.warning {
    background: #fff3cd;
    border-color: #ffc107;
}

.ios-info-box.error {
    background: #f8d7da;
    border-color: #dc3545;
}

.ios-info-box strong {
    display: block;
    margin-bottom: 5px;
    font-size: 15px;
}

/* ===================
   Responsive Design
   =================== */
@media (max-width: 768px) {
    .screenshots-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .ios-app-card {
        padding: 15px;
    }

    .ios-app-card .app-header {
        flex-direction: column;
    }

    .app-icon img {
        width: 80px;
        height: 80px;
        border-radius: 16px;
    }

    .app-info h3 {
        font-size: 20px;
    }

    .app-meta {
        gap: 12px;
        font-size: 14px;
    }

    .download-button {
        padding: 12px 20px;
        font-size: 14px;
    }

    .version-history-table {
        font-size: 13px;
    }

    .version-history-table thead th,
    .version-history-table tbody td {
        padding: 8px 10px;
    }

    .timeline-item {
        padding-left: 30px;
    }

    .timeline-content {
        padding: 12px;
    }

    .timeline-content .version-number {
        font-size: 16px;
    }

    .version-comparison {
        grid-template-columns: 1fr;
    }

    .version-stat {
        min-width: 120px;
    }

    .version-stat-value {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .screenshots-grid {
        grid-template-columns: 1fr;
    }

    .download-button {
        width: 100%;
    }

    .app-meta {
        flex-direction: column;
        gap: 8px;
    }

    .timeline-content .version-meta {
        flex-direction: column;
        gap: 8px;
    }

    .version-stats {
        flex-direction: column;
    }

    .version-stat {
        min-width: 100%;
    }
}

/* ===================
   Print Styles
   =================== */
@media print {
    .download-button,
    .screenshot-item img:hover,
    .recently-updated-badge {
        box-shadow: none;
        transform: none;
    }

    .ios-app-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .timeline-item {
        page-break-inside: avoid;
    }
}

/* ===================
   Dark Mode Support (Optional)
   =================== */
@media (prefers-color-scheme: dark) {
    .ios-app-card {
        background: #1e1e1e;
        border-color: #333;
        color: #e0e0e0;
    }

    .app-info h3,
    .app-meta strong {
        color: #fff;
    }

    .app-meta {
        color: #b0b0b0;
    }

    .version-history-table table {
        background: #1e1e1e;
    }

    .version-history-table thead th {
        background: #2a2a2a;
        color: #fff;
        border-color: #444;
    }

    .version-history-table tbody td {
        color: #b0b0b0;
        border-color: #333;
    }

    .version-history-table tbody tr:hover {
        background: #2a2a2a;
    }

    .timeline-content {
        background: #2a2a2a;
        color: #e0e0e0;
    }

    .timeline-item.current .timeline-content {
        background: #1a2a3a;
    }

    .version-stat {
        background: #2a2a2a;
        border-color: #444;
        color: #e0e0e0;
    }
}

/* ===================
   Utility Classes
   =================== */
.ios-text-center {
    text-align: center;
}

.ios-mb-20 {
    margin-bottom: 20px;
}

.ios-mt-20 {
    margin-top: 20px;
}

.ios-hidden {
    display: none;
}

.ios-visible {
    display: block;
}

/* Loading spinner for dynamic content */
.ios-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,122,255,.3);
    border-radius: 50%;
    border-top-color: #007aff;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Success checkmark animation */
.ios-success-check {
    display: inline-block;
    color: #28a745;
    animation: scaleIn 0.3s ease;
}

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