/* lottery-results.css */
/* Save this file as: wp-content/plugins/lottery-results-display/assets/lottery-results.css */

/* Fallback Notice Styling */
.lottery-fallback-notice {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    animation: slideDown 0.4s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.lottery-notice-content {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 15px;
}

.lottery-notice-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    margin-top: 2px;
}

.lottery-notice-text {
    flex: 1;
    font-size: 16px;
    line-height: 1.6;
}

.lottery-notice-text strong {
    font-weight: 700;
    display: block;
    margin-bottom: 5px;
    font-size: 17px;
}

.lottery-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.4);
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

.lottery-refresh-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.lottery-refresh-btn:active {
    transform: translateY(0);
}

.lottery-refresh-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Mobile responsiveness for notice */
@media (max-width: 768px) {
    .lottery-fallback-notice {
        padding: 18px 20px;
        margin-bottom: 20px;
    }
    
    .lottery-notice-content {
        gap: 12px;
        margin-bottom: 12px;
    }
    
    .lottery-notice-icon {
        width: 24px;
        height: 24px;
    }
    
    .lottery-notice-text {
        font-size: 15px;
    }
    
    .lottery-notice-text strong {
        font-size: 16px;
    }
    
    .lottery-refresh-btn {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .lottery-fallback-notice {
        padding: 15px;
        margin-bottom: 15px;
        border-radius: 6px;
    }
    
    .lottery-notice-text {
        font-size: 14px;
    }
    
    .lottery-notice-text strong {
        font-size: 15px;
    }
}

.lottery-results-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin: 20px 0;
    max-width: 100%;
    padding: 0;
}

/* Desktop - single column for better visibility */
@media (min-width: 1025px) {
    .lottery-results-container {
        grid-template-columns: 1fr;
        gap: 40px;
        max-width: 1400px;
        margin: 20px auto;
    }
}

/* Large Desktop - still single column */
@media (min-width: 1400px) {
    .lottery-results-container {
        grid-template-columns: 1fr;
        max-width: 1600px;
        margin: 20px auto;
    }
}

.lottery-result-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
    max-width: 100%;
}

/* Disable hover effect on touch devices */
@media (hover: hover) and (pointer: fine) {
    .lottery-result-item:hover {
        transform: translateY(-3px);
        box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    }
}

/* Touch devices - add active state instead */
@media (hover: none) {
    .lottery-result-item:active {
        transform: scale(0.98);
    }
}

.lottery-image-wrapper {
    width: 100%;
    position: relative;
    background: #f5f5f5;
    overflow: hidden;
}

.lottery-image-wrapper picture {
    display: block;
    width: 100%;
}

.lottery-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    max-height: none;
    min-height: 400px;
}

/* Desktop - larger images */
@media (min-width: 1025px) {
    .lottery-image {
        min-height: 600px;
    }
}

/* Very large screens */
@media (min-width: 1600px) {
    .lottery-image {
        min-height: 800px;
    }
}

.lottery-buttons {
    display: flex;
    gap: 12px;
    padding: 20px;
    background: #fafafa;
    border-top: 1px solid #e0e0e0;
    flex-wrap: wrap;
    justify-content: center;
}

/* Mobile - Stack buttons vertically */
@media (max-width: 480px) {
    .lottery-buttons {
        flex-direction: column;
        gap: 12px;
        padding: 15px;
    }
}

/* Desktop - horizontal with more space */
@media (min-width: 1025px) {
    .lottery-buttons {
        padding: 25px;
        gap: 20px;
    }
}

.lottery-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 32px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: #fff;
    white-space: nowrap;
    min-height: 50px;
    -webkit-tap-highlight-color: transparent;
}

/* Desktop - larger buttons */
@media (min-width: 1025px) {
    .lottery-btn {
        padding: 16px 40px;
        font-size: 17px;
        min-height: 56px;
        gap: 12px;
    }
    
    .lottery-btn svg {
        width: 24px;
        height: 24px;
    }
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .lottery-btn {
        width: 100%;
        font-size: 15px;
        padding: 12px 16px;
        min-height: 48px;
        gap: 10px;
    }
    
    .lottery-btn svg {
        width: 22px;
        height: 22px;
    }
}

