/* Custom styles for the voting application */

/* Submission card styles */
.submission-card {
    @apply bg-white rounded-lg shadow-lg border border-gray-200 transition-all duration-200 cursor-pointer;
    @apply hover:shadow-xl hover:scale-105 hover:-translate-y-1;
}

.submission-card.selected {
    @apply ring-2 ring-blue-500 bg-blue-50;
}

.submission-card.selected:hover {
    @apply shadow-xl;
}

.submission-card.disabled {
    @apply opacity-50 cursor-not-allowed;
    pointer-events: none;
}

.submission-card.disabled:hover {
    @apply shadow-md scale-100 translate-y-0;
}

/* Loading states */
.htmx-request .submission-card {
    @apply opacity-75;
}

.htmx-request.submission-card {
    @apply animate-pulse;
}

/* Selection indicator animation */
.selection-indicator {
    animation: fadeInScale 0.2s ease-out;
}

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

/* Aspect ratio for images */
.aspect-w-4 {
    position: relative;
    padding-bottom: 75%; /* 4:3 aspect ratio */
}

.aspect-w-4 > img {
    position: absolute;
    height: 100%;
    width: 100%;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

/* Button styles */
.btn {
    @apply inline-flex items-center px-4 py-2 font-medium rounded-lg;
    @apply transition-colors duration-200;
}

.btn-primary {
    @apply bg-blue-600 text-white hover:bg-blue-700;
}

.btn-secondary {
    @apply bg-gray-200 text-gray-700 hover:bg-gray-300;
}

.btn-success {
    @apply bg-green-600 text-white hover:bg-green-700;
}

/* Mobile-specific styles */

/* Disable hover effects on touch devices */
@media (hover: hover) and (pointer: fine) {
    .submission-card:hover {
        @apply shadow-xl scale-105 -translate-y-1;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .submission-card {
        @apply hover:scale-100 hover:translate-y-0;
        touch-action: manipulation; /* Prevents double-tap zoom delay */
        -webkit-tap-highlight-color: transparent;
    }

    /* Touch feedback */
    .submission-card:active {
        @apply scale-[0.98] opacity-90;
        transition: transform 0.1s ease;
    }
}

/* Small mobile breakpoint (320px-480px) */
@media (max-width: 480px) {
    /* Constrain card width on very small screens */
    .submission-card {
        max-width: 100%;
    }

    /* Adjust selected banner for mobile */
    .selected-banner {
        font-size: 10px !important;
        padding: 3px 16px 3px 8px !important;
        top: 6px !important;
        left: -6px !important;
    }

    /* Smaller shadows on mobile for better performance */
    .submission-card {
        @apply shadow-md;
    }
}

/* Mobile breakpoint (up to 640px) */
@media (max-width: 640px) {
    /* Base mobile styles */
    .submission-card {
        @apply hover:scale-100 hover:translate-y-0;
        transition: box-shadow 0.2s ease, opacity 0.2s ease;
    }

    /* Responsive text sizing */
    .submission-card h3 {
        @apply text-base;
    }

    /* Mobile-optimized button sizing */
    .submission-card button {
        min-height: 44px; /* iOS minimum touch target */
        @apply text-sm;
    }

    /* Reduce motion for better performance */
    @media (prefers-reduced-motion: reduce) {
        .submission-card,
        .selection-indicator,
        .selected-banner {
            transition: none !important;
            animation: none !important;
        }
    }
}

/* Tablet breakpoint adjustments (640px-768px) */
@media (min-width: 640px) and (max-width: 768px) {
    .submission-card {
        max-width: 350px;
        margin: 0 auto;
    }
}

/* Progress bar animation */
.progress-bar {
    @apply bg-blue-600 h-1 transition-all duration-300 ease-out;
}

/* Sticky header shadow on scroll */
.sticky-header-shadow {
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
}

/* Focus styles for accessibility */
.submission-card:focus {
    @apply outline-none ring-2 ring-offset-2 ring-blue-500;
}

button:focus,
a:focus {
    @apply outline-none ring-2 ring-offset-2 ring-blue-500;
}

/* Loading spinner */
.spinner {
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top: 3px solid #3b82f6;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

/* Placeholder image style */
.placeholder-image {
    @apply bg-gradient-to-br from-gray-200 to-gray-300;
    @apply flex items-center justify-center text-gray-500;
}

/* Selected ribbon overlay */
.selected-ribbon {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    z-index: 20;
    border-style: solid;
    border-width: 50px 50px 0 0;
    border-color: #10B981 transparent transparent transparent;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease-out;
}

.selected-ribbon.visible {
    opacity: 1;
    transform: scale(1);
}

.selected-ribbon::after {
    content: "✓";
    position: absolute;
    top: -40px;
    left: 8px;
    color: white;
    font-weight: bold;
    font-size: 16px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Alternative ribbon style - diagonal banner */
.selected-banner {
    position: absolute;
    top: 10px;
    left: -8px;
    background: linear-gradient(45deg, #10B981, #059669);
    color: white;
    padding: 4px 24px 4px 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transform: rotate(-8deg);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
    z-index: 20;
    opacity: 0;
    transform: rotate(-8deg) scale(0.8);
    transition: all 0.3s ease-out;
}

.selected-banner.visible {
    opacity: 1;
    transform: rotate(-8deg) scale(1);
}

.selected-banner::after {
    content: "";
    position: absolute;
    right: -4px;
    bottom: -4px;
    width: 0;
    height: 0;
    border-left: 4px solid #059669;
    border-bottom: 4px solid transparent;
}

/* Landing page retro styles */
.retro-text {
    font-family: 'Comic Sans MS', 'Comic Neue', cursive;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.retro-button {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    color: white;
    font-weight: bold;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

.retro-button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.6);
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 107, 107, 0.3); }
    50% { box-shadow: 0 0 20px rgba(255, 107, 107, 0.8); }
}

.sparkle-animation {
    animation: sparkle 1.5s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 0.7; transform: scale(1) rotate(0deg); }
    50% { opacity: 1; transform: scale(1.2) rotate(180deg); }
}

.marquee {
    animation: marquee 10s linear infinite;
}

@keyframes marquee {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* Geocities-style background patterns */
.retro-bg {
    background-image:
        radial-gradient(circle at 20% 50%, rgba(255, 107, 107, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(78, 205, 196, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(69, 183, 209, 0.1) 0%, transparent 50%);
}

/* Retro glow effects */
.glow-text {
    text-shadow:
        0 0 5px currentColor,
        0 0 10px currentColor,
        0 0 15px currentColor,
        0 0 20px currentColor;
}

/* 90s-style borders */
.retro-border-thick {
    border: 4px ridge #8b4513;
    box-shadow: inset 2px 2px 4px rgba(255, 255, 255, 0.3);
}

/* Vintage computer terminal style */
.terminal-style {
    background: #000;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    padding: 10px;
    border-radius: 5px;
    border: 2px solid #333;
}

.terminal-style::before {
    content: "> ";
    color: #ffff00;
}