/*
 * Fringes Adventure Game
 * Main Stylesheet
 */

/* ===== Variables ===== */
:root {
    /* Colors */
    --primary-color: #4a6da7;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --info-color: #17a2b8;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --steel-blue: #4682B4;
    --light-steel-blue: #B0C4DE;
    --light-yellow: #FFFFE0;

    /* Z-index layers - improved organization */
    --z-index-background: 0;
    --z-index-content: 10;
    --z-index-ui-element: 50;
    --z-index-navigation: 100;
    --z-index-dropdown: 500;
    --z-index-sidebar: 800;
    --z-index-modal: 1000;
    --z-index-notification: 2000;
    --z-index-overlay: 3000;

    /* Transitions */
    --transition-speed: 0.3s;
    --transition-timing: ease;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.3);
}

/* ===== Reset & Base Styles ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    background-color: #f4f4f4;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    min-height: 100vh;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: hidden;
    transition: background-image 0.5s ease-in-out, background-color 0.5s ease-in-out;
    margin: 0 !important;
    padding: 0 !important;
}

/* Background image handling */
body[style*="background-image"] {
    background-color: #cccccc;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    min-height: 100vh;
    /* Ensure full viewport height */
    display: flex;
    flex-direction: column;
}

/* ===== Layout ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
    z-index: var(--z-index-content);
    overflow-y: auto;
    max-height: calc(100vh - 60px - 31px);
    padding: 0 0;
    margin-top: 60px !important;
    /* Remove horizontal padding, let Bootstrap handle it */
}

.container {
    width: 80%;
    margin: 0 auto;
    /* 0 for top/bottom, auto for left/right centering */
    overflow: visible;
    padding-bottom: var(--spacing-lg);
    position: relative;
}

/* ===== Flash Messages ===== */
.flash-messages-container {
    position: fixed;
    top: 70px;
    /* Just below the navbar */
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-index-notification);
    max-width: 600px;
    width: 90%;
    pointer-events: none;
    /* Allow clicks to pass through empty space */
}

.flash-messages-container .alert {
    pointer-events: auto;
    /* Re-enable clicks on the actual alerts */
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-lg);
}

/* ===== Navigation ===== */
.navbar {
    padding: 0 !important;
    margin: 0 !important;
    background: none;
    min-height: 60px;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    z-index: var(--z-index-navigation);
    border: none !important;
    box-shadow: none !important;
}