/* Small tablets */
@media (min-width: 481px) and (max-width: 768px) {
    .lottery-btn {
        padding: 12px 24px;
        font-size: 15px;
        min-height: 48px;
    }
}

.lottery-fullscreen {
    background: #2563eb;
}

.lottery-fullscreen:hover,
.lottery-fullscreen:focus {
    background: #1d4ed8;
}

.lottery-fullscreen:active {
    background: #1e40af;
}

.lottery-download {
    background: #16a34a;
}

.lottery-download:hover,
.lottery-download:focus {
    background: #15803d;
}

.lottery-download:active {
    background: #166534;
}

.lottery-btn svg {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
}

/* Remove duplicate mobile media query */

/* Modal styles */
.lottery-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0,0,0,0.95);
    animation: fadeIn 0.3s;
    touch-action: none;
}

.lottery-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lottery-modal-content {
    position: relative;
    max-width: 95%;
    max-height: 95vh;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

/* Mobile modal adjustments */
@media (max-width: 768px) {
    .lottery-modal-content {
        max-width: 100%;
        max-height: 100vh;
        padding: 5px;
    }
}

.lottery-modal-content picture {
    display: block;
    max-width: 100%;
    max-height: 95vh;
}

#lottery-modal-image {
    max-width: 100%;
    max-height: 95vh;
    height: auto;
    display: block;
    margin: 0 auto;
    object-fit: contain;
    touch-action: pinch-zoom;
}

/* Mobile - Full screen image */
@media (max-width: 768px) {
    #lottery-modal-image {
        max-height: 100vh;
        width: 100%;
        object-fit: contain;
    }
}

.lottery-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    background: rgba(0,0,0,0.5);
    border: 2px solid #fff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 1000000;
    line-height: 1;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.lottery-modal-close:hover {
    background: rgba(255,255,255,0.2);
    transform: rotate(90deg);
}

.lottery-modal-close:active {
    background: rgba(255,255,255,0.3);
    transform: scale(0.95);
}

/* Mobile close button */
@media (max-width: 768px) {
    .lottery-modal-close {
        top: 10px;
        right: 10px;
        width: 48px;
        height: 48px;
        font-size: 36px;
    }
}

/* Very small screens */
@media (max-width: 400px) {
    .lottery-modal-close {
        top: 5px;
        right: 5px;
        width: 44px;
        height: 44px;
        font-size: 32px;
    }
}

/* Loading state */
.lottery-result-item.loading .lottery-image {
    opacity: 0.5;
}

.lottery-result-item.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Responsive adjustments - REMOVED old multi-column layout */

/* Landscape mobile optimization */
@media (max-height: 500px) and (orientation: landscape) {
    .lottery-modal-content {
        max-height: 90vh;
    }
    
    #lottery-modal-image {
        max-height: 90vh;
    }
    
    .lottery-modal-close {
        width: 40px;
        height: 40px;
        font-size: 28px;
        top: 5px;
        right: 5px;
    }
}

/* High DPI / Retina displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .lottery-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Prevent layout shift */
.lottery-image-wrapper::before {
    content: "";
    display: block;
    padding-top: 120%;
}

.lottery-image-wrapper picture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.lottery-image-wrapper {
    position: relative;
    background: #fff;
    min-height: 400px;
}

/* Desktop */
@media (min-width: 1025px) {
    .lottery-image-wrapper {
        min-height: 600px;
    }
    
    .lottery-image-wrapper::before {
        padding-top: 140%;
    }
}

/* Large screens */
@media (min-width: 1400px) {
    .lottery-image-wrapper {
        min-height: 700px;
    }
}

/* Safe area insets for notched devices (iPhone X, etc) */
@supports (padding: env(safe-area-inset-left)) {
    .lottery-modal-close {
        top: calc(10px + env(safe-area-inset-top));
        right: calc(10px + env(safe-area-inset-right));
    }
    
    .lottery-results-container {
        padding-left: calc(10px + env(safe-area-inset-left));
        padding-right: calc(10px + env(safe-area-inset-right));
    }
}

/* Print styles */
@media print {
    .lottery-buttons {
        display: none;
    }
    
    .lottery-result-item {
        page-break-inside: avoid;
    }
}