/* Coin Flip Tool Styles - Premium Redesign */

/* Coin Type Selector */
.coin-selector {
    text-align: center;
}

.coin-type-options {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.coin-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
}

.coin-type-btn:hover {
    border-color: #adb5bd;
    transform: translateY(-2px);
}

.coin-type-btn.active {
    border-color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.1);
    box-shadow: 0 4px 12px rgba(var(--bs-primary-rgb), 0.2);
}

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

[data-bs-theme="dark"] .coin-type-btn:hover {
    border-color: #6c757d;
}

[data-bs-theme="dark"] .coin-type-btn.active {
    border-color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.2);
}

.coin-preview {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid rgba(0,0,0,0.2);
}

.coin-preview.gold {
    background: linear-gradient(135deg, #ffd700 0%, #ffec80 25%, #d4af37 50%, #b8941f 75%, #ffd700 100%);
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.4);
}

.coin-preview.silver {
    background: linear-gradient(135deg, #e8e8e8 0%, #ffffff 25%, #c0c0c0 50%, #a8a8a8 75%, #e8e8e8 100%);
    box-shadow: 0 2px 8px rgba(192, 192, 192, 0.4);
}

.coin-preview.bronze {
    background: linear-gradient(135deg, #cd7f32 0%, #e8a862 25%, #b87333 50%, #a0522d 75%, #cd7f32 100%);
    box-shadow: 0 2px 8px rgba(205, 127, 50, 0.4);
}

.coin-type-label {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
}

[data-bs-theme="dark"] .coin-type-label {
    color: #e9ecef;
}

/* Coin Wrapper & Glow */
.coin-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
}

.coin-glow {
    position: absolute;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, transparent 70%);
    filter: blur(20px);
    opacity: 0.6;
    transition: all 0.5s ease;
    pointer-events: none;
}

.coin.silver ~ .coin-glow,
.coin-wrapper:has(.coin.silver) .coin-glow {
    background: radial-gradient(circle, rgba(192, 192, 192, 0.4) 0%, transparent 70%);
}

.coin-wrapper:has(.coin.bronze) .coin-glow {
    background: radial-gradient(circle, rgba(205, 127, 50, 0.4) 0%, transparent 70%);
}

