/* Blackjack Game CSS */

body {
    font-family: Arial, sans-serif;
    font-size: 18px;
    margin: 20px;
    background: #4a5d23; /* Army green background */
    color: white;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden; /* Prevent horizontal scrolling */
    position: relative;
}

*, *::before, *::after {
    box-sizing: border-box;
}

/* FIXED LOGO POSITIONING - Only show one version at a time */

/* Desktop logo - show by default */
#headerImage {
    display: block;
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000;
}

/* Mobile logo - hide by default */
#mobileHeaderImage {
    display: none;
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000;
}

.home-btn {
    background: #3498db !important;
    color: white !important;
    border: none !important;
    border-radius: 5px !important;
    padding: 8px 12px !important;
    margin-left: 10px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    text-decoration: none !important;
    display: inline-block !important;
    min-width: auto !important;
    width: auto !important;
}

.home-btn:hover {
    background: #2980b9 !important;
}

h1 {
    font-size: 28px;
    color: #ecf0f1;
    text-align: center;
}

p {
    font-size: 18px;
    margin: 15px 0;
}

/* Card display styling */
.card-display {
    background: #34495e;
    padding: 20px;
    border-radius: 10px;
    margin: 15px 0;
    border: 2px solid #3498db;
}

.hand {
    font-weight: bold;
    font-size: 20px;
}

/* Fixed field size for text/number inputs */
input[type="text"],
input[type="number"] {
    font-size: 18px;
    padding: 12px;
    width: 100%;
    max-width: 100%;
    border: 2px solid #3498db;
    border-radius: 5px;
    margin: 5px 0;
    background: white;
    color: black;
    height: 52px;
    line-height: 1.2;
    box-sizing: border-box;
}

/* Unified password field style */
input[type="password"],
input[type="text"].password-field,
input[name="password"],
input[name="confirm_password"],
input#password,
input#confirm_password {
    font-size: 18px !important;
    padding: 12px 50px 12px 12px !important;
    height: 52px !important;
    min-height: 52px !important;
    max-height: 52px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    border: 2px solid #3498db !important;
    border-radius: 5px !important;
    background: white !important;
    color: black !important;
}

/* Mobile override */
@media (max-width: 600px) {
    input[type="password"],
    input[type="text"].password-field,
    input[name="password"],
    input[name="confirm_password"],
    input#password,
    input#confirm_password {
        font-size: 16px !important;
        padding: 16px 50px 16px 16px !important;
        height: 56px !important;
        min-height: 56px !important;
        max-height: 56px !important;
    }
}

/* Password visibility toggle */
.password-wrapper {
    position: relative;
    width: 100%;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    z-index: 2;
    height: 32px;
    display: flex;
    align-items: center;
}

.password-toggle:hover {
    color: #333;
    background: rgba(0,0,0,0.05);
    border-radius: 3px;
}

/* Buttons */
input[type="submit"] {
    font-size: 18px;
    padding: 15px 30px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin: 10px 5px;
    min-width: 180px;
    width: 100%;
    max-width: 100%;
}

input[type="submit"]:hover {
    background: #219a52;
}

/* Button variants */
.quit-btn {
    background: #e74c3c !important;
}

.quit-btn:hover {
    background: #c0392b !important;
}

.new-round-btn {
    background: #3498db !important;
}

.new-round-btn:hover {
    background: #2980b9 !important;
}

.back-btn {
    background: #95a5a6 !important;
    font-size: 14px !important;
    padding: 8px 16px !important;
    min-width: auto !important;
    width: auto !important;
}

.back-btn:hover {
    background: #7f8c8d !important;
}

/* Special text styles */
.blackjack {
    color: #f1c40f;
    font-weight: bold;
    font-size: 24px;
    text-align: center;
}

.result {
    font-size: 22px;
    font-weight: bold;
    color: #f1c40f;
    text-align: center;
}

.error {
    color: #e74c3c;
    font-weight: bold;
}

/* Forms */
form {
    margin: 20px 0;
    text-align: center;
}

/* Welcome/End pages styling */
.welcome-page {
    text-align: center;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    width: 100%;
    padding-top: 60px; /* Make room for logo */
}

.welcome-page h1 {
    color: #f1c40f;
}

/* Login page specific styles - COMPLETELY REMOVED CONTAINERS FOR ALL DEVICES */
.login-container,
.password-container {
    width: 100%;
    max-width: 450px;
    margin: 0 auto;
    background: transparent; /* Transparent background */
    padding: 30px 20px; /* Reduced horizontal padding */
    border: none; /* NO BORDER for all devices */
    box-sizing: border-box;
    box-shadow: none; /* No shadow */
    border-radius: 0; /* No rounded corners */
}

