/* ===== COIN TOSS STYLES ===== */

/* ===== ROOT VARIABLES ===== */

/* ===== THEME COLOR CLASSES ===== */
.theme-classic {
    --primary-color: #FF6F61;
    --secondary-color: #FFD5CC;
}

.theme-yes-no {
    --primary-color: #F6C947;
    --secondary-color: #FFF2C5;
}

.theme-true-false {
    --primary-color: #7ED6F3;
    --secondary-color: #D6F6FF;
}

.theme-accept-decline {
    --primary-color: #667EEA;
    --secondary-color: #DDE3FF;
}

.theme-left-right {
    --primary-color: #4CAF50;
    --secondary-color: #DFF5E1;
}

.theme-home-away {
    --primary-color: #B0BEC5;
    --secondary-color: #ECEFF1;
}

.theme-start-wait {
    --primary-color: #B0BEC5;
    --secondary-color: #ECEFF1;
}

.theme-go-stop {
    --primary-color: #B0BEC5;
    --secondary-color: #ECEFF1;
}


/* ===== BODY & LAYOUT ===== */

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: var(--primary-color);
}

.btn-theme-color {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

/* ===== CARD STYLES ===== */
.card {
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Coin Container */
.coin-container {
    width: 100%;
    max-width: 400px;
    height: 400px;
    margin: 0 auto;
    perspective: 1000px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 10px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 50%;
    /* make it round */
    overflow: hidden;
    /* clips background to circle */
}

/* 3D Coin */
.coin {
    width: 250px;
    height: 250px;
    position: relative;
    border-radius: 50%;
    transform-style: preserve-3d;
    transition: transform 0.1s;
    cursor: pointer;
}

/* Coin Sides */
.coin-side {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    backface-visibility: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);

    overflow: hidden;
}

.coin-heads {
    background: linear-gradient(145deg, #f3d078, #d4a746);
    color: #fff;
    transform: rotateY(0deg);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    border: 6px solid #ffc107;
    box-shadow: inset -3px -3px 10px rgba(0,0,0,0.1), 
                inset 3px 3px 10px rgba(255,255,255,0.4);
}

.coin-tails {
    background: linear-gradient(145deg, #e0e0e0, #b7b7b7);
    color: #fff;
    transform: rotateY(180deg);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    border: 6px solid #616168;
    box-shadow: inset -3px -3px 10px rgba(0,0,0,0.1), 
                inset 3px 3px 10px rgba(255,255,255,0.4);
}

.coin-inner {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    word-break: break-word;
}

/* Background Image Mode */
.coin-bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.7;
    z-index: 0;
}

/* Emoji/Image Mode */
.coin-emoji {
    font-size: 4rem;
    margin-bottom: 10px;
    z-index: 2;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.coin-emoji-image {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 50%;
    margin-bottom: 10px;
    border: 4px solid rgba(255, 255, 255, 0.5);
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Text Label */
.coin-label {
    font-size: 2rem;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 2;
    position: relative;
}

/* Flip Animation */
.coin.flipping {
    animation: flipCoin var(--flip-duration, 3s) cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes flipCoin {
    0% {
        transform: rotateY(0deg) rotateX(0deg);
    }

    100% {
        transform: rotateY(var(--flip-rotations, 1800deg)) rotateX(20deg);
    }
}

/* To have more effects after coin flip is over.
.coin.settling {
    transition: transform var(--settle-duration, 0.6s) cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes flipCoin {
    0% {
        transform: rotateY(0deg) rotateX(0deg);
    }
    95% {
        transform: rotateY(var(--flip-rotations, 1800deg)) rotateX(20deg);
    }
    100% {
        transform: rotateY(var(--flip-rotations, 1800deg)) rotateX(0deg);
    }
} */

/* Center Spin Button */
#centerSpinBtn {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.spin-center-btn {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(145deg, #667eea, #764ba2);
    border: 3px solid white;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
    z-index: 1;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spin-center-btn:hover {
    transform: translateX(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.spin-center-btn:active {
    transform: translateX(-50%) scale(0.95);
}

.spin-center-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: translateX(-50%) scale(1);
}

/* Result Display */
.result-display {
    animation: fadeInUp 0.5s ease;
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 15px;
    border: 2px solid var(--primary-color);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Simple Input Section - Hide for Coin Toss */
#simpleInput {
    display: block;
}

/* Coin Toss Specific Simple Input */
.coin-toss-simple-input {
    max-width: 100%;
}

.coin-toss-simple-input .form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.coin-toss-simple-input .row {
    margin-bottom: 1rem;
}

.coin-toss-simple-input .form-control {
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    padding: 0.75rem;
    transition: all 0.3s ease;
    text-align: center;
    font-weight: 600;
}

.coin-toss-simple-input .form-control:focus {
    border-color: #ffc107;
    box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25);
}

/* Preset Buttons */
.preset-btn {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.preset-btn:hover {
    border-color: #ffc107;
    background: #fff8e1;
    transform: translateY(-2px);
}

/* Button States */
#mainSpinBtn:disabled,
#centerSpinBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Responsive Design */
@media (max-width: 768px) {
    .coin-container {
        height: 300px;
        max-width: 300px;
    }

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

    .coin-side {
        font-size: 1.5rem;
        border: 4px solid #ffc107;
    }

    .coin-inner {
        padding: 15px;
    }

    .spin-center-btn {
        width: 60px;
        height: 60px;
        font-size: 0.75rem;
    }

    .coin-emoji {
        font-size: 3rem;
    }

    .coin-emoji-image {
        width: 100px;
        height: 100px;
    }

    .coin-label {
        font-size: 1.5rem;
    }
}

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

    .coin {
        width: 180px;
        height: 180px;
    }

    .coin-side {
        font-size: 1.2rem;
        border: 3px solid #ffc107;
    }

    .coin-inner {
        padding: 10px;
    }

    .spin-center-btn {
        width: 50px;
        height: 50px;
        font-size: 0.7rem;
    }

    .coin-emoji {
        font-size: 2.5rem;
    }

    .coin-emoji-image {
        width: 80px;
        height: 80px;
    }

    .coin-label {
        font-size: 1.2rem;
    }
}

/* Winner Modal Styling */
#winnerModal .modal-content {
    border-radius: 15px;
}

#winnerModal .modal-body {
    padding: 3rem 2rem;
}

#winnerModal h2 {
    font-size: 3rem;
}

#winnerModal h3 {
    color: #ffc107;
    font-weight: bold;
}

#winnerModal .display-5 {
    color: #333;
}

