/* Party Blackjack Styles - Poker Table Theme */

/* Import Google Font */
@import url('https://fonts.googleapis.com/css2?family=Rye&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Rye', cursive;
    background-color: #1a1a1a;
    background-image: url('/static/images/black_leather_bg.png');
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: #ffffff;
    padding: 50px 20px;
    text-align: center;
    min-height: 100vh;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 30px;
    background-color: #35654d;
    background-image: url('/static/images/felt-texture.jpg');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    /* Dark overlay */
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 50px rgba(0, 0, 0, 0.8);
    /* Inner shadow */
    border: 15px solid #5d4037;
    /* Wood border */
    position: relative;
    color: #ffffff;
}

/* Wood texture overlay for border (optional) */
.container::before {
    content: '';
    position: absolute;
    top: -15px;
    left: -15px;
    right: -15px;
    bottom: -15px;
    border: 2px solid #3e2723;
    border-radius: 20px;
    pointer-events: none;
    z-index: -1;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 3rem;
    color: #ffc107;
    text-shadow: 3px 3px 6px #000;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2rem;
    color: #ffffff;
    text-shadow: 2px 2px 4px #000;
}

/* Sections */
.section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.section h2 {
    color: #ffc107;
    margin-bottom: 20px;
    font-size: 2rem;
    text-shadow: 2px 2px 4px #000;
}

.section h3 {
    color: #ffffff;
    margin-bottom: 15px;
    font-size: 1.5rem;
    text-shadow: 2px 2px 4px #000;
}

/* Welcome Section */
.welcome-section {
    text-align: center;
    padding: 40px 20px;
}

.welcome-section p {
    font-size: 1.1rem;
    color: #e0e0e0;
    margin-bottom: 10px;
    text-shadow: 1px 1px 2px #000;
}

/* Role Cards */
.roles-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

.role-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 30px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.role-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 193, 7, 0.5);
}

.role-card h3 {
    font-size: 2rem;
    color: #ffc107;
    margin-bottom: 15px;
}

.role-card p {
    color: #e0e0e0;
    margin-bottom: 20px;
}

.role-card ul {
    text-align: left;
    list-style-position: inside;
    margin-bottom: 25px;
    color: #ffffff;
}

.role-card li {
    padding: 5px 0;
}