.navbar .container-fluid {
    padding: 0 0.5rem 0 0 !important;
    /* Remove left padding, keep right padding */
    margin: 0 !important;
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box !important;
    border: none !important;
    outline: none !important;
    background: linear-gradient(145deg, #2a3b4c, #3a4b5c) !important;
    height: 60px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

.navbar-brand {
    display: flex !important;
    align-items: center !important;
    padding: 0 !important;
    margin: 0 !important;
    height: 60px;
    /* Match navbar height */
    background: none !important;
    border: none !important;
    text-decoration: none !important;
}

.navbar-brand img {
    display: block !important;
    height: 60px !important;
    /* Fill the full navbar height */
    width: 60px !important;
    /* Make it square, matching height */
    object-fit: cover;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    outline: none !important;
    vertical-align: baseline !important;
}

.navbar-brand span {
    margin-left: 0.5rem !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    margin-right: 0 !important;
    align-self: center;
    font-size: 1rem;
    color: white;
    font-weight: 500;
    padding: 0 !important;
}

.header-stats {
    color: var(--success-color);
    font-size: 1rem;
    margin: 0 !important;
    padding: 0 !important;
    white-space: nowrap;
    display: block;
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 !important;
    padding: 0 !important;
}

/* Inventory button positioning */
.inventory-button-container {
    position: fixed;
    top: 70px;
    z-index: var(--z-index-ui-element);
    /* Align with right edge of col-md-10 (83.33% width) plus 1 column margin */
    right: calc(50vw - 41.67vw);
    /* 41.67% is half of 83.33% */
}

/* Responsive positioning adjustments */
@media (max-width: 767.98px) {
    .inventory-button-container {
        /* On mobile, simple right margin since we use full width */
        right: 10px;
    }
}

@media (min-width: 768px) {
    .inventory-button-container {
        /* Medium screens and up - align with col-md-10 layout */
        right: calc(50vw - 41.67vw);
    }
}

.inventory-toggle-btn {
    background-image: url('/static/images/log_button.png');
    background-color: transparent;
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    color: #FFFFFF;
    border: none;
    padding: 8px 15px;
    transition: all 0.3s ease;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile optimizations */
@media (max-width: 480px) {
    .navbar .container-fluid {
        padding: 0.25rem 0.5rem 0.25rem 0;
        /* Remove left padding on mobile too */
    }

    .user-controls {
        gap: 0.25rem;
    }

    .user-controls .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }

    .inventory-button-container {
        top: 60px;
        right: 5px;
    }

    .header-stats {
        font-size: 0.875rem;
        padding: 0 0.5rem;
    }

    .stats-container {
        display: flex;
        align-items: center;
    }
}

.user-info {
    color: var(--success-color);
    font-size: 1.25rem;
    margin: 0;
    padding: 0;
}

.user-select-form {
    display: inline-flex;
    margin-right: 1rem;
}

.navbar .btn {
    margin: 0 !important;
    padding: 0.5rem 1rem;
}

.navbar .text-success {
    margin: 0 !important;
    padding: 0 !important;
    color: #00ff00 !important;
    /* Bright green */
}

/* ===== Forms & Inputs ===== */
.form-select {
    appearance: none;
    background-color: var(--primary-color);
    border: 1px solid transparent;
    color: white;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 0.25rem;
    cursor: pointer;
    min-width: 150px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    transition: all var(--transition-speed) var(--transition-timing);
}

.form-select:focus {
    outline: none;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all var(--transition-speed) var(--transition-timing);
    font-weight: 500;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

/* ===== Inventory System ===== */
.inventory-toggle-btn:hover {
    opacity: 0.8;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.inventory-toggle-btn i {
    margin-right: 8px;
}

/* Inventory Sidebar */
.inventory-sidebar {
    position: fixed;
    top: 110px;
    /* Position below the inventory button */
    right: calc(50vw - 41.67vw);
    /* Match inventory button positioning */
    width: 250px;
    max-height: calc(100vh - 130px);
    /* Adjust for new top position */
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px;
    z-index: var(--z-index-sidebar);
    overflow-y: auto;
    transition: all 0.3s ease;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.5);
    display: none;
    /* Hidden by default */
}

.inventory-sidebar.visible {
    display: block;
}

.inventory-container {
    padding: 10px 0;
}

.inventory-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 15px;
    padding-bottom: 10px;
}

.inventory-header h3 {
    margin: 0;
    font-size: 1.2em;
}

.inventory-items {
    max-height: calc(100vh - 250px);
    /* Leave space for header and footer */
    overflow-y: auto;
    margin-bottom: 10px;
    padding-right: 5px;
}

.inventory-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.empty-inventory {
    color: #999;
    font-style: italic;
    text-align: center;
}

/* Inventory Items */
.inventory-item {
    position: relative;
    padding: 6px 12px;
    margin-bottom: 2px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 36px;
    overflow: visible;
}

.inventory-item.loading {
    opacity: 0.7;
    pointer-events: none;
}

.item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: visible;
    /* Allow text to show properly */
    padding-right: 60px;
    /* Make room for buttons */
}

.item-name {
    font-weight: bold;
    margin-bottom: 4px;
    white-space: normal;
    /* Allow text wrapping */
    word-wrap: break-word;
}

.item-actions {
    position: absolute;
    right: 12px;
    top: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #888;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    font-style: normal;
    font-weight: bold;
    font-family: serif;
    font-size: 14px;
    transition: all 0.2s ease;
}

.info-icon:hover {
    background-color: #aaa;
}

.info-icon.active {
    background-color: #6495ED;
}

.drop-item-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #d9534f;
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0;
    font-weight: bold;
}

.drop-item-btn:hover {
    background-color: #c9302c;
}

/* Item description that expands below */
.item-description {
    display: none;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.9em;
    color: #ccc;
    white-space: normal;
    line-height: 1.4;
    width: 100%;
    animation: expandDescription 0.3s ease-out;
}

.item-description.visible {
    display: block;
}

/* Animation for description expansion */
@keyframes expandDescription {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        margin-top: 0;
    }

    to {
        opacity: 1;
        max-height: 100px;
        padding-top: 8px;
        margin-top: 8px;
    }
}

/* Scrollbar styling */
.inventory-items::-webkit-scrollbar {
    width: 6px;
}

.inventory-items::-webkit-scrollbar-track {
    background-color: rgba(0, 0, 0, 0.3);
}

.inventory-items::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

