/* Custom styles for Photo Rating App */

/* Enhanced star rating animations */
.star-rating {
    display: inline-flex;
    gap: 3px;
    padding: 4px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.5);
}

.star {
    color: #d1d5db;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.2s ease;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}

.star:hover {
    color: #fbbf24;
    transform: scale(1.1);
}

.star.active {
    color: #fbbf24;
}

/* Hover effect for rating */
.star-rating:hover .star:hover ~ .star {
    color: #d1d5db;
    transform: scale(1);
}

/* Photo grid enhancements - single column layout */
.photo-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 0.5rem;
    max-width: 800px;
    margin: 0 auto;
}

.photo-item {
    position: relative;
    border-radius: 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    background: #f3f4f6;
    cursor: pointer;
    overflow: hidden;
}

.photo-item img {
    width: 100%;
    height: auto;
    display: block;
}

/* Star rating container below photos */
.star-rating-container {
    padding: 1rem;
    background: #f8f9fa;
    display: flex;
    justify-content: center;
    border-top: 1px solid #e5e7eb;
}

.star-rating-large {
    display: inline-flex;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.star-large {
    color: #d1d5db;
    cursor: pointer;
    font-size: 1.75rem;
    transition: all 0.2s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.star-large:hover {
    color: #fbbf24;
    transform: scale(1.1);
}

.star-large.active {
    color: #fbbf24;
}

/* Hover effect for rating */
.star-rating-large:hover .star-large:hover ~ .star-large {
    color: #d1d5db;
    transform: scale(1);
}

/* Loading animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Button enhancements */
.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Card hover effects */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Progress bar animations */
.progress-bar {
    transition: width 1s ease-in-out;
}

/* Notification animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.notification-enter {
    animation: slideInRight 0.3s ease-out;
}

.notification-exit {
    animation: slideOutRight 0.3s ease-in;
}

/* Focus styles for accessibility */
.star:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 2px;
}

button:focus, a:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .star {
        color: #000;
    }

    .star:hover,
    .star.active {
        color: #ffcc00;
        text-shadow: 1px 1px 0 #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .star,
    .photo-item,
    .photo-item img,
    .photo-overlay,
    .btn-primary,
    .card-hover {
        transition: none;
    }

    .photo-item:hover {
        transform: none;
    }

    .photo-item:hover img {
        transform: none;
    }
}

/* Print styles */
@media print {
    .photo-grid {
        display: block;
    }

    .photo-item {
        break-inside: avoid;
        margin-bottom: 1rem;
    }

    .photo-overlay {
        position: static;
        background: none;
        opacity: 1;
        padding: 0.5rem 0;
    }

    .star-rating {
        background: none;
    }

    .star {
        color: #000 !important;
    }
}

/* Custom utilities */
.aspect-square {
    aspect-ratio: 1 / 1;
}

.object-cover {
    object-fit: cover;
}

.text-shadow {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.backdrop-blur {
    backdrop-filter: blur(4px);
}

/* Mobile-specific optimizations */
@media (max-width: 768px) {
    .photo-grid {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        padding: 0.5rem;
        max-width: 100%;
    }

    .star {
        font-size: 1.1rem;
    }

    .star-rating {
        gap: 2px;
        padding: 3px;
    }

    /* Compact stats panel for mobile */
    .stats-panel {
        margin-bottom: 1rem !important;
    }

    .stats-panel .block.md\\:hidden {
        padding: 0.75rem !important;
        margin-bottom: 0.75rem !important;
    }

    /* Ensure mode selection buttons are more prominent on mobile */
    .grid.md\\:grid-cols-2 {
        gap: 1rem;
        margin-top: 0.5rem;
    }

    .grid.md\\:grid-cols-2 a {
        padding: 1.5rem !important;
    }

    .grid.md\\:grid-cols-2 a h2 {
        font-size: 1.5rem !important;
        margin-bottom: 0.5rem !important;
    }

    .grid.md\\:grid-cols-2 a i {
        font-size: 2.5rem !important;
        margin-bottom: 0.75rem !important;
    }

    /* Rescan button mobile spacing */
    .text-center.mt-8 {
        margin-top: 1.5rem !important;
    }
}

/* Mobile portrait mode specific optimizations */
@media (max-width: 768px) and (orientation: portrait) {
    /* Extra compact stats for portrait mobile */
    .stats-panel .block.md\\:hidden {
        padding: 0.5rem !important;
        margin-bottom: 0.5rem !important;
    }

    .stats-panel .grid.grid-cols-3 {
        gap: 0.5rem !important;
    }

    .stats-panel .text-sm {
        font-size: 0.75rem !important;
    }

    .stats-panel .text-xs {
        font-size: 0.625rem !important;
    }

    /* Make sure mode buttons are above the fold */
    .grid.md\\:grid-cols-2 {
        margin-top: 0.25rem !important;
    }

    .grid.md\\:grid-cols-2 a {
        padding: 1.25rem !important;
    }

    .grid.md\\:grid-cols-2 a h2 {
        font-size: 1.25rem !important;
    }

    .grid.md\\:grid-cols-2 a i {
        font-size: 2rem !important;
        margin-bottom: 0.5rem !important;
    }

    .grid.md\\:grid-cols-2 a p {
        font-size: 0.875rem !important;
    }

    /* Fix ratings bar overflow with banana button in portrait mode */
    .star-rating-container {
        padding: 0.5rem !important;
    }

    .star-rating-container .flex.items-center {
        gap: 0.5rem !important; /* Reduce gap from default 12px to 8px */
    }

    .star-rating-container .flex.items-center button {
        width: 2rem !important; /* Reduce button size from 40px to 32px */
        height: 2rem !important;
        min-width: 2rem !important;
    }

    .star-rating-container .flex.items-center button i {
        font-size: 0.75rem !important; /* Smaller icons */
    }

    .star-rating-large {
        gap: 4px !important; /* Reduce star gaps from 8px to 4px */
        padding: 4px 6px !important; /* Reduce padding */
    }

    .star-large {
        font-size: 1.25rem !important; /* Reduce star size from 1.75rem to 1.25rem */
    }

    /* Ensure banana emoji is properly sized */
    .star-rating-container button[onclick*="banana"] {
        font-size: 1rem !important;
        line-height: 1 !important;
    }
}

/* Samsung S24+ Portrait Mode Specific Optimizations (1440x3120) */
@media (max-width: 1440px) and (orientation: portrait) and (min-width: 769px) {
    /* Target high-resolution portrait devices like Samsung S24+ */
    .star-rating-container {
        padding: 0.75rem !important;
    }

    .star-rating-container .flex.items-center {
        gap: 0.75rem !important; /* Moderate spacing reduction */
    }

    .star-rating-container .flex.items-center button {
        width: 2.25rem !important; /* 36px - slightly smaller than default 40px */
        height: 2.25rem !important;
        min-width: 2.25rem !important;
    }

    .star-rating-container .flex.items-center button i {
        font-size: 0.875rem !important;
    }

    .star-rating-large {
        gap: 6px !important; /* Reduce from 8px to 6px */
        padding: 6px 8px !important;
    }

    .star-large {
        font-size: 1.5rem !important; /* Slightly smaller than default 1.75rem */
    }

    /* Ensure banana button fits properly */
    .star-rating-container button[onclick*="banana"] {
        font-size: 1.125rem !important;
        line-height: 1.2 !important;
    }
}

/* Banana Button Visual States */
.banana-button {
    transition: all 0.3s ease !important;
}

/* Banana OFF state (default) */
.banana-button:not(.banana-active) {
    background-color: #6b7280 !important; /* Gray background when off */
    opacity: 0.7;
}

.banana-button:not(.banana-active):hover {
    background-color: #4b5563 !important; /* Darker gray on hover when off */
    opacity: 0.9;
}

/* Banana ON state (active) */
.banana-button.banana-active {
    background-color: #f59e0b !important; /* Bright amber when on */
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.4) !important; /* Glowing amber ring */
    transform: scale(1.1) !important; /* Slightly larger when active */
}

.banana-button.banana-active:hover {
    background-color: #d97706 !important; /* Darker amber on hover when on */
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.6) !important; /* Stronger glow on hover */
}

