/* Custom styles for Two Rooms and a Boom PWA */

/* PWA and Mobile App Styles */
body {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
    font-feature-settings: "liga", "kern";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Safe area support for devices with notches */
.safe-area {
    padding-top: env(safe-area-inset-top);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
}

/* Improved touch targets for better accessibility */
button,
a,
input,
.clickable {
    min-height: 44px;
    min-width: 44px;
    position: relative;
}

/* Enhanced touch feedback */
button:active,
a:active,
.clickable:active {
    transform: scale(0.97);
    transition: transform 0.1s ease-out;
}

/* Smooth animations with reduced motion support */
* {
    transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity 0.2s ease,
                background-color 0.2s ease,
                border-color 0.2s ease,
                box-shadow 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* Card styling to match Two Rooms and a Boom aesthetic */
.card-container {
    @apply bg-gray-800 rounded-lg shadow-lg border-2 border-gray-600 p-6 m-4 max-w-sm mx-auto text-white;
}

.card-title {
    @apply text-xl font-bold text-center mb-4 text-gray-800;
}

.card-role {
    @apply text-lg font-semibold text-center mb-2;
}

.card-team-red {
    @apply bg-red-100 border-red-300 text-red-800;
}

.card-team-blue {
    @apply bg-blue-100 border-blue-300 text-blue-800;
}

.card-team-gray {
    @apply bg-gray-100 border-gray-400 text-gray-800;
}

.card-description {
    @apply text-sm text-gray-600 mt-4 leading-relaxed;
}

.btn-primary {
    @apply bg-blue-600 hover:bg-blue-700 text-white font-semibold py-2 px-4 rounded-lg transition-colors duration-200;
}

.btn-secondary {
    @apply bg-gray-600 hover:bg-gray-700 text-white font-semibold py-2 px-4 rounded-lg transition-colors duration-200;
}

.btn-danger {
    @apply bg-red-600 hover:bg-red-700 text-white font-semibold py-2 px-4 rounded-lg transition-colors duration-200;
}

/* Mobile-first responsive design */
@media (min-width: 768px) {
    .card-container {
        @apply max-w-md;
    }
}

/* Touch-friendly button spacing */
.btn-group>* {
    @apply mb-2 mr-2 last:mr-0;
}

/* Loading states and skeleton animations */
.loading {
    @apply opacity-50 pointer-events-none;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.skeleton {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    background: #374151;
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    color: white;
}

/* Room code display */
.room-code {
    @apply text-2xl font-mono font-bold text-center p-4 bg-gray-100 rounded-lg;
}

/* Player list styling */
.player-list {
    @apply bg-white rounded-lg shadow-md p-4 max-h-96 overflow-y-auto;
}

.player-item {
    @apply py-2 px-3 border-b border-gray-200 last:border-b-0;
}

/* Custom Modal Animations */
.modal-enter {
    opacity: 0;
    transform: scale(0.95);
}

.modal-enter-active {
    opacity: 1;
    transform: scale(1);
    transition: opacity 300ms ease, transform 300ms ease;
}

.modal-exit {
    opacity: 1;
    transform: scale(1);
}

.modal-exit-active {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 300ms ease, transform 300ms ease;
}

/* Modal backdrop blur effect for better visual separation */
#custom-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    backdrop-filter: blur(2px);
    z-index: -1;
}

/* Enhanced mobile responsiveness */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Larger touch targets on mobile */
    button, a {
        min-height: 48px;
        min-width: 48px;
    }
    
    /* Better text sizing on mobile */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    
    /* Card improvements for mobile */
    .card-container {
        margin: 0.5rem;
        padding: 1rem;
    }
}

/* Landscape orientation optimizations */
@media (orientation: landscape) and (max-height: 500px) {
    .min-h-screen {
        min-height: auto;
    }
    
    /* Reduce vertical padding in landscape */
    .py-8 { padding-top: 1rem; padding-bottom: 1rem; }
    .py-6 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
}

/* Connection status indicators */
.connection-indicator {
    position: relative;
}

.connection-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
}

.connection-indicator.connected::before {
    background-color: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.connection-indicator.disconnected::before {
    background-color: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

.connection-indicator.connecting::before {
    background-color: #f59e0b;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Toast notifications */
.toast {
    position: fixed;
    top: env(safe-area-inset-top, 1rem);
    left: 50%;
    transform: translateX(-50%);
    background: #374151;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    max-width: 90vw;
    opacity: 0;
    transform: translateX(-50%) translateY(-100%);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: #059669;
}

.toast.error {
    background: #dc2626;
}

.toast.warning {
    background: #d97706;
}

.toast.info {
    background: #2563eb;
}

/* Page transition animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
    opacity: 0;
}

.animate-slide-in-left {
    animation: slideInFromLeft 0.5s ease-out forwards;
    opacity: 0;
}

.animate-slide-in-right {
    animation: slideInFromRight 0.5s ease-out forwards;
    opacity: 0;
}

/* Card flip animation */
.card-flip {
    perspective: 1000px;
}

.card-flip-inner {
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card-flip.flipped .card-flip-inner {
    transform: rotateY(180deg);
}

.card-face {
    backface-visibility: hidden;
}

.card-face-back {
    transform: rotateY(180deg);
}

/* Button press effect */
.btn-press {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Subtle hover animations for interactive elements */
.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Stagger animation utility */
.stagger-animation > * {
    animation-fill-mode: backwards;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-animation > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-animation > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-animation > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-animation > *:nth-child(5) { animation-delay: 0.5s; }