.button-group {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.button-group input[type="submit"] {
    margin: 5px 0;
    width: 100%;
}

.game-info {
    margin-top: 30px;
    font-size: 16px;
    color: #bdc3c7;
    text-align: center;
    line-height: 1.5;
}

.password-title {
    color: #f1c40f;
    margin-top: 0;
    font-size: 24px;
}

.username-display {
    font-weight: bold;
    font-size: 18px;
}

.balance-display {
    color: #27ae60;
    font-weight: bold;
    font-size: 18px;
}

.back-form {
    margin-top: 15px;
}

.password-requirements {
    font-size: 14px;
    color: #bdc3c7;
    margin: 10px 0;
    text-align: left;
}

.form-group {
    margin: 15px 0;
    width: 100%;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 16px;
    color: #ecf0f1;
    text-align: left;
}

/* Mobile responsive design - FIXED WIGGLING */
@media (max-width: 600px) {
    body {
        font-size: 16px;
        margin: 0; /* Remove margins to prevent wiggling */
        padding: 10px;
        width: 100vw; /* Use viewport width */
        min-width: 100vw;
        max-width: 100vw;
        overflow-y: auto;
        overflow-x: hidden;
        position: relative; /* Changed from fixed */
    }

    /* Mobile - hide desktop logo, show mobile logo */
    #headerImage {
        display: none !important;
    }
    
    #mobileHeaderImage {
        display: block !important;
        position: absolute;
        top: 5px;
        left: 5px;
        z-index: 1000;
    }

    #mobileHeaderImage img {
        height: 60px !important; /* mobile */
        width: auto !important;
    }

    .home-btn {
        padding: 6px 10px !important;
        font-size: 12px !important;
        margin-left: 8px !important;
    }

    h1 {
        font-size: 26px;
        margin: 20px 0;
    }

    .password-title {
        font-size: 22px;
    }

    .hand {
        font-size: 18px;
    }

    input[type="submit"] {
        padding: 15px 20px;
        font-size: 16px;
        width: 100%;
        margin: 8px 0;
        min-width: auto;
        box-sizing: border-box;
    }

    .card-display {
        padding: 15px;
        margin: 10px 0;
        width: 100%;
        box-sizing: border-box;
    }

    .password-toggle {
        right: 16px;
        font-size: 13px;
        padding: 4px 6px;
        height: 28px;
    }

    /* FIXED CONTAINER SIZING FOR MOBILE - NO MORE WIGGLING */
    .login-container, 
    .password-container {
        width: 100vw; /* Use full viewport width */
        max-width: none;
        margin: 0;
        padding: 20px;
        background: transparent; /* Transparent - just army background */
        border: none;
        border-radius: 0;
        box-shadow: none;
        min-height: calc(100vh - 60px); /* Account for logo space */
        box-sizing: border-box;
    }

    .welcome-page {
        padding: 10px;
        min-height: 100vh;
        width: 100vw;
        box-sizing: border-box;
        padding-top: 50px;
        overflow-x: hidden;
    }

    .game-info {
        font-size: 15px;
        width: 100%;
    }

    .username-display, .balance-display {
        font-size: 16px;
    }

    .form-group {
        width: 100%;
        margin: 15px 0;
    }

    .form-group label {
        font-size: 15px;
    }

    .password-requirements {
        font-size: 13px;
    }

    p {
        font-size: 16px;
    }

    /* PREVENT WIGGLING - Fixed widths */
    .form-group, 
    form, 
    .button-group {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Additional mobile stability fixes */
    * {
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
    }
}

/* Tablet responsive design - ARMY BACKGROUND ONLY */
@media (min-width: 601px) and (max-width: 1024px) {
    body {
        margin: 30px;
        background: #4a5d23 !important; /* Force army background */
    }

    input[type="submit"] {
        width: auto;
        min-width: 180px;
    }

    /* Tablet logo sizing */
    #headerImage img {
        height: 100px !important;
        width: auto !important;
    }
    
    #mobileHeaderImage {
        display: none !important;
    }

    /* NO BORDER CONTAINERS FOR TABLET - ARMY BACKGROUND */
    .login-container, 
    .password-container {
        max-width: 500px;
        background: #4a5d23 !important; /* Force army background */
        border: none;
        box-shadow: none;
        border-radius: 0;
    }
}

/* Desktop - ARMY BACKGROUND ONLY */
@media (min-width: 1025px) {
    body {
        background: #4a5d23 !important; /* Force army background */
    }

    /* Desktop logo sizing */
    #headerImage {
        display: block !important;
        position: absolute;
        top: 10px;
        left: 10px;
    }
    
    #headerImage img {
        height: 140px !important; /* Your desired desktop size */
        width: auto !important;
    }
    
    #mobileHeaderImage {
        display: none !important;
    }

    /* NO BORDER CONTAINERS FOR DESKTOP - ARMY BACKGROUND */
    .login-container, 
    .password-container {
        background: #4a5d23 !important; /* Force army background */
        border: none;
        box-shadow: none;
        border-radius: 0;
    }
}

/* Equal prominence for New/Returning buttons */
input[type="submit"].returning-btn,
input.returning-btn,
button.returning-btn {
    background: #3498db !important;
    color: white !important;
    font-weight: 600 !important;
    border: 2px solid #2980b9 !important;
    padding: 15px 30px !important;
    border-radius: 5px !important;
    cursor: pointer !important;
    min-width: 180px !important;
}

input[type="submit"].returning-btn:hover,
input.returning-btn:hover,
button.returning-btn:hover {
    background: #2980b9 !important;
}

/* Continue playing button */
.continue-btn {
    background: #f39c12 !important;
    color: white !important;
    font-weight: 600 !important;
    border: 2px solid #e67e22 !important;
    padding: 15px 30px !important;
    border-radius: 5px !important;
    cursor: pointer !important;
}

.continue-btn:hover {
    background: #e67e22 !important;
}

@media (max-width: 600px) {
    input[type="submit"].returning-btn,
    input.returning-btn,
    button.returning-btn,
    .continue-btn {
        min-width: auto !important;
        width: 100% !important;
    }
}