/* Loading state */
.inventory-sidebar.loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: var(--z-index-content);
}

.inventory-sidebar.loading::before {
    content: "Loading...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    z-index: var(--z-index-ui-element);
}

/* ===== Notifications ===== */
/* Notification styles moved to notifications.css - keeping only z-index reference */
.notification {
    z-index: var(--z-index-notification);
}

/* ===== Accessibility ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.focus-visible:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .container {
        width: 95%;
    }

    .navbar .container-fluid {
        padding: 0 0.5rem 0 0;
        /* Remove left padding on tablet too */
    }

    .user-controls {
        gap: 0.5rem;
    }

    .user-select-form {
        margin-left: 0.5rem;
    }

    .inventory-button-container {
        top: 65px;
    }

    .reset-game-btn {
        padding: 0.25rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: var(--spacing-sm);
    }

    .inventory-panel {
        width: 100%;
        right: 0;
    }

    .inventory-panel.visible {
        transform: translateX(0);
    }

    .scene-options {
        flex-direction: column;
        gap: var(--spacing-sm);
        padding: var(--spacing-sm);
    }

    .navigation-btn,
    .btn-custom {
        width: 100%;
        padding: 0.5rem;
        font-size: 0.9rem;
    }

    .btn-custom {
        margin: 0;
        white-space: normal;
        height: auto;
        min-height: 40px;
    }

    .btn-custom:active {
        transform: scale(0.98);
    }

    .item-button-container {
        width: 100%;
        margin: 0.25rem 0;
    }

    .scene-options .btn-custom,
    .item-button-container {
        width: 100%;
        margin: 0.25rem 0;
    }

    .navbar {
        min-height: 50px;
    }

    .navbar .container-fluid {
        padding: 0.25rem;
    }

    .header-stats {
        font-size: 0.875rem;
    }

    .user-controls {
        gap: 0.25rem;
    }

    .user-controls .form-select,
    .user-controls .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }

    .footer {
        padding: var(--spacing-sm);
    }

    .footer p {
        font-size: 0.875rem;
    }

    .footer a {
        font-size: 0.875rem;
    }

    .api-error,
    .api-success {
        padding: var(--spacing-sm);
    }

    .api-status {
        padding: 0.25rem 0.5rem;
    }
}

@media (min-width: 481px) {
    .inventory-panel {
        width: 300px;
    }
}

@media (orientation: portrait) {

    .btn-custom.navigation-btn,
    .btn-custom.take-item-btn {
        width: 100%;
        margin: 0.25rem 0;
    }
}

/* ===== Print Styles ===== */
@media print {

    .inventory-panel,
    .notification,
    .btn-custom {
        display: none !important;
    }
}

/* ===== Scene Content Styles ===== */
.scene-content {
    background-color: transparent;
    padding: 4px;
    border-radius: 10px;
    margin-top: 0px;
    margin-bottom: 20px;
}

/* Remove scene-specific background classes */

.scene-container {
    padding: 0;
    width: 100%;
}

.scene-title {
    margin-bottom: 1.5rem;
    font-size: 2rem;
    font-weight: bold;
}

.scene-description {
    max-width: 100%;
    margin-bottom: 1.5rem;
    font-size: 1.1em;
    line-height: 1.6;
}

.scene-content img {
    max-width: 100%;
    height: auto;
    margin-bottom: 20px;
}

.description {
    margin-bottom: 20px;
    font-size: 1.1em;
    line-height: 1.6;
}

.highlighted {
    background-color: rgba(0, 0, 0, .5);
    padding: 8px;
    border-radius: 5px;
    margin-bottom: 5px;
    display: block;
    width: 100%;
}