/* Very small screens (iPhone SE, etc.) */
@media (max-width: 375px) and (orientation: portrait) {
    .stats-panel .block.md\\:hidden {
        padding: 0.375rem !important;
    }

    .stats-panel .text-sm {
        font-size: 0.6875rem !important;
    }

    .grid.md\\:grid-cols-2 a {
        padding: 1rem !important;
    }

    .grid.md\\:grid-cols-2 a h2 {
        font-size: 1.125rem !important;
    }

    .grid.md\\:grid-cols-2 a i {
        font-size: 1.75rem !important;
    }
}

/* High-resolution mobile landscape mode (Samsung S24+: 2340x1080) */
@media (max-height: 1200px) and (orientation: landscape) and (max-width: 2400px) {
    .photo-grid {
        gap: 0.5rem;
        padding: 0.5rem;
        max-width: 100%;
    }

    .photo-item {
        margin-bottom: 0.25rem;
    }

    .photo-item img {
        width: 100%;
        height: auto;
        max-height: 75vh;
        object-fit: contain;
        display: block;
    }

    .star-rating-container {
        padding: 0.75rem;
    }

    .star-large {
        font-size: 1.75rem;
    }

    .star-rating-large {
        gap: 8px;
        padding: 8px 12px;
    }

    /* Header adjustments for landscape */
    .bg-white.rounded-lg.shadow.p-6.mb-6 {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }

    .text-2xl {
        font-size: 1.5rem;
    }

    /* Navigation buttons positioning */
    .flex.space-x-3 {
        gap: 0.5rem;
    }

    .flex.space-x-3 button {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}

/* Dark mode support (if implemented later) */
@media (prefers-color-scheme: dark) {
    /* Reserved for future dark mode implementation */
}
/* Modal for full-size photo viewing */
.photo-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    cursor: pointer;
}