/* History & Leaderboard */
.history-item,
.leaderboard-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease;
}

.history-item:hover,
.leaderboard-item:hover {
    background: #f5f5f5;
}

.history-item:last-child,
.leaderboard-item:last-child {
    border-bottom: none;
}

.history-item-left,
.leaderboard-item-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.history-spin-number,
.leaderboard-rank {
    font-weight: bold;
    color: #666;
    font-size: 0.85rem;
}

.history-winner-name,
.leaderboard-name {
    font-weight: 600;
    color: #333;
}

.history-timestamp,
.leaderboard-count {
    font-size: 0.85rem;
    color: #999;
}

.leaderboard-item.rank-1 {
    background: linear-gradient(135deg, #fff9c4 0%, #fff59d 100%);
}

.leaderboard-item.rank-2 {
    background: linear-gradient(135deg, #e0e0e0 0%, #bdbdbd 100%);
}

.leaderboard-item.rank-3 {
    background: linear-gradient(135deg, #ffccbc 0%, #ffab91 100%);
}

/* Winners Scroll Container */
.winners-scroll-container {
    max-height: 300px;
    overflow-y: auto;
}

.winners-scroll-container::-webkit-scrollbar {
    width: 6px;
}

.winners-scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.winners-scroll-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.winners-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}