/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Screens */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Cards */
.card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    width: 100%;
    margin-bottom: 10px;
}

.btn i {
    margin-right: 8px;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
}

.btn-small {
    padding: 8px 12px;
    font-size: 14px;
    width: auto;
    margin: 0;
}

/* Divider */
.divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e1e5e9;
}

.divider span {
    background: white;
    padding: 0 15px;
    color: #666;
    font-size: 14px;
}

/* Game Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.game-info h2 {
    color: #333;
    margin-bottom: 5px;
}

.game-info p {
    color: #666;
    font-size: 14px;
}

/* Bank Section */
.bank-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.bank-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.bank-card h3 {
    color: #555;
    margin-bottom: 10px;
    font-size: 14px;
}

.bank-card h3 i {
    margin-right: 5px;
}

.balance {
    font-size: 1.5rem;
    font-weight: bold;
    color: #28a745;
}

/* Players Section */
.players-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-header h3 {
    color: #333;
    font-size: 18px;
}

.players-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.player-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.player-info {
    flex: 1;
}

.player-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

.player-balance {
    color: #28a745;
    font-weight: bold;
}

.player-actions {
    display: flex;
    gap: 5px;
}

.action-icon {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.3s ease;
}

.action-icon.send {
    background: #28a745;
    color: white;
}

.action-icon.send:hover {
    background: #218838;
}

.action-icon.receive {
    background: #17a2b8;
    color: white;
}

.action-icon.receive:hover {
    background: #138496;
}

.action-icon.bank {
    background: #ffc107;
    color: #333;
}

.action-icon.bank:hover {
    background: #e0a800;
}

/* Dice Section */
.dice-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.dice-section h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 18px;
}

.dice-container {
    text-align: center;
}

.dice-wrapper {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.dice {
    width: 60px;
    height: 60px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
    cursor: pointer;
    transform: rotateX(0deg) rotateY(0deg);
}

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

@keyframes rollDice {
    0% { transform: rotateX(0deg) rotateY(0deg); }
    25% { transform: rotateX(90deg) rotateY(180deg); }
    50% { transform: rotateX(180deg) rotateY(360deg); }
    75% { transform: rotateX(270deg) rotateY(540deg); }
    100% { transform: rotateX(360deg) rotateY(720deg); }
}

.dice-face {
    position: absolute;
    width: 60px;
    height: 60px;
    background: white;
    border: 2px solid #333;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    backface-visibility: hidden;
}

/* 3D cube faces */
.dice-face[data-value="1"] { transform: translateZ(30px); }
.dice-face[data-value="2"] { transform: rotateY(90deg) translateZ(30px); }
.dice-face[data-value="3"] { transform: rotateY(180deg) translateZ(30px); }
.dice-face[data-value="4"] { transform: rotateY(-90deg) translateZ(30px); }
.dice-face[data-value="5"] { transform: rotateX(90deg) translateZ(30px); }
.dice-face[data-value="6"] { transform: rotateX(-90deg) translateZ(30px); }

/* Show all faces for 3D effect */
.dice-face {
    display: flex;
}

.dot {
    width: 8px;
    height: 8px;
    background: #333;
    border-radius: 50%;
    position: absolute;
}

.dot.center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.dot.top-left {
    top: 15%;
    left: 15%;
}

.dot.top-right {
    top: 15%;
    right: 15%;
}

.dot.middle-left {
    top: 50%;
    left: 15%;
    transform: translateY(-50%);
}

.dot.middle-right {
    top: 50%;
    right: 15%;
    transform: translateY(-50%);
}

.dot.bottom-left {
    bottom: 15%;
    left: 15%;
}

.dot.bottom-right {
    bottom: 15%;
    right: 15%;
}

.dice-total {
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: bold;
}

.total-label {
    color: #666;
    margin-right: 10px;
}

.total-value {
    color: #667eea;
    font-size: 24px;
}

#roll-dice-btn {
    width: auto;
    padding: 12px 24px;
    margin: 0;
}

#roll-dice-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Quick Actions */
.quick-actions {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.quick-actions h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 18px;
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: #f8f9fa;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.action-btn:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.action-btn i {
    margin-right: 8px;
    color: #667eea;
}

/* Transactions */
.transactions-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.transactions-section h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 18px;
}

.transactions-list {
    max-height: 300px;
    overflow-y: auto;
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #e1e5e9;
    font-size: 14px;
}

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

.transaction-info {
    flex: 1;
}

.transaction-description {
    color: #333;
    font-weight: 500;
    margin-bottom: 2px;
}

.transaction-details {
    color: #666;
    font-size: 12px;
}

.transaction-amount {
    font-weight: bold;
    color: #28a745;
}

.transaction-amount.negative {
    color: #dc3545;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    padding: 20px;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 0;
}

.modal-header h3 {
    color: #333;
    font-size: 18px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 0 20px 20px;
}

.modal-footer .btn {
    flex: 1;
    margin: 0;
}

/* Transaction Players */
.transaction-players {
    margin-top: 15px;
}

.player-option {
    display: flex;
    align-items: center;
    padding: 10px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.player-option:hover {
    border-color: #667eea;
    background: #f8f9fa;
}

.player-option.selected {
    border-color: #667eea;
    background: #e3f2fd;
}

.player-option input[type="radio"] {
    margin-right: 10px;
}

/* Loading */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: white;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

/* Responsive Design */
@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .bank-section {
        grid-template-columns: 1fr;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .modal {
        padding: 10px;
    }
}

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

.card, .player-card, .transaction-item {
    animation: slideIn 0.3s ease;
}

/* Success/Error Messages */
.message {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-weight: 500;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
