/* Yatzy Game Styles */

.dice-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 15px 0;
}

.dice-item {
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 5px;
    border-radius: 8px;
    border: 2px solid transparent;
    touch-action: manipulation; /* Better touch handling */
}

.dice-item:hover {
    border-color: #007bff;
    transform: scale(1.05);
}

.dice-item.held {
    border-color: #28a745;
    background-color: #d4edda;
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.3);
}

.dice-face {
    width: 60px;
    height: 60px;
    background: white;
    border: 2px solid #333;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.dice-item:hover .dice-face {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.held-indicator {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    background: #28a745;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 12px;
    white-space: nowrap;
}

.camera-container {
    text-align: center;
    margin: 20px 0;
}

.camera-container video {
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Score card enhancements */
.table td, .table th {
    vertical-align: middle;
}

.btn-outline-success {
    white-space: nowrap;
}

/* Animation for dice roll */
@keyframes diceRoll {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(90deg); }
    50% { transform: rotate(180deg); }
    75% { transform: rotate(270deg); }
}

.dice-rolling {
    animation: diceRoll 0.5s ease-in-out;
}

/* Game status indicators */
.alert {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    margin-bottom: 20px;
}

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0 !important;
    border: none;
}

.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Loading spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Table improvements */
.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

.table-info {
    background-color: #d1ecf1 !important;
}

.table-success {
    background-color: #d4edda !important;
    font-size: 1.1rem;
}

/* Container improvements */
.container-fluid {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== MOBILE RESPONSIVENESS ===== */

/* Tablets and below (landscape) */
@media (max-width: 991px) {
    .container-fluid {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.75rem !important;
    }
    
    .card-header h5 {
        font-size: 1rem;
    }
}

/* Mobile devices */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    .container-fluid {
        padding: 10px;
    }
    
    h1 {
        font-size: 1.5rem !important;
        margin-bottom: 1rem !important;
    }
    
    /* Dice adjustments */
    .dice-container {
        gap: 6px;
        margin: 10px 0;
    }
    
    .dice-face {
        width: 55px;
        height: 55px;
        font-size: 30px;
    }
    
    .dice-item {
        padding: 3px;
    }
    
    .held-indicator {
        font-size: 9px;
        padding: 1px 6px;
        top: -6px;
    }
    
    /* Camera section */
    .camera-container {
        margin: 15px 0;
    }
    
    .camera-container video {
        max-width: 100%;
        width: 100% !important;
    }
    
    /* Buttons - make them stack better */
    .btn {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
        margin-bottom: 0.5rem;
    }
    
    .btn-sm {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
    
    /* Button groups */
    .mb-3 {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .mb-3 .btn {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 120px;
        margin: 0 !important;
    }
    
    /* Cards */
    .card {
        margin-bottom: 15px;
        border-radius: 8px;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
        border-radius: 8px 8px 0 0 !important;
    }
    
    .card-header h5 {
        font-size: 0.95rem;
        margin: 0;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Alerts */
    .alert {
        font-size: 0.85rem;
        padding: 0.75rem;
        margin-top: 1rem !important;
    }
    
    .alert ul {
        margin-bottom: 0;
        padding-left: 1.25rem;
    }
    
    .alert li {
        margin-bottom: 0.25rem;
    }
    
    .alert small {
        font-size: 0.75rem;
    }
    
    /* Tables - make them more compact */
    .table {
        font-size: 0.85rem;
    }
    
    .table td, .table th {
        padding: 0.5rem 0.25rem;
    }
    
    .table-responsive {
        margin-bottom: 0;
    }
    
    .table-success {
        font-size: 0.95rem;
    }
    
    /* Score buttons in table */
    .table .btn-outline-success {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
        white-space: nowrap;
    }
    
    /* Game status row */
    .row.mb-3 .col-6 {
        font-size: 0.9rem;
    }
}

/* Small phones */
@media (max-width: 576px) {
    h1 {
        font-size: 1.25rem !important;
    }
    
    /* Make dice smaller on very small screens */
    .dice-face {
        width: 50px;
        height: 50px;
        font-size: 28px;
    }
    
    /* Stack buttons vertically on very small screens */
    .mb-3 .btn {
        flex: 1 1 100%;
        min-width: 100%;
    }
    
    /* Compact card headers */
    .card-header {
        padding: 0.5rem 0.75rem;
    }
    
    .card-header h5 {
        font-size: 0.875rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    /* Smaller table text */
    .table {
        font-size: 0.8rem;
    }
    
    .table td, .table th {
        padding: 0.4rem 0.2rem;
    }
    
    .table .btn-outline-success {
        font-size: 0.65rem;
        padding: 0.15rem 0.3rem;
    }
    
    /* Compact status display */
    .row.mb-3 {
        margin-bottom: 0.5rem !important;
    }
    
    .row.mb-3 .col-6 {
        font-size: 0.85rem;
        padding: 0.25rem;
    }
}

/* Landscape orientation on phones */
@media (max-width: 896px) and (orientation: landscape) {
    .container-fluid {
        padding: 10px;
    }
    
    .card {
        margin-bottom: 10px;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    h1 {
        font-size: 1.25rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .alert {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .dice-face {
        width: 45px;
        height: 45px;
        font-size: 24px;
    }
}

/* Improve touch targets on all mobile devices */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px; /* iOS recommended touch target */
    }
    
    .dice-item {
        min-width: 60px;
        min-height: 60px;
    }
    
    .table .btn-outline-success {
        min-height: 36px;
        padding: 0.25rem 0.5rem;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .dice-face {
        border-width: 1.5px;
    }
}