/* Rules Section */
.rules-section {
    margin-top: 40px;
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.rule {
    padding: 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    border-left: 4px solid #ffc107;
}

.rule strong {
    display: block;
    color: #ffc107;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.rule p {
    color: #e0e0e0;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 15px 30px;
    margin: 10px;
    font-size: 20px;
    font-family: 'Rye', cursive;
    color: #fff;
    background-color: #c0392b;
    border: none;
    border-radius: 10px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
}

.btn:hover {
    background-color: #a93226;
    transform: translateY(-2px);
    box-shadow: 2px 4px 12px rgba(0, 0, 0, 0.7);
}

.btn-primary {
    background-color: #c0392b;
}

.btn-primary:hover {
    background-color: #a93226;
}

.btn-success {
    background-color: #28a745;
}

.btn-success:hover {
    background-color: #218838;
}

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

.btn-danger:hover {
    background-color: #c82333;
}

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

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-action {
    background-color: #c0392b;
    margin: 5px;
}

.btn-action:hover {
    background-color: #a93226;
}

.btn-action:disabled {
    background-color: #555;
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-sm {
    padding: 10px 20px;
    font-size: 16px;
}

/* Forms */
.form-group {
    margin: 15px 0;
    text-align: left;
}

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #444;
    border-radius: 8px;
    background-color: #333;
    color: white;
    font-size: 16px;
    font-family: 'Rye', cursive;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #ffc107;
    outline: none;
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffc107' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 40px;
}

.form-group select option {
    background-color: #333;
    color: white;
    padding: 10px;
}

/* Game Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 193, 7, 0.3);
}

.game-status {
    display: flex;
    gap: 10px;
}

.badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    background: #ffc107;
    color: #000;
}

.player-info {
    display: flex;
    gap: 15px;
    font-size: 18px;
}

.player-name-badge,
.chips-badge {
    padding: 8px 16px;
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    border-radius: 20px;
    font-weight: bold;
    border: 2px solid #ffc107;
}

/* Hand Display - Blackjack Table */
.hand-display {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    padding: 30px 20px;
    background: rgba(0, 100, 0, 0.3);
    border-radius: 15px;
    min-height: 140px;
    align-items: center;
    justify-content: center;
    border: 3px solid rgba(255, 193, 7, 0.3);
}

.empty-hand {
    color: #e0e0e0;
    font-style: italic;
    opacity: 0.7;
}

/* Card Flip Container */
/* Card container for flippable cards */
.card-container {
    width: 71px;
    height: 96px;
    perspective: 1000px;
    cursor: pointer;
    display: inline-block;
    margin: 5px;
}

.card-container.no-flip {
    cursor: default;
}

.card-container.face-up {
    cursor: default;
    perspective: none;
}

.card-flipper {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card-container.flipped .card-flipper {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    overflow: hidden;
}

/* Card Front (face up) */
.card-front {
    transform: rotateY(180deg);
}

/* Card Back (face down) */
.card-back {
    background: #fff;
}

/* Card images */
.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    border: 2px solid #ffc107;
}

/* Hover effect for flippable cards */
.card-container:not(.no-flip):not(.face-up):hover .card-flipper {
    transform: scale(1.05);
}

.card-container.flipped:not(.no-flip):hover .card-flipper {
    transform: rotateY(180deg) scale(1.05);
}

/* Legacy card class for non-flippable cards */
.card {
    width: 71px;
    height: 96px;
    background: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    border: 3px solid #ffc107;
    transition: transform 0.3s ease;
}

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

.card.hearts,
.card.diamonds {
    color: #e74c3c;
}

.card.spades,
.card.clubs {
    color: #2c3e50;
}

.hand-value {
    margin-top: 15px;
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffc107;
    text-shadow: 2px 2px 4px #000;
}

/* Players Grid */
.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.player-card {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.player-card.active {
    border-color: #28a745;
    box-shadow: 0 0 15px rgba(40, 167, 69, 0.5);
}

.player-card.bust {
    border-color: #dc3545;
    opacity: 0.6;
}

.player-card.blackjack {
    border-color: #ffc107;
    box-shadow: 0 0 15px rgba(255, 193, 7, 0.5);
}

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

.player-name {
    font-weight: bold;
    color: #ffc107;
    font-size: 1.2rem;
}

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

.player-status-badge {
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: bold;
    text-transform: uppercase;
}

.status-playing {
    background: #28a745;
    color: white;
}

.status-stand {
    background: #6c757d;
    color: white;
}

.status-bust {
    background: #dc3545;
    color: white;
}

.status-blackjack {
    background: #ffc107;
    color: #000;
}

.status-waiting {
    background: #555;
    color: white;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 30px 0;
    flex-wrap: wrap;
}

.dealer-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px 0;
    flex-wrap: wrap;
}

/* Messages */
.messages {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    z-index: 1000;
}

.message {
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

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

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

.message-success {
    background: #28a745;
    color: white;
}

.message-error {
    background: #dc3545;
    color: white;
}

.message-info {
    background: #17a2b8;
    color: white;
}

/* Results */
.results-section {
    margin-top: 30px;
    padding: 25px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
}

.result-item {
    padding: 15px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border-left: 4px solid #ffc107;
}

.result-item.win {
    border-left-color: #28a745;
}

.result-item.lose {
    border-left-color: #dc3545;
}

.result-item.push {
    border-left-color: #ffc107;
}

.result-message {
    font-size: 2rem;
    font-weight: bold;
    text-align: center;
    padding: 30px;
    border-radius: 15px;
    text-shadow: 2px 2px 4px #000;
}

.result-message.win {
    background: #28a745;
    color: white;
}

.result-message.lose {
    background: #dc3545;
    color: white;
}

.result-message.push {
    background: #ffc107;
    color: #000;
}

/* Game Link */
.game-link {
    margin-top: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.game-link input {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    font-size: 0.9rem;
    border: 2px solid #444;
    border-radius: 8px;
    background-color: #333;
    color: white;
    font-family: 'Rye', cursive;
}

/* Other Players */
.other-players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.other-player-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.no-players {
    text-align: center;
    color: #e0e0e0;
    font-style: italic;
    padding: 40px;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid rgba(255, 193, 7, 0.3);
    color: #e0e0e0;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 20px 10px;
    }

    .container {
        padding: 20px 15px;
    }

    header h1 {
        font-size: 2rem;
    }

    .roles-container {
        grid-template-columns: 1fr;
    }

    .rules-grid {
        grid-template-columns: 1fr;
    }

    .game-header {
        flex-direction: column;
        gap: 15px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 18px;
    }

    .hand-display {
        justify-content: flex-start;
        padding: 20px 15px;
    }

    .card,
    .card-container {
        width: 70px;
        height: 100px;
    }

    .card-face {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }

    .card,
    .card-container {
        width: 60px;
        height: 85px;
    }

    .card-face {
        font-size: 1.5rem;
    }
}

/* Dealer Message Panel */
.dealer-message-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
    width: 100%;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    animation: slideDown 0.3s ease-out;
}

.dealer-avatar-mini {
    width: 80px;
    height: 80px;
    min-width: 80px;
    border-radius: 50%;
    border: 3px solid #ffc107;
    overflow: hidden;
    background: #1a1a1a;
    box-shadow: 0 0 15px rgba(255, 193, 7, 0.4), inset 0 0 10px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.dealer-avatar-mini::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    pointer-events: none;
}

.dealer-avatar-mini img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.dealer-message-text {
    background: white;
    padding: 10px 20px;
    border-radius: 15px;
    border: 2px solid #ffc107;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    font-family: 'Rye', cursive;
    color: #3e2723;
    font-size: 1.1rem;
    flex-grow: 1;
    text-align: left;
    position: relative;
}

/* Speech bubble tail */
.dealer-message-text::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -10px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 10px 10px 0;
    border-color: transparent #ffc107 transparent transparent;
}

.dealer-message-text::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -7px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 8px 8px 0;
    border-color: transparent white transparent transparent;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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