/* ===== Button Styles ===== */
.btn-custom,
.inventory-toggle-btn {
    background-image: url('/static/images/log_button.png');
    background-color: transparent;
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    color: #FFFFFF;
    border: none;
    margin-top: 0;
    margin-bottom: 0;
    padding: 12px 20px;
    border-radius: 0;
    transition: all 0.3s ease;
    min-height: 48px;
    position: relative;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    word-wrap: break-word;
    white-space: normal;
    line-height: 1.3;
    box-shadow: none;
    outline: none;
    position: relative;
    z-index: 10;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-custom:hover,
.inventory-toggle-btn:hover {
    opacity: 0.8;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    background-color: transparent;
}

.btn-custom:focus,
.inventory-toggle-btn:focus {
    outline: none;
    box-shadow: none;
    background-color: transparent;
}

/* Style for buttons with longer text */
.btn-custom.long-text {
    padding: 10px 18px;
}

.btn-torch {
    background-color: #a78855;
    color: #fff;
    border: 2px solid #8e6935;
    position: relative;
    padding-left: 40px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.btn-torch:hover {
    background-color: #c4a072;
    border-color: #a78855;
}

.use-item-button {
    display: inline-block;
    background-color: rgba(70, 130, 180, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    margin-right: 10px;
    margin-bottom: 10px;
    text-decoration: none;
    transition: background-color 0.3s;
}

.use-item-button:hover {
    background-color: rgba(70, 130, 180, 0.9);
}

/* Button wrapper for scaling */
.button-wrapper {
    display: inline-block;
    position: relative;
    margin: 5px;
    vertical-align: middle;
}

form .button-wrapper {
    margin: 5px 0;
}

/* ===== Inventory Styles ===== */
/* Add spacing between icon and text in Items button */
.inventory-toggle-btn i {
    margin-right: 10px;
    /* Add space between icon and text */
}

/* Ensure main content container is positioned relatively */
.main-content .container {
    position: relative;
    padding-top: 60px;
    /* Make space for the inventory button */
}

/* Form select in navbar */
.navbar .form-select {
    background-color: var(--primary-color);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 150px;
    height: 38px;
}

/* Reset Game button */
.navbar .btn-danger {
    padding: 0.5rem 1rem;
    height: 38px;
}

.info-icon {
    position: absolute;
    top: 8px;
    right: 35px;
    width: 20px;
    height: 20px;
    background-color: #4682B4;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.info-icon:hover {
    opacity: 1;
}

.info-icon.active {
    background-color: #6495ED;
    opacity: 1;
}

.drop-item-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    background-color: #660000;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.drop-item-btn:hover {
    opacity: 1;
}

/* ===== Footer Styles ===== */
.footer {
    display: block !important;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    color: #FFFFFF;
    height: fit-content;
    /* Only as tall as needed */
}

.footer .row {
    margin: 0;
    padding: 0;
    height: fit-content;
    /* Only as tall as needed */
}

.footer .col-md-6 {
    padding: 0;
    margin: 0;
    height: fit-content;
    /* Only as tall as needed */
}

.footer p {
    margin: 0;
    padding: 2px 5px;
    line-height: normal;
    /* Use normal line height */
    font-size: inherit;
    /* Keep original font size */
    height: fit-content;
    /* Only as tall as needed */
}

.footer a {
    display: inline-block;
    margin: 0 2px;
}

/* Remove any Bootstrap classes that might add extra space */
.footer .container {
    padding: 0;
    margin: 0;
    height: fit-content;
}

/* Modal styling */
.modal-content.bg-dark {
    background: transparent;
    border: none;
    box-shadow: none;
}

.modal-header {
    border: none;
    background: transparent;
    padding: 0.5rem;
}

.modal-header .modal-title {
    color: #dc3545;
    /* Bright red */
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.modal-body {
    background-image: url('/static/images/log_button.png');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    padding: 2rem;
    padding-right: 3rem;
    /* Larger right margin */
    text-align: center;
}

.modal-body p {
    color: white;
    /* Changed to white */
    font-size: 1.25rem;
    font-weight: bold;
    margin: 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.modal-footer {
    border: none;
    background: transparent;
    padding: 0.5rem;
    justify-content: center;
    gap: 1rem;
}

.modal .btn-secondary {
    /* Cancel button */
    background-color: #28a745;
    /* Success green */
    border: none;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
}

.modal .btn-danger {
    /* Reset button */
    background-color: #dc3545;
    /* Danger red */
    border: none;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
}

.modal .btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}



/* Scene content and buttons - using Bootstrap 5 layout */
.scene-options,
.item-buttons {
    /* Let Bootstrap handle the layout - these containers now use d-flex classes */
}

/* Remove old layout rules that conflict with Bootstrap */
/*
.scene-options {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto;
    padding: 0;
    gap: 3px;
}

.item-buttons {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
*/

/* Keep button styling but remove layout overrides */
.btn-custom.take-item-btn,
.btn-custom.navigation-btn {
    background-image: url('/static/images/log_button.png');
    background-color: transparent;
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    color: #FFFFFF;
    border: none;
    padding: 12px 40px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.3;
    min-width: 150px;
    margin: 0.25rem;
}

/* Improve z-index management */
:root {
    --z-base: 1;
    --z-inventory: calc(var(--z-base) + 10);
    --z-modal: calc(var(--z-inventory) + 10);
    --z-notification: calc(var(--z-modal) + 10);
}

/* Organize media queries */
@media screen {
    @media (max-width: 480px) {
        /* Mobile styles */
    }

    @media (min-width: 481px) and (max-width: 768px) {
        /* Tablet styles */
    }

    @media (min-width: 769px) {
        /* Desktop styles */
    }
}

/* Add animation for revealed items */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.revealed-item {
    animation: fadeIn 1s ease-in-out;
}

.revealed-item-btn {
    background-color: rgba(255, 215, 0, 0.5);
    /* Gold background */
    border: 2px solid gold;
    transition: all 0.3s ease;
}

.revealed-item-btn:hover {
    background-color: gold;
    color: black;
    transform: scale(1.05);
}

/* Add a subtle glowing effect for revealed items */
@keyframes glow {
    0% {
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    }

    50% {
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
    }

    100% {
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    }
}

.revealed-item-btn {
    animation: glow 2s infinite;
}

/* Add styling for dropped items with faster animation */
.dropped-item {
    animation: fadeIn 0.5s ease-out;
    /* Faster animation for dropped items */
}

.dropped-item-btn {
    background-color: rgba(65, 105, 225, 0.5);
    /* Royal blue background */
    border: 2px solid royalblue;
    transition: all 0.3s ease;
}

.dropped-item-btn:hover {
    background-color: royalblue;
    color: white;
    transform: scale(1.05);
}

/* Add a single pulse effect for dropped items that doesn't repeat */
@keyframes singlePulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.dropped-item-btn {
    animation: singlePulse 0.7s 1;
    /* Run animation only once with shorter duration */
}

/* Style for dropped items that have already been animated once */
.dropped-once .dropped-item-btn {
    animation: none !important;
    /* Prevent animation from playing again */
    transform: scale(1);
    /* Reset to normal scale */
    transition: all 0.3s ease;
    /* Keep transition effect for hover */
}

/* Keep hover effect for buttons that won't animate */
.dropped-once .dropped-item-btn:hover {
    background-color: royalblue;
    color: white;
    transform: scale(1.05);
}

/* ===== Scene Content Styles ===== */
.scene-preview {
    position: relative;
    z-index: var(--z-index-ui-element);
    margin-bottom: 20px;
}

/* Scene overlay styling */
.scene-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: var(--z-index-ui-element);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ===== REST API Refactoring Styles ===== */
/* These styles support the new REST API architecture and components */

/* Service loading indicators */
.api-loading {
    position: relative;
}

.api-loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: var(--z-index-overlay);
    display: flex;
    justify-content: center;
    align-items: center;
}

.api-loading::before {
    content: "Loading...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    z-index: calc(var(--z-index-overlay) + 1);
    font-weight: bold;
}

/* API error messages */
.api-error {
    padding: 20px;
    background-color: rgba(220, 53, 69, 0.9);
    color: white;
    border-radius: 8px;
    margin: 20px 0;
    text-align: center;
}

.api-error h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.api-error .btn {
    margin-top: 15px;
    background-color: white;
    color: var(--danger-color);
    border: none;
}

/* API success messages */
.api-success {
    padding: 20px;
    background-color: rgba(40, 167, 69, 0.9);
    color: white;
    border-radius: 8px;
    margin: 20px 0;
    text-align: center;
}

/* Scene transition animation */
@keyframes sceneTransition {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.scene-container.loading-new-scene {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.scene-container.scene-loaded {
    animation: sceneTransition 0.5s ease-out forwards;
}

/* Inventory item animations */
@keyframes itemAdded {
    0% {
        background-color: rgba(40, 167, 69, 0.8);
    }

    50% {
        background-color: rgba(40, 167, 69, 0.4);
    }

    100% {
        background-color: rgba(255, 255, 255, 0.1);
    }
}

.inventory-item.added {
    animation: itemAdded 2s ease-out forwards;
}

/* Service error retry button */
.retry-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    margin-top: 10px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.retry-button:hover {
    background-color: #3a5a8e;
}

/* API-specific status indicators */
.api-status {
    position: fixed;
    bottom: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    z-index: var(--z-index-notification);
    display: none;
}

.api-status.visible {
    display: block;
}

.api-status.connected {
    background-color: rgba(40, 167, 69, 0.7);
}

.api-status.disconnected {
    background-color: rgba(220, 53, 69, 0.7);
}

/* Enhanced mobile styling for API components */
@media (max-width: 480px) {

    .api-error,
    .api-success {
        padding: 15px;
        margin: 15px 0;
        font-size: 14px;
    }

    .api-status {
        bottom: 50px;
        /* Position above navigation buttons */
    }
}

/* Print styles for API content */
@media print {

    .api-loading::before,
    .api-loading::after,
    .api-status {
        display: none !important;
    }
}

/* Add new styles for portrait mode */
@media (orientation: portrait) {

    .btn-custom.navigation-btn,
    .btn-custom.take-item-btn {
        position: relative;
        z-index: var(--z-index-navigation);
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Mobile responsive button improvements */
@media (max-width: 767.98px) {

    .btn-custom.take-item-btn,
    .btn-custom.navigation-btn {
        min-height: 52px;
        padding: 14px 20px;
        font-size: 16px;
        min-width: 120px;
        /* Slightly smaller min-width on mobile */
        margin: 0.2rem;
    }

    /* Adjust gap for mobile */
    .d-flex.gap-2 {
        gap: 0.5rem !important;
    }
}

/* Improve touch feedback for all custom buttons */
.btn-custom:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* Ensure buttons maintain proper styling */
.btn-custom.navigation-btn,
.btn-custom.take-item-btn {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: manipulation;
}

/* ===== Enhanced Game Area Styling ===== */
/* Game area buttons within the constrained layout */
.btn-custom.take-item-btn,
.btn-custom.navigation-btn {
    background-image: url('/static/images/log_button.png');
    background-color: transparent;
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    color: #FFFFFF;
    border: none;
    padding: 12px 40px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.3;
    min-width: 150px;
    margin: 0.25rem;
}

/* Container adjustments for side-bordered layout */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
    z-index: var(--z-index-content);
    overflow-y: auto;
    max-height: calc(100vh - 80px - 31px);
    padding: var(--spacing-md) 0;
    /* Remove horizontal padding, let Bootstrap handle it */
}

/* Responsive adjustments for mobile */
@media (max-width: 767.98px) {
    .scene-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .scene-description {
        font-size: 1rem;
        margin-bottom: 1rem;
        padding: 6px 12px;
        /* Smaller padding on mobile */
    }

    .btn-custom.take-item-btn,
    .btn-custom.navigation-btn {
        min-height: 52px;
        padding: 14px 20px;
        font-size: 16px;
        min-width: 120px;
        /* Slightly smaller min-width on mobile */
        margin: 0.2rem;
    }

    /* Adjust gap for mobile */
    .d-flex.gap-2 {
        gap: 0.5rem !important;
    }
}

/* ===== Bootstrap Overrides for Zero Spacing ===== */
.navbar-dark {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

.bg-steel-blue {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

/* Override any Bootstrap container spacing */
.container-fluid {
    padding-left: 0 !important;
    /* Remove left padding globally */
    padding-right: 1rem !important;
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    margin: 0 !important;
}

/* Override any Bootstrap navbar spacing */
.navbar>.container-fluid {
    margin: 0 !important;
    padding: 0 0.5rem 0 0 !important;
    /* Ensure left padding is removed */
}

/* Override any anchor tag spacing in navbar */
.navbar .navbar-brand {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
    margin-left: 0 !important;
    /* Remove any left margin */
    border: none !important;
    outline: none !important;
}

/* Eliminate any image spacing issues */
.navbar .navbar-brand img {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    vertical-align: baseline !important;
    outline: none !important;
}

/* Override Bootstrap's align-top class */
.d-inline-block.align-top {
    vertical-align: baseline !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Force navbar to absolute top */
nav.navbar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 1030 !important;
}

/* Eliminate any possible browser defaults */
nav {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

/* Force the specific navbar classes */
.navbar.navbar-dark.bg-steel-blue {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100vw !important;
    z-index: 1030 !important;
}

/* Responsive positioning for inventory sidebar to match button */
@media (max-width: 767.98px) {
    .inventory-sidebar {
        right: 10px;
        /* Match mobile button positioning */
        top: 100px;
        /* Account for mobile button height */
    }
}

@media (max-width: 480px) {
    .inventory-sidebar {
        right: 5px;
        /* Match small mobile button positioning */
        top: 100px;
        width: calc(100vw - 20px);
        /* Full width minus margins on very small screens */
        max-width: 300px;
        /* But don't exceed this width */
    }
}
