/* Coin Flip Tool Styles - Completely Rewritten */

.coin-container {
    perspective: 1000px;
    width: 200px;
    height: 200px;
    margin: 30px auto;
    position: relative;
}

.coin {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
}

/* Idle state - gently rotate to show both sides */
.coin.idle {
    animation: gentle-spin 6s ease-in-out infinite;
}

@keyframes gentle-spin {
    0%, 100% {
        transform: rotateY(0deg);
    }
    25% {
        transform: rotateY(90deg);
    }
    50% {
        transform: rotateY(180deg);
    }
    75% {
        transform: rotateY(270deg);
    }
}

/* Flipping animation */
.coin.flipping {
    animation: coin-flip 1s ease-out forwards;
}

@keyframes coin-flip {
    0% {
        transform: rotateY(0deg) rotateX(0deg);
    }
    100% {
        transform: rotateY(1440deg) rotateX(360deg);
    }
}

/* Result states */
.coin.result-heads {
    transform: rotateY(0deg);
}

.coin.result-tails {
    transform: rotateY(180deg);
}

/* Coin faces */
.coin-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 8px solid #c9a13d;
}

.coin-heads {
    background: radial-gradient(circle at 40% 40%, #ffd700, #d4af37 40%, #b8941f);
    box-shadow: 
        0 0 20px rgba(212, 175, 55, 0.4),
        inset 0 0 30px rgba(255, 255, 255, 0.2),
        inset 0 0 10px rgba(0, 0, 0, 0.3);
}

.coin-tails {
    background: radial-gradient(circle at 40% 40%, #cbd5e0, #a0aec0 40%, #718096);
    transform: rotateY(180deg);
    box-shadow: 
        0 0 20px rgba(113, 128, 150, 0.4),
        inset 0 0 30px rgba(255, 255, 255, 0.2),
        inset 0 0 10px rgba(0, 0, 0, 0.3);
}

/* Coin content */
.coin-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 80%;
    height: 80%;
    border: 3px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.coin-letter {
    font-size: 70px;
    font-weight: 900;
    color: rgba(0, 0, 0, 0.4);
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.3),
        -1px -1px 2px rgba(255, 255, 255, 0.3);
    font-family: 'Georgia', serif;
}

.coin-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-top: 5px;
    color: rgba(0, 0, 0, 0.4);
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.3);
}

/* Stars decoration */
.coin-stars {
    position: absolute;
    width: 100%;
    height: 100%;
}

.star {
    position: absolute;
    width: 8px;
    height: 8px;
    background: rgba(0, 0, 0, 0.2);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.star:nth-child(1) { top: 10%; left: 50%; transform: translateX(-50%); }
.star:nth-child(2) { top: 50%; right: 10%; }
.star:nth-child(3) { bottom: 10%; left: 50%; transform: translateX(-50%); }
.star:nth-child(4) { top: 50%; left: 10%; }

/* Dark mode adjustments */
[data-bs-theme="dark"] .coin-letter,
[data-bs-theme="dark"] .coin-label {
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.5),
        -1px -1px 2px rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .coin-content {
    border-color: rgba(255, 255, 255, 0.2);
}

/* Stats Cards - New Compact Layout */
.stat-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px 15px;
    text-align: center;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

[data-bs-theme="dark"] .stat-card {
    background: #2d3239;
    border-color: #495057;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    font-family: 'Courier New', monospace;
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-percent {
    font-size: 11px;
    color: #28a745;
    font-weight: 600;
    opacity: 0.8;
}

.stat-subtitle {
    font-size: 10px;
    color: #6c757d;
    font-weight: 500;
    margin-top: 4px;
}

[data-bs-theme="dark"] .stat-label {
    color: #adb5bd;
}

[data-bs-theme="dark"] .stat-percent {
    color: #20c997;
}

[data-bs-theme="dark"] .stat-subtitle {
    color: #adb5bd;
}

/* Color variants for heads/tails */
.heads-color {
    color: #fd7e14 !important;
}

.tails-color {
    color: #6f42c1 !important;
}

[data-bs-theme="dark"] .heads-color {
    color: #ff922b !important;
}

[data-bs-theme="dark"] .tails-color {
    color: #9775fa !important;
}

/* Button states */
.toolBtn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.toolBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* History Table */
.history-table {
    margin-top: 20px;
    border-radius: 10px;
    overflow: hidden;
}

.history-table table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.history-table th,
.history-table td {
    padding: 14px;
    text-align: center;
}

.history-table th {
    background: #f1f3f5;
    font-weight: 600;
    color: #495057;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #dee2e6;
}

[data-bs-theme="dark"] .history-table th {
    background: #2d3239;
    color: #e9ecef;
    border-bottom-color: #495057;
}

.history-table tbody tr {
    border-bottom: 1px solid #e9ecef;
    transition: background 0.2s ease;
}

.history-table tbody tr:hover {
    background: #f8f9fa;
}

[data-bs-theme="dark"] .history-table tbody tr {
    border-bottom-color: #495057;
}

[data-bs-theme="dark"] .history-table tbody tr:hover {
    background: #343a40;
}

.result-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-badge.heads {
    background: linear-gradient(135deg, #ffd700, #d4af37);
    color: #5a4a1f;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.25);
}

.result-badge.tails {
    background: linear-gradient(135deg, #a0aec0, #718096);
    color: #1a202c;
    box-shadow: 0 2px 8px rgba(113, 128, 150, 0.25);
}

[data-bs-theme="dark"] .result-badge.heads {
    color: #fff;
}

[data-bs-theme="dark"] .result-badge.tails {
    color: #fff;
}

/* Result Announcement */
.result-announcement {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #1a1a1a, #2d2d2d);
    color: #fff;
    padding: 35px 70px;
    border-radius: 25px;
    font-size: 52px;
    font-weight: 800;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    animation: show-result 2.5s ease-in-out;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
    border: 3px solid rgba(255, 255, 255, 0.15);
    text-transform: uppercase;
    letter-spacing: 3px;
}

.result-announcement.heads-result {
    background: linear-gradient(135deg, #ffd700, #d4af37);
    color: #5a4a1f;
    border-color: rgba(255, 255, 255, 0.4);
}

.result-announcement.tails-result {
    background: linear-gradient(135deg, #a0aec0, #718096);
    color: #1a202c;
    border-color: rgba(255, 255, 255, 0.3);
}

@keyframes show-result {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3) rotate(-15deg);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.15) rotate(8deg);
    }
    40% {
        transform: translate(-50%, -50%) scale(0.95) rotate(-4deg);
    }
    60% {
        transform: translate(-50%, -50%) scale(1.05) rotate(2deg);
    }
    75% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.7) rotate(0deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .coin-container {
        width: 170px;
        height: 170px;
    }
    
    .coin-letter {
        font-size: 60px;
    }
    
    .coin-label {
        font-size: 10px;
    }
    
    .stat-value {
        font-size: 28px;
    }
    
    .stat-percent {
        font-size: 10px;
    }
    
    .stat-subtitle {
        font-size: 9px;
    }
    
    .result-announcement {
        font-size: 38px;
        padding: 25px 50px;
    }
}

@media (max-width: 480px) {
    .coin-container {
        width: 150px;
        height: 150px;
    }
    
    .coin-letter {
        font-size: 50px;
    }
    
    .coin-label {
        font-size: 9px;
    }
    
    .stat-card {
        padding: 14px;
    }
    
    .result-announcement {
        font-size: 32px;
        padding: 20px 40px;
    }
}