/**
 * CSS personalizzato per Tavola Condivisa
 * Autore: Matteo Morreale
 */

/* Variabili CSS personalizzate */
:root {
    --primary-color: #11436d;
    --primary-dark: #1565c0;
    --primary-light: #42a5f5;
    --accent-color: #ff5722;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --error-color: #f44336;
    --text-primary: #212121;
    --text-secondary: #757575;
    --divider-color: #bdbdbd;
    --background-color: #fafafa;
}

/* Reset e base */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Layout principale */
main {
    flex: 1 0 auto;
    min-height: calc(100vh - 64px - 100px); /* navbar + footer */
}

.full-height {
    min-height: 100vh;
}

.no-padding {
    padding: 0 !important;
}

.no-margin {
    margin: 0 !important;
}

/* Navbar personalizzazioni */
nav .brand-logo {
    font-weight: 500;
    font-size: 1.8rem;
}

nav .brand-logo i {
    font-size: 1.8rem;
    margin-right: 8px;
}

/* Cards migliorati */
.card {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.card .card-title {
    font-weight: 500;
    color: var(--text-primary);
}

.card .card-content {
    padding: 24px;
}

.card .card-action {
    padding: 16px 24px;
    border-top: 1px solid var(--divider-color);
}

/* Bottoni personalizzati */
.btn, .btn-large, .btn-small {
    border-radius: 4px;
    text-transform: none;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.btn:hover, .btn-large:hover, .btn-small:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    transform: translateY(-1px);
}

.btn-floating {
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-floating:hover {
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
    transform: translateY(-2px);
}

/* Form migliorati */
.input-field {
    margin-bottom: 24px;
}

.input-field input[type=text]:focus + label,
.input-field input[type=email]:focus + label,
.input-field input[type=password]:focus + label,
.input-field textarea:focus + label {
    color: var(--primary-color) !important;
}

.input-field input[type=text]:focus,
.input-field input[type=email]:focus,
.input-field input[type=password]:focus,
.input-field textarea:focus {
    border-bottom: 1px solid var(--primary-color) !important;
    box-shadow: 0 1px 0 0 var(--primary-color) !important;
}

/* Auth pages */
.auth-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 40px 20px;
}

.auth-card {
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.auth-title {
    text-align: center;
    margin-bottom: 32px;
    font-weight: 300;
    color: var(--text-primary);
}

.auth-divider {
    text-align: center;
    margin: 24px 0;
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--divider-color);
}

.auth-divider span {
    background: white;
    padding: 0 16px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.google-btn {
    background: white !important;
    color: #757575 !important;
    border: 1px solid #dadce0;
    box-shadow: none;
    text-transform: none;
    font-weight: 500;
}

/* Floating Language Selector */
.floating-language-selector {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.language-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 24px;
}

.language-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.language-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1001;
    align-items: center;
    justify-content: center;
}

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

.language-modal-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.language-modal h5 {
    margin: 0 0 20px 0;
    color: #424242;
    font-weight: 500;
    text-align: center;
}

.language-options {
    display: grid;
    gap: 8px;
}

.language-option {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f8f9fa;
}

.language-option:hover {
    background: #e3f2fd;
    border-color: #2196f3;
}

.language-option.active {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #11436d;
}

.language-flag {
    font-size: 24px;
    margin-right: 12px;
    width: 32px;
    text-align: center;
}

.language-name {
    font-weight: 500;
    flex: 1;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #757575;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.modal-close:hover {
    background: #f5f5f5;
}

/* Old language selector - hide on auth pages */
.auth-page .language-selector {
    display: none;
}

.language-selector {
    margin-bottom: 20px;
}

.language-selector .input-field {
    margin: 0;
}

.language-selector select {
    background-color: transparent;
    border: none;
    border-bottom: 1px solid #9e9e9e;
    border-radius: 0;
    outline: none;
    height: 3rem;
    line-height: 3rem;
    width: 100%;
    font-size: 1rem;
    margin: 0 0 8px 0;
    padding: 0;
    display: block;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.language-selector label {
    color: #9e9e9e;
    position: absolute;
    top: 0;
    left: 0;
    font-size: 1rem;
    cursor: text;
    -webkit-transition: color .2s ease-out, -webkit-transform .2s ease-out;
    transition: color .2s ease-out, -webkit-transform .2s ease-out;
    transition: transform .2s ease-out, color .2s ease-out;
    transition: transform .2s ease-out, color .2s ease-out, -webkit-transform .2s ease-out;
    -webkit-transform-origin: 0% 100%;
    transform-origin: 0% 100%;
    text-align: initial;
    -webkit-transform: translateY(12px);
    transform: translateY(12px);
    cursor: pointer;
}

.google-btn:hover {
    background: #f8f9fa !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.google-btn i {
    color: #4285f4;
    margin-right: 8px;
}

/* Dashboard */
.dashboard-stats {
    margin-bottom: 32px;
}

.stat-card {
    text-align: center;
    padding: 24px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    box-shadow: 0 4px 16px rgba(25, 118, 210, 0.3);
}

.stat-card .stat-number {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 8px;
}

.stat-card .stat-label {
    font-size: 1rem;
    opacity: 0.9;
}

.stat-card.success {
    background: linear-gradient(135deg, var(--success-color), #66bb6a);
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.3);
}

.stat-card.warning {
    background: linear-gradient(135deg, var(--warning-color), #ffb74d);
    box-shadow: 0 4px 16px rgba(255, 152, 0, 0.3);
}

.stat-card.error {
    background: linear-gradient(135deg, var(--error-color), #ef5350);
    box-shadow: 0 4px 16px rgba(244, 67, 54, 0.3);
}

/* Room list */
.room-card {
    margin-bottom: 16px;
    transition: all 0.3s ease;
}

.room-card:hover {
    transform: translateY(-2px);
}

.room-identifier {
    font-family: 'Courier New', monospace;
    background: #f5f5f5;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.room-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.room-meta i {
    font-size: 1rem;
}

/* Tavola (Room view) */
.room-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.room-toolbar {
    background: white;
    border-bottom: 1px solid var(--divider-color);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 100;
}

.room-content {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

.room-sidebar {
    width: 300px;
    background: white;
    border-right: 1px solid var(--divider-color);
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
    z-index: 50;
}

.room-sidebar.collapsed {
    width: 0;
    overflow: hidden;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--divider-color);
    background: #f8f9fa;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.room-board {
    flex: 1;
    position: relative;
    background: #ffffff;
    background-image: 
        linear-gradient(rgba(0,0,0,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.05) 1px, transparent 1px);
    background-size: 20px 20px;
    overflow: hidden;
    cursor: grab;
}

.room-board.dragging {
    cursor: grabbing;
}

.room-board-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-origin: 0 0;
    transition: transform 0.1s ease;
}

/* Pedine */
.pawn {
    position: absolute;
    cursor: move;
    user-select: none;
    transition: all 0.2s ease;
    z-index: 10;
}

.pawn:hover {
    transform: scale(1.1);
    z-index: 20;
}

.pawn.dragging {
    z-index: 30;
    transform: scale(1.2);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.pawn-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.pawn-image {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    background-size: cover;
    background-position: center;
}

.pawn-label {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.pawn:hover .pawn-label {
    opacity: 1;
}

/* Pulsante di cancellazione pedina */
.pawn-delete-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: var(--error-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
    z-index: 25;
    line-height: 1;
    user-select: none;
}

.pawn-delete-btn:hover {
    background: #d32f2f;
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0,0,0,0.4);
}

/* Participants list */
.participant-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.participant-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.participant-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 0.9rem;
}

.participant-role {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.participant-role.admin {
    color: var(--error-color);
    font-weight: 500;
}

.participant-role.participant {
    color: var(--success-color);
    font-weight: 500;
}

/* Lista pedine nella sidebar */
.pawns-count {
    background: #4caf50;
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.8rem;
}

.pawns-list {
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden; /* Previene barra di scorrimento orizzontale */
}

.pawn-list-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
    min-width: 0; /* Permette al flex di ridursi */
}

.pawn-list-item:hover {
    background-color: #f8f9fa;
    border-radius: 4px;
    margin: 0 -8px;
    padding: 8px;
    cursor: pointer;
}

.pawn-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.pawn-list-label {
    font-weight: 500;
    color: #424242;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.pawn-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s ease;
    align-items: flex-end;
    flex-shrink: 0;
}

.pawn-actions .action-buttons {
    display: flex;
    gap: 4px;
}

.pawn-list-item:hover .pawn-actions {
    opacity: 1;
}

.pawn-actions .token-controls {
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(0,0,0,0.05);
    border-radius: 4px;
    padding: 2px;
}

.pawn-actions .token-controls button {
    min-width: 24px;
    height: 24px;
    padding: 0;
    line-height: 24px;
    border-radius: 2px;
}

.pawn-actions .token-controls button i {
    font-size: 14px;
}

.pawn-actions .token-value {
    min-width: 20px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 500;
    color: #424242;
}

.pawn-actions > button {
    min-width: 28px;
    height: 28px;
    padding: 0;
    line-height: 28px;
}

.pawn-actions > button i {
    font-size: 16px;
}

/* Pawns palette */
.pawns-palette {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-direction: column;
}

.palette-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.palette-category h6 {
    margin: 8px 0 4px 0;
    font-size: 0.9rem;
    color: #424242;
    font-weight: 500;
}

.palette-pawn {
    width: 60px;
    height: 80px;
    border: 2px solid var(--divider-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    padding: 4px;
    gap: 4px;
}

.palette-pawn:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.palette-pawn.selected {
    border-color: var(--primary-color);
    background: var(--primary-light);
    color: white;
}

.palette-pawn-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid white;
}

.palette-pawn-image {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    border: 2px solid white;
    flex-shrink: 0;
}

.palette-pawn-label {
    font-size: 0.7rem;
    color: #424242;
    text-align: center;
    line-height: 1;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Admin panel */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.admin-table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.admin-table table {
    margin: 0;
}

.admin-table th {
    background: #f8f9fa;
    font-weight: 500;
    color: var(--text-primary);
}

/* Responsive */
@media only screen and (max-width: 992px) {
    .room-sidebar {
        position: absolute;
        left: -300px;
        height: 100%;
        transition: left 0.3s ease;
    }
    
    .room-sidebar.open {
        left: 0;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media only screen and (max-width: 600px) {
    .auth-card {
        padding: 24px;
        margin: 16px;
    }
    
    .room-toolbar {
        padding: 8px 12px;
    }
    
    .room-toolbar .btn {
        padding: 0 12px;
    }
    
    .pawns-palette {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    }
    
    .palette-pawn {
        width: 50px;
        height: 50px;
    }
}

/* Animazioni */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.slide-in {
    animation: slideIn 0.3s ease;
}

.pulse {
    animation: pulse 2s infinite;
}

/* Utility classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px !important; }
.mt-2 { margin-top: 16px !important; }
.mt-3 { margin-top: 24px !important; }
.mt-4 { margin-top: 32px !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px !important; }
.mb-2 { margin-bottom: 16px !important; }
.mb-3 { margin-bottom: 24px !important; }
.mb-4 { margin-bottom: 32px !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: 8px !important; }
.p-2 { padding: 16px !important; }
.p-3 { padding: 24px !important; }
.p-4 { padding: 32px !important; }

.elevation-1 { box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.elevation-2 { box-shadow: 0 4px 8px rgba(0,0,0,0.15); }
.elevation-3 { box-shadow: 0 8px 16px rgba(0,0,0,0.2); }
.elevation-4 { box-shadow: 0 12px 24px rgba(0,0,0,0.25); }

/* Loading spinner */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

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

/* Toast personalizzati */
.toast {
    border-radius: 4px;
    font-weight: 500;
}

.toast.success {
    background-color: var(--success-color);
}

.toast.error {
    background-color: var(--error-color);
}

.toast.warning {
    background-color: var(--warning-color);
}

/* Modale selezione pedine */
.pawn-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
}

.pawn-selection-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.pawn-selection-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.pawn-selection-item.selected {
    border-color: var(--primary-color);
    background-color: #e3f2fd;
}

.pawn-selection-preview {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.pawn-selection-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.pawn-selection-label {
    font-size: 12px;
    text-align: center;
    color: var(--text-primary);
    font-weight: 500;
}

.no-pawns-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-style: italic;
    background: #f5f5f5;
    border-radius: 8px;
    border: 2px dashed #ddd;
}

/* Floating Dice Button */
.dice-floating-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #8e24aa, #5e35b1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    z-index: 1000;
    color: white;
    font-size: 24px;
}

.dice-floating-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
    background: linear-gradient(135deg, #9c27b0, #673ab7);
}

.dice-floating-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Dice Modal */
.dice-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

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

.dice-modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dice-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dice-modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.dice-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.dice-modal-close:hover {
    background: #f5f5f5;
    color: var(--text-primary);
}

.dice-modal-body {
    padding: 24px;
}

/* Dice Roll Interface */
.dice-roll-section {
    margin-bottom: 30px;
}

.dice-roll-section h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.dice-input-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.dice-input {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    width: 120px;
    transition: border-color 0.2s ease;
}

.dice-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.dice-type-select {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.dice-type-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.dice-roll-btn {
    background: linear-gradient(135deg, #4caf50, #388e3c);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.dice-roll-btn:hover {
    background: linear-gradient(135deg, #66bb6a, #4caf50);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

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

/* Dice History */
.dice-history {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
}

.dice-history-item {
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
    background: white;
    margin-bottom: 1px;
}

.dice-history-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.dice-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.dice-history-user {
    font-weight: 600;
    color: var(--primary-color);
}

.dice-history-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.dice-history-formula {
    font-family: 'Courier New', monospace;
    background: #f5f5f5;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 4px;
    display: inline-block;
}

.dice-history-result {
    font-weight: 600;
    font-size: 16px;
    color: var(--success-color);
}

.dice-history-details {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Dice Result Popup */
.dice-result-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    z-index: 3000;
    text-align: center;
    min-width: 300px;
    animation: popupBounceIn 0.5s ease;
}

@keyframes popupBounceIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.dice-result-user {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.dice-result-formula {
    font-family: 'Courier New', monospace;
    background: #f5f5f5;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 12px;
    display: inline-block;
}

.dice-result-value {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 8px;
}

.dice-result-value.critical-success {
    color: #4caf50;
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.dice-result-value.critical-failure {
    color: #f44336;
    text-shadow: 0 0 10px rgba(244, 67, 54, 0.5);
}

.dice-result-value.normal {
    color: var(--primary-color);
}

.dice-result-text {
    font-size: 16px;
    font-weight: 600;
    margin-top: 8px;
}

.dice-result-text.critical-success {
    color: #4caf50;
}

.dice-result-text.critical-failure {
    color: #f44336;
}

.dice-result-details {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Override per classi Materialize blue */
.blue.darken-2 {
    background-color: #11436d !important;
}

.blue {
    background-color: #11436d !important;
}
