/* Mobile-first responsive design for Dare Game */
:root {
    --dice-size: 160px;
    --avatar-size: 50px;
    --timer-size: 4rem;
}

/* General mobile optimizations */
body {
    font-size: 14px;
    line-height: 1.5;
    overflow-x: hidden;
}

.container {
    padding: 1rem;
    max-width: 100%;
    position: relative;
}

/* Override Bootstrap flex-grow-1 utility */
.flex-grow-1 {
    flex-grow: 0.8 !important;
}

/* Ensure all game screens fill the container and don't stack */
#intimacy-screen,
#waiting-screen,
#dice-screen,
#dare-screen,
#voting-screen,
#level-end-screen,
#final-screen {
    position: relative;
    width: 100%;
}

/* When screens are hidden, they should not take up any space */
#intimacy-screen[style*="display: none"],
#waiting-screen[style*="display: none"],
#dice-screen[style*="display: none"],
#dare-screen[style*="display: none"],
#voting-screen[style*="display: none"],
#level-end-screen[style*="display: none"],
#final-screen[style*="display: none"] {
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Dice styling */
.dice {
    width: var(--dice-size);
    height: var(--dice-size);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--bs-primary);
    border-radius: 15px;
    background: var(--bs-dark);
    transition: all 0.3s ease;
    cursor: pointer;
}

.dice.rolling {
    animation: rollDice 1s ease-in-out;
}

.dice.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--bs-secondary);
}

@keyframes rollDice {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(90deg) scale(1.1); }
    50% { transform: rotate(180deg) scale(1.2); }
    75% { transform: rotate(270deg) scale(1.1); }
}

/* Fresh round animations */
.fresh-round {
    animation: freshRoundEntry 0.8s ease-out;
}