.coin.flipping ~ .coin-glow,
.coin-wrapper:has(.coin.flipping) .coin-glow {
    animation: glow-pulse 0.3s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

/* Coin Container */
.coin-container {
    perspective: 1000px;
    width: 200px;
    height: 200px;
    position: relative;
    z-index: 2;
}

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

/* Coin Face Base */
.coin-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.coin-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Coin Rim - Ridged Edge Effect */
.coin-rim {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 8px solid transparent;
    background:
        linear-gradient(90deg,
            rgba(0,0,0,0.3) 0%,
            rgba(255,255,255,0.3) 25%,
            rgba(0,0,0,0.3) 50%,
            rgba(255,255,255,0.3) 75%,
            rgba(0,0,0,0.3) 100%
        );
    background-size: 10px 100%;
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    box-sizing: border-box;
}

/* Gold Coin */
.coin.gold .coin-heads .coin-inner {
    background:
        radial-gradient(ellipse at 30% 30%, rgba(255,255,255,0.4) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, #ffd700 0%, #d4af37 40%, #b8941f 70%, #8b7355 100%);
    box-shadow:
        inset 0 0 40px rgba(0,0,0,0.3),
        inset 0 0 10px rgba(255,255,255,0.2),
        0 10px 30px rgba(0,0,0,0.3),
        0 0 60px rgba(255,215,0,0.3);
    border: 4px solid #c9a13d;
}

.coin.gold .coin-tails .coin-inner {
    background:
        radial-gradient(ellipse at 30% 30%, rgba(255,255,255,0.4) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, #ffd700 0%, #d4af37 40%, #b8941f 70%, #8b7355 100%);
    box-shadow:
        inset 0 0 40px rgba(0,0,0,0.3),
        inset 0 0 10px rgba(255,255,255,0.2),
        0 10px 30px rgba(0,0,0,0.3),
        0 0 60px rgba(255,215,0,0.3);
    border: 4px solid #c9a13d;
}

.coin.gold .coin-svg {
    color: #5c4a1f;
}

/* Silver Coin */
.coin.silver .coin-heads .coin-inner {
    background:
        radial-gradient(ellipse at 30% 30%, rgba(255,255,255,0.6) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, #f0f0f0 0%, #c0c0c0 40%, #a8a8a8 70%, #808080 100%);
    box-shadow:
        inset 0 0 40px rgba(0,0,0,0.2),
        inset 0 0 10px rgba(255,255,255,0.4),
        0 10px 30px rgba(0,0,0,0.3),
        0 0 60px rgba(192,192,192,0.3);
    border: 4px solid #a0a0a0;
}

.coin.silver .coin-tails .coin-inner {
    background:
        radial-gradient(ellipse at 30% 30%, rgba(255,255,255,0.6) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, #f0f0f0 0%, #c0c0c0 40%, #a8a8a8 70%, #808080 100%);
    box-shadow:
        inset 0 0 40px rgba(0,0,0,0.2),
        inset 0 0 10px rgba(255,255,255,0.4),
        0 10px 30px rgba(0,0,0,0.3),
        0 0 60px rgba(192,192,192,0.3);
    border: 4px solid #a0a0a0;
}

.coin.silver .coin-svg {
    color: #4a4a4a;
}

/* Bronze Coin */
.coin.bronze .coin-heads .coin-inner {
    background:
        radial-gradient(ellipse at 30% 30%, rgba(255,255,255,0.3) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, #cd7f32 0%, #b87333 40%, #a0522d 70%, #8b4513 100%);
    box-shadow:
        inset 0 0 40px rgba(0,0,0,0.3),
        inset 0 0 10px rgba(255,255,255,0.15),
        0 10px 30px rgba(0,0,0,0.3),
        0 0 60px rgba(205,127,50,0.3);
    border: 4px solid #8b6914;
}

.coin.bronze .coin-tails .coin-inner {
    background:
        radial-gradient(ellipse at 30% 30%, rgba(255,255,255,0.3) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, #cd7f32 0%, #b87333 40%, #a0522d 70%, #8b4513 100%);
    box-shadow:
        inset 0 0 40px rgba(0,0,0,0.3),
        inset 0 0 10px rgba(255,255,255,0.15),
        0 10px 30px rgba(0,0,0,0.3),
        0 0 60px rgba(205,127,50,0.3);
    border: 4px solid #8b6914;
}

.coin.bronze .coin-svg {
    color: #3d2914;
}

/* Coin Design Area */
.coin-design {
    width: 85%;
    height: 85%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coin-svg {
    width: 100%;
    height: 100%;
}

/* Coin Text */
.coin-text {
    position: absolute;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 3px;
    opacity: 0.5;
    text-transform: uppercase;
}

.coin-text-top {
    top: 8%;
}

.coin-text-bottom {
    bottom: 8%;
}

.coin.gold .coin-text { color: #5c4a1f; }
.coin.silver .coin-text { color: #4a4a4a; }
.coin.bronze .coin-text { color: #3d2914; }

/* Shine Effect */
.coin-shine {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(
        135deg,
        rgba(255,255,255,0.4) 0%,
        rgba(255,255,255,0.1) 30%,
        transparent 50%,
        rgba(0,0,0,0.1) 70%,
        rgba(0,0,0,0.2) 100%
    );
    pointer-events: none;
}

/* Tails Face Rotation */
.coin-tails {
    transform: rotateY(180deg);
}

/* Idle Animation - Rotate 360 to show both faces */
.coin.idle {
    animation: gentle-rotate 6s linear infinite;
}

@keyframes gentle-rotate {
    0% {
        transform: rotateY(0deg);
    }
    100% {
        transform: rotateY(360deg);
    }
}

/* Flipping Animation - Smooth Y rotation only */
.coin.flipping {
    animation: coin-flip 1.2s ease-out forwards;
}

@keyframes coin-flip {
    0% {
        transform: rotateY(0deg) translateY(0);
    }
    50% {
        transform: rotateY(900deg) translateY(-60px);
    }
    100% {
        transform: rotateY(1800deg) translateY(0);
    }
}

/* Result States */
.coin.result-heads {
    transform: rotateY(0deg);
    animation: land-bounce-heads 0.4s ease-out;
}

.coin.result-tails {
    transform: rotateY(180deg);
    animation: land-bounce-tails 0.4s ease-out;
}

@keyframes land-bounce-heads {
    0% { transform: rotateY(0deg) translateY(-15px); }
    60% { transform: rotateY(0deg) translateY(3px); }
    100% { transform: rotateY(0deg) translateY(0); }
}

@keyframes land-bounce-tails {
    0% { transform: rotateY(180deg) translateY(-15px); }
    60% { transform: rotateY(180deg) translateY(3px); }
    100% { transform: rotateY(180deg) translateY(0); }
}

/* Confetti Container */
.confetti-container {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300px;
    height: 300px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10;
    overflow: visible;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0;
}

.confetti.circle {
    border-radius: 50%;
}

.confetti.square {
    border-radius: 2px;
}

.confetti.star {
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

@keyframes confetti-fall {
    0% {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) rotate(var(--rot)) scale(0.5);
    }
}

/* Stats Cards */
.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-glow {
        width: 240px;
        height: 240px;
    }

    .coin-text {
        font-size: 8px;
        letter-spacing: 2px;
    }

    .stat-value {
        font-size: 28px;
    }

    .stat-percent {
        font-size: 10px;
    }

    .stat-subtitle {
        font-size: 9px;
    }

    .result-announcement {
        font-size: 38px;
        padding: 25px 50px;
    }

    .coin-type-btn {
        padding: 10px 16px;
    }

    .coin-preview {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 480px) {
    .coin-container {
        width: 150px;
        height: 150px;
    }

    .coin-glow {
        width: 200px;
        height: 200px;
    }

    .coin-text {
        font-size: 7px;
    }

    .stat-card {
        padding: 14px;
    }

    .result-announcement {
        font-size: 32px;
        padding: 20px 40px;
    }

    .coin-type-options {
        gap: 8px;
    }

    .coin-type-btn {
        padding: 8px 12px;
    }

    .coin-preview {
        width: 28px;
        height: 28px;
    }

    .coin-type-label {
        font-size: 10px;
    }
}