.photo-modal.active {
    display: flex;
}

.photo-modal img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    border-radius: 0;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

.photo-modal .close-button {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.photo-modal .close-button:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Best mode specific styles */
.best-mode-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.photo-display {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.best-mode-container .star-rating-container {
    position: sticky;
    bottom: 0;
    background: rgba(248, 249, 250, 0.2);
    border-top: 1px solid rgba(229, 231, 235, 0.2);
    padding: 1rem;
    z-index: 100;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
    opacity: 0.35;
}

/* Samsung S24+ Exact Portrait Dimensions Fix (1440x3120) */
@media (max-width: 1440px) and (max-height: 3120px) and (orientation: portrait) {
    /* Ensure ratings bar fits on Samsung S24+ Firefox browser */
    .star-rating-container .flex.items-center,
    .best-mode-container .flex.items-center.justify-center.gap-4 {
        /* Use flexbox wrap as fallback if needed */
        flex-wrap: nowrap;
        justify-content: center;
        align-items: center;
    }

    /* Extra safety: ensure no horizontal overflow */
    .star-rating-container,
    .best-mode-container .star-rating-container {
        max-width: 100vw;
        overflow-x: hidden;
        box-sizing: border-box;
    }
}

/* Best mode portrait optimizations */
@media (max-width: 768px) and (orientation: portrait) {
    .best-mode-container .flex.items-center.justify-center.gap-4 {
        gap: 0.5rem !important; /* Reduce gap-4 to smaller gap */
    }

    .best-mode-container .flex.items-center.justify-center.gap-4 button {
        width: 2rem !important;
        height: 2rem !important;
        min-width: 2rem !important;
    }

    .best-mode-container .flex.items-center.justify-center.gap-4 button i {
        font-size: 0.75rem !important;
    }

    .best-mode-container button[onclick*="banana"] {
        font-size: 1rem !important;
        line-height: 1 !important;
    }

    /* Ensure banana button visual states work in portrait mode */
    .banana-button.banana-active {
        transform: scale(1.05) !important; /* Slightly less scale on small screens */
    }
}

@media (max-width: 1440px) and (orientation: portrait) and (min-width: 769px) {
    /* Samsung S24+ and similar high-resolution portrait devices - Best mode */
    .best-mode-container .flex.items-center.justify-center.gap-4 {
        gap: 0.75rem !important; /* Moderate reduction from gap-4 */
    }

    .best-mode-container .flex.items-center.justify-center.gap-4 button {
        width: 2.25rem !important;
        height: 2.25rem !important;
        min-width: 2.25rem !important;
    }

    .best-mode-container .flex.items-center.justify-center.gap-4 button i {
        font-size: 0.875rem !important;
    }

    .best-mode-container button[onclick*="banana"] {
        font-size: 1.125rem !important;
        line-height: 1.2 !important;
    }

    /* Ensure banana button visual states work on Samsung S24+ portrait */
    .banana-button.banana-active {
        transform: scale(1.08) !important; /* Moderate scale for mid-size screens */
    }
}

/* Best mode landscape optimizations */
@media (max-height: 1200px) and (orientation: landscape) and (max-width: 2400px) {
    .best-mode-container .photo-display {
        padding: 0;
    }

    .best-mode-container .photo-item img {
        max-height: 90vh;
    }

    .best-mode-container .star-rating-container {
        height: 5vh;
        padding: 0.25rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .best-mode-container .star-large {
        font-size: 1.5rem;
    }

    .best-mode-container .star-rating-large {
        gap: 6px;
        padding: 4px 8px;
    }

    /* Reduce button sizes for landscape mode */
    .best-mode-container .flex.items-center.justify-center.gap-4 button {
        width: 2.5rem;
        height: 2.5rem;
    }

    .best-mode-container .flex.items-center.justify-center.gap-4 button i {
        font-size: 0.875rem;
    }

    /* Browse mode navigation fixes for landscape */
    .browse-header {
        padding: 0.75rem !important;
        margin-bottom: 0.5rem !important;
    }

    .browse-header .flex.flex-col.sm\\:flex-row {
        flex-direction: row !important;
        align-items: center !important;
        gap: 1rem !important;
    }

    .browse-nav-buttons {
        flex-shrink: 0;
    }

    .browse-nav-buttons button {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.875rem !important;
    }

    .browse-header h2 {
        font-size: 1.25rem !important;
        margin-bottom: 0.25rem !important;
    }
}