@keyframes freshRoundEntry {
    0% { 
        opacity: 0; 
        transform: translateY(20px) scale(0.95); 
    }
    50% { 
        opacity: 0.7; 
        transform: translateY(-5px) scale(1.02); 
    }
    100% { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

.fade-in-fresh {
    animation: fadeInFresh 0.6s ease-in-out;
}

@keyframes fadeInFresh {
    0% { 
        opacity: 0; 
        transform: translateY(-10px); 
    }
    100% { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Timer styling */
.timer {
    font-size: var(--timer-size);
    font-weight: bold;
    font-family: 'Courier New', monospace;
    color: var(--bs-danger);
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.timer.warning {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Player cards */
.player-card {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    background: var(--bs-body-bg);
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.player-card:hover {
    background: var(--bs-secondary-bg);
    border-color: var(--bs-primary);
}

.player-card.host {
    border-color: var(--bs-warning);
    background: rgba(var(--bs-warning-rgb), 0.1);
}

.player-card.current-player {
    border-color: var(--bs-success);
    background: rgba(var(--bs-success-rgb), 0.1);
}

.player-avatar {
    width: var(--avatar-size);
    height: var(--avatar-size);
    border-radius: 50%;
    background: var(--bs-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.player-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.player-info {
    flex-grow: 1;
    min-width: 0;
}

.player-name {
    font-weight: bold;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-details {
    font-size: 0.875rem;
    color: var(--bs-text-muted);
}

/* Room ID styling */
.room-id {
    font-family: 'Courier New', monospace;
    letter-spacing: 0.2em;
    color: #DE4763 !important;
    font-weight: bold;
}

/* Avatar selection */
.avatar-option {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}

.avatar-option.active,
.avatar-option:hover {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
    color: white;
}

/* Avatar images */
.avatar-image {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-option .avatar-image {
    width: 60px;
    height: 60px;
}

.player-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Rating buttons */
.rating-buttons .btn {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
}

.rating-btn.selected {
    background: var(--bs-success);
    border-color: var(--bs-success);
    color: white;
}

/* Intimacy preferences */
.intimacy-player-card {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    background: var(--bs-body-bg);
}

.intimacy-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* Comfort level dropdown styling */
.intimacy-player-card .dropdown-toggle {
    min-width: 120px;
    text-align: right;
    padding-right: 1.5rem;
    position: relative;
    background-color: var(--bs-secondary);
    border-color: var(--bs-secondary);
    color: white;
}

.intimacy-player-card .dropdown-toggle::after {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
}

.intimacy-player-card .dropdown-toggle:hover {
    background-color: #6E2DC9;
    border-color: #9063EA;
}

.intimacy-player-card .dropdown-toggle.selected {
    background-color: #6E2DC9;
    border-color: #9063EA;
}

.intimacy-player-card .dropdown-menu {
    min-width: 120px;
    border: 1px solid var(--bs-border-color);
    background-color: var(--bs-body-bg);
}

.intimacy-player-card .dropdown-item {
    text-align: right;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.intimacy-player-card .dropdown-item:last-child {
    border-bottom: none;
}

.intimacy-player-card .dropdown-item:hover {
    background-color: #6E2DC9;
    color: white;
}

.intimacy-tag {
    padding: 0.25rem 0.75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bs-body-bg);
    font-size: 0.875rem;
}

.intimacy-tag:hover {
    border-color: #9063EA;
    background: #6E2DC9;
    color: white;
}

.intimacy-tag.selected {
    background: #6E2DC9;
    border-color: #9063EA;
    color: white;
}

/* Progress bars */
.progress {
    height: 8px;
    background-color: var(--bs-secondary-bg);
}

.progress-bar {
    transition: width 1s linear;
}

/* Scores display */
.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.score-item:last-child {
    border-bottom: none;
}

.score-item.winner {
    background: rgba(var(--bs-warning-rgb), 0.1);
    border-left: 4px solid var(--bs-warning);
}

.score-position {
    font-weight: bold;
    color: var(--bs-warning);
    margin-right: 0.5rem;
}

.score-value {
    font-weight: bold;
    color: var(--bs-success);
}

/* Level vote buttons */
.level-vote-btn.selected {
    opacity: 0.7;
    transform: scale(0.95);
}

/* Mobile specific adjustments */
@media (max-width: 576px) {
    :root {
        --dice-size: 140px;
        --avatar-size: 40px;
        --timer-size: 3rem;
    }
    
    .container {
        padding: 0.5rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    .rating-buttons .col-6 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
    
    .player-card {
        padding: 0.5rem;
    }
    
    .player-avatar {
        width: 35px;
        height: 35px;
        margin-right: 0.75rem;
    }
    
    .intimacy-options {
        gap: 0.25rem;
    }
    
    .intimacy-tag {
        font-size: 0.75rem;
        padding: 0.2rem 0.5rem;
    }
}

/* Tablet adjustments */
@media (min-width: 768px) {
    :root {
        --dice-size: 200px;
        --avatar-size: 60px;
        --timer-size: 5rem;
    }
    
    .rating-buttons .col-md-4 {
        flex: 0 0 20%;
        max-width: 20%;
    }
}

/* Desktop adjustments */
@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
    
    .rating-buttons .col-lg-2 {
        flex: 0 0 10%;
        max-width: 10%;
    }
}

/* Admin panel specific styles */
.table-responsive {
    border-radius: 0.5rem;
    overflow: hidden;
}

.badge {
    font-size: 0.75em;
}

.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Animations for game state transitions */
.game-screen {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.game-screen.active {
    opacity: 1;
    transform: translateY(0);
}

/* Loading states */
.loading {
    pointer-events: none;
    opacity: 0.6;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1050;
    max-width: 300px;
    width: auto;
    background-color: #000 !important;
    color: #fff !important;
}

.toast .toast-body {
    padding: 0.5rem 0.75rem !important;
    color: #fff !important;
}

.toast .btn-close-white {
    filter: brightness(0) invert(1);
}

/* Flash alert messages - only for flash notifications */
.alert-dismissible {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1050;
    max-width: 300px;
    width: auto;
    background-color: #000 !important;
    color: #fff !important;
    border: none !important;
    padding: 0.5rem 2.5rem 0.5rem 0.75rem !important;
    margin: 0 !important;
}

.alert .btn-close {
    filter: brightness(0) invert(1);
    padding: 0.25rem;
    opacity: 0.8;
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .dice,
    .timer,
    .game-screen,
    .progress-bar {
        animation: none !important;
        transition: none !important;
    }
}

/* Focus states for better accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

/* Custom button styling */
.btn-outline-primary {
    border-color: #F57087 !important;
    color: #F57087 !important;
    background-color: transparent !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
    background-color: #F57087 !important;
    border-color: #F57087 !important;
    color: white !important;
}

.btn-info {
    background-color: #DE4763 !important;
    border-color: #F57087 !important;
    color: white !important;
}

.btn-info:hover,
.btn-info:focus,
.btn-info:active {
    background-color: #F57087 !important;
    border-color: #F57087 !important;
    color: white !important;
}

.btn-warning {
    background-color: transparent !important;
    border-color: #9063EA !important;
    color: #9063EA !important;
}

.btn-warning:hover,
.btn-warning:focus,
.btn-warning:active {
    background-color: #9063EA !important;
    border-color: #9063EA !important;
    color: white !important;
}

.btn-success {
    background-color: #6A2AC3 !important;
    border-color: #9A61EA !important;
    color: white !important;
}

.btn-success:hover,
.btn-success:focus,
.btn-success:active {
    background-color: #9A61EA !important;
    border-color: #9A61EA !important;
    color: white !important;
}

/* Dark theme specific adjustments */
[data-bs-theme="dark"] .dice {
    background: var(--bs-gray-900);
    border-color: var(--bs-primary);
}

[data-bs-theme="dark"] .player-card {
    background: var(--bs-gray-900);
    border-color: var(--bs-gray-700);
}

[data-bs-theme="dark"] .intimacy-player-card {
    background: var(--bs-gray-900);
    border-color: var(--bs-gray-700);
}

[data-bs-theme="dark"] .intimacy-tag {
    background: var(--bs-gray-800);
    border-color: var(--bs-gray-600);
    color: var(--bs-gray-200);
}

[data-bs-theme="dark"] .intimacy-tag:hover {
    border-color: #9063EA;
    background: #6E2DC9;
    color: white;
}

[data-bs-theme="dark"] .intimacy-tag.selected {
    background: #6E2DC9;
    border-color: #9063EA;
    color: white;
}

/* Remove rounded corners from all buttons */
.btn,
button,
.avatar-option,
.intimacy-tag,
.player-card,
.intimacy-player-card,
.card,
.dice,
.table-responsive,
.rating-buttons .btn {
    border-radius: 0 !important;
}

/* Home page vertical spacing */
.home-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.home-header {
    flex: 0 0 auto;
}

.home-logo {
    margin-bottom: 2rem;
}

.home-intro {
    margin-bottom: 0;
}
