/* Variables */
:root {
    --card-width: 300px;
    --card-height: 350px;
    --column-height: 380px;
    --border-color: #740000;
    --ludimus-accent-color: #e94560;
    --max-orders-per-row: 4;
    --max-order-rows: 1;
}

/* Overall game styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Barlow', sans-serif;
    background: linear-gradient(135deg, #ff6b6b, #ff0000);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    color: #2c3e50;
    overflow-x: hidden;
}

@keyframes gradientShift {
    0% {
        background-position: 0 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0 50%;
    }
}

.game-container {
    min-height: 100vh;
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 300px;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        "header header"
        "orders orders"
        "debug debug"
        "config config";
    gap: 20px;
}

/* Header styling */
.game-header {
    grid-area: header;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-header h1 {
    font-size: 2.5em;
    color: #e74c3c;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.game-stats {
    display: flex;
    gap: 30px;
    align-items: center;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(52, 152, 219, 0.1);
    padding: 8px 15px;
    border-radius: 20px;
    border: 2px solid var(--border-color)
}

.stat-label {
    font-size: 1em;
    font-weight: bold;
    color: #2c3e50;
}

.stat-value {
    font-size: 1.2em;
    font-weight: bold;
    color: #e74c3c;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

#game-timer {
    color: #27ae60;
    font-family: 'Courier New', monospace;
    min-width: 50px;
}

#game-timer.warning {
    color: #f39c12;
    animation: pulse 1s infinite;
}

#game-timer.danger {
    color: #e74c3c;
    animation: intense-pulse 0.5s infinite;
}

@keyframes intense-pulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Order panel - main feature */
.order-panel {
    grid-area: orders;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(15px);
    border: 3px solid var(--border-color);
}

.order-panel h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.8em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.orders-container {
    display: grid;
    grid-template-columns: repeat(var(--max-orders-per-row), var(--column-width));
    grid-template-rows: repeat(var(--max-order-rows), var(--column-height));
    gap: 25px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 15px;
    justify-content: center;
    align-content: start;
    /* Hide scrollbar for Chrome, Safari and Opera */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.orders-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

/* Individual order cards */
.order-card {
    background: linear-gradient(135deg, #fff, #f8f9fa);
    border-radius: 15px;
    padding: 15px;
    border-left: 6px solid var(--border-color);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    transform: translateX(0);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    width: var(--card-width);
    min-height: var(--card-height);
    max-height: var(--card-height);
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: stretch;
}

.order-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-right: 15px;
}

.order-emoji-section {
    height: 33.33%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.order-image-section {
    height: 66.67%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.order-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Order states - customer anger levels */
.order-card.calm {
    border-left-color: #27ae60;
    background: linear-gradient(135deg, #d5f4e6, #f8f9fa);
}

.order-card.worried {
    border-left-color: #f39c12;
    background: linear-gradient(135deg, #fdeaa7, #f8f9fa);
    animation: pulse 2s infinite;
}

.order-card.angry {
    border-left-color: #e74c3c;
    background: linear-gradient(135deg, #fadbd8, #f8f9fa);
    animation: shake 0.5s infinite alternate;
}

.order-card.furious {
    border-left-color: #8e44ad;
    background: linear-gradient(135deg, #f4ecf7, #fadbd8);
    animation: intense-shake 0.3s infinite;
}

.order-card.leaving {
    border-left-color: #7f8c8d;
    background: linear-gradient(135deg, #bdc3c7, #ecf0f1);
    animation: super-intense-shake-rotate 0.2s infinite;
}

.order-card.completed {
    border-left-color: #27ae60;
    background: linear-gradient(135deg, #d5f4e6, #abebc6);
    animation: completion-flash 0.5s ease-out;
    cursor: default;
}

.order-card:not(.completed) {
    cursor: pointer;
}

.order-card:not(.completed):hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-left-width: 8px;
}

.order-card.placeholder {
    visibility: hidden;
    pointer-events: none;
}

.food-icon {
    width: 180px;
    height: 180px;
    margin: 0 5px;
}

@keyframes completion-flash {
    0% {
        background: linear-gradient(135deg, #f1c40f, #f39c12);
        transform: scale(1.1);
    }

    50% {
        background: linear-gradient(135deg, #2ecc71, #27ae60);
        transform: scale(1.05);
    }

    100% {
        background: linear-gradient(135deg, #d5f4e6, #abebc6);
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }
}

@keyframes shake {
    0% {
        transform: translateX(-2px);
    }

    100% {
        transform: translateX(2px);
    }
}

@keyframes intense-shake {
    0% {
        transform: translateX(-3px) rotate(-1deg);
    }

    25% {
        transform: translateX(3px) rotate(1deg);
    }

    50% {
        transform: translateX(-3px) rotate(-1deg);
    }

    75% {
        transform: translateX(3px) rotate(1deg);
    }

    100% {
        transform: translateX(-3px) rotate(-1deg);
    }
}

@keyframes super-intense-shake-rotate {
    0% {
        transform: translateX(-4px) rotate(-4deg);
    }

    20% {
        transform: translateX(4px) rotate(4deg);
    }

    40% {
        transform: translateX(-4px) rotate(-4deg);
    }

    60% {
        transform: translateX(4px) rotate(4deg);
    }

    80% {
        transform: translateX(-4px) rotate(-4deg);
    }

    100% {
        transform: translateX(4px) rotate(4deg);
    }
}

/* Order content */
.order-emoji-section {
    height: 33.33%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.order-image-section {
    height: 66.67%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.customer-state {
    font-size: 4em;
    text-align: center;
    line-height: 1;
}

.keyboard-shortcut {
    background: var(--ludimus-accent-color);
    color: white;
    padding: 4px 8px;
    border-radius: 10px;
    font-size: 0.7em;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.3);
    text-align: center;
    min-width: 24px;
}

.order-card.completed .keyboard-shortcut {
    display: none;
}

.customer-state.calm {
    background: transparent;
    color: inherit;
}

.customer-state.worried {
    background: transparent;
    color: inherit;
}

.customer-state.angry {
    background: transparent;
    color: inherit;
}

.customer-state.furious {
    background: transparent;
    color: inherit;
}

.customer-state.leaving {
    background: transparent;
    color: inherit;
}

.order-items {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.order-items h4 {
    color: #34495e;
    margin-bottom: 6px;
    font-size: 0.9em;
}

.item-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.food-item {
    background: var(--ludimus-accent-color);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.order-points {
    margin-bottom: 8px;
    text-align: center;
    color: #27ae60;
    font-size: 2em;
}

.timer-container {
    width: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    height: 100%;
}

.timer-top-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    justify-content: flex-start;
}

.timer-bottom-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
}

.timer-label {
    text-orientation: mixed;
    margin-bottom: 8px;
    font-size: 0.7em;
    color: #2c3e50;
    font-weight: bold;
    text-align: center;
}

.timer-bar {
    width: 12px;
    height: 240px;
    background: #ecf0f1;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    margin: 10px 0;
}

.timer-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(0deg, #e74c3c, #f39c12, #27ae60);
    border-radius: 6px;
    position: relative;
}

.timer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: #ecf0f1;
    border-radius: 6px;
    transition: height 0.1s linear;
}

@keyframes shimmer-vertical {
    0% {
        transform: translateY(-100%);
    }

    100% {
        transform: translateY(100%);
    }
}

/* Control panel */
.control-panel {
    grid-area: config;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    height: fit-content;
}

.control-panel h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
}

.control-btn {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, var(--ludimus-accent-color), rgb(255, 157, 157));
    color: white;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn.danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.control-btn.danger:hover {
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

/* Debug panel */
.debug-panel {
    grid-area: debug;
    background: rgba(44, 62, 80, 0.9);
    color: #ecf0f1;
    border-radius: 10px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    backdrop-filter: blur(10px);
}

.debug-panel h4 {
    margin-bottom: 10px;
    color: #3498db;
}

/* Responsive design */
@media (max-width: 768px) {
    .game-container {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "orders"
            "config"
            "debug";
    }

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

    .game-header h1 {
        font-size: 2em;
    }

    .orders-container {
        grid-template-columns: repeat(2, 250px);
        grid-template-rows: repeat(6, 180px);
        gap: 20px;
        padding: 10px;
    }

    .order-card {
        width: auto;
        min-width: 250px;
        padding: 12px;
    }

    /* Update grid positions for mobile */
    .order-card[data-grid-position="1"] {
        grid-column: 1;
        grid-row: 6;
    }

    .order-card[data-grid-position="2"] {
        grid-column: 2;
        grid-row: 6;
    }

    .order-card[data-grid-position="3"] {
        grid-column: 1;
        grid-row: 5;
    }

    .order-card[data-grid-position="4"] {
        grid-column: 2;
        grid-row: 5;
    }

    .order-card[data-grid-position="5"] {
        grid-column: 1;
        grid-row: 4;
    }

    .order-card[data-grid-position="6"] {
        grid-column: 2;
        grid-row: 4;
    }

    .order-card[data-grid-position="7"] {
        grid-column: 1;
        grid-row: 3;
    }

    .order-card[data-grid-position="8"] {
        grid-column: 2;
        grid-row: 3;
    }

    .order-card[data-grid-position="9"] {
        grid-column: 1;
        grid-row: 2;
    }

    .order-card[data-grid-position="10"] {
        grid-column: 2;
        grid-row: 2;
    }

    .order-card[data-grid-position="11"] {
        grid-column: 1;
        grid-row: 1;
    }

    .order-card[data-grid-position="12"] {
        grid-column: 2;
        grid-row: 1;
    }

    .timer-container {
        width: 25px;
        padding: 8px 0;
    }

    .timer-bar {
        height: 100px;
        width: 10px;
        margin: 8px 0;
    }

    .keyboard-shortcut {
        font-size: 0.6em;
        padding: 2px 4px;
        min-width: 20px;
    }
}

/* Entry animation for new orders - from bottom */
@keyframes slideInFromBottom {
    0% {
        transform: translateY(100%);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.order-card.new-order {
    animation: slideInFromBottom 0.5s ease-out;
}

/* Exit animation for removed orders - fade out in place */
@keyframes fadeOut {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(0.8);
        opacity: 0;
    }
}

.order-card.removing {
    animation: fadeOut 0.3s ease-in forwards;
}

/* Grid position classes for fixed layout CURRENTLY BROKEN */
.order-card[data-grid-position="1"] {
    grid-column: 1;
    grid-row: 1;
}

.order-card[data-grid-position="2"] {
    grid-column: 2;
    grid-row: 1;
}

.order-card[data-grid-position="3"] {
    grid-column: 3;
    grid-row: 1;
}

.order-card[data-grid-position="4"] {
    grid-column: 4;
    grid-row: 1;
}

.order-card[data-grid-position="5"] {
    grid-column: 1;
    grid-row: 2;
}

.order-card[data-grid-position="6"] {
    grid-column: 2;
    grid-row: 2;
}

.order-card[data-grid-position="7"] {
    grid-column: 3;
    grid-row: 2;
}

.order-card[data-grid-position="8"] {
    grid-column: 4;
    grid-row: 2;
}

.order-card[data-grid-position="9"] {
    grid-column: 1;
    grid-row: 3;
}

.order-card[data-grid-position="10"] {
    grid-column: 2;
    grid-row: 3;
}

.order-card[data-grid-position="11"] {
    grid-column: 3;
    grid-row: 3;
}

.order-card[data-grid-position="12"] {
    grid-column: 4;
    grid-row: 3;
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(135deg, #fff, #f8f9fa);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 3px solid #3498db;
    animation: modalAppear 0.3s ease-out;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    width: 90%;
}

@keyframes modalAppear {
    0% {
        transform: scale(0.7);
        opacity: 0;
    }

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

.modal-content h2 {
    color: #e74c3c;
    margin-bottom: 20px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.final-score {
    margin: 20px 0;
    font-size: 1.2em;
}

.final-score p {
    margin: 10px 0;
    color: #2c3e50;
    font-weight: bold;
}

.final-score span {
    color: #e74c3c;
    font-size: 1.3em;
}

/* Order log section in modal */
.order-log-section {
    margin: 30px 0;
    text-align: left;
}

.order-log-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.5em;
}

.order-log-container {
    max-height: 300px;
    overflow-y: auto;
    border: 2px solid #ecf0f1;
    border-radius: 10px;
    padding: 15px;
    background: #fafafa;
}

.order-log-item {
    background: white;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    border-left: 4px solid #27ae60;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.order-log-item:hover {
    transform: translateY(-1px);
}

.order-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: bold;
}

.order-log-number {
    color: #2c3e50;
    font-size: 1.1em;
}

.order-log-time {
    color: #7f8c8d;
    font-family: 'Courier New', monospace;
}

.order-log-points {
    color: #27ae60;
    font-size: 1.1em;
}

.order-log-details {
    margin-top: 8px;
}

.order-log-items {
    color: #34495e;
    font-weight: bold;
    margin-bottom: 5px;
}

.order-log-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
}

.completion-time {
    color: #7f8c8d;
}

.customer-state-log {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8em;
    font-weight: bold;
    text-transform: uppercase;
}

.customer-state-log.calm {
    background: #27ae60;
    color: white;
}

.customer-state-log.worried {
    background: #f39c12;
    color: white;
}

.customer-state-log.angry {
    background: #e74c3c;
    color: white;
}

.customer-state-log.furious {
    background: #8e44ad;
    color: white;
}

.customer-state-log.leaving {
    background: #7f8c8d;
    color: white;
}

.no-orders {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    padding: 20px;
}

/* Points notification */
.points-notification {
    position: absolute;
    top: -30px;
    right: 10px;
    background: linear-gradient(135deg, #f1c40f, #f39c12);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 0.9em;
    animation: pointsFloat 1.5s ease-out forwards;
    pointer-events: none;
    z-index: 100;
}

@keyframes pointsFloat {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    50% {
        transform: translateY(-20px) scale(1.2);
        opacity: 1;
    }

    100% {
        transform: translateY(-40px) scale(0.8);
        opacity: 0;
    }
}

/* Configuration Panel */
.config-panel {
    grid-area: config;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid #e74c3c;
    margin-bottom: 20px;
}

.config-panel h4 {
    color: #e74c3c;
    margin-bottom: 15px;
    font-size: 1.2em;
    font-weight: 600;
}

.config-form {
    margin-top: 15px;
}

.config-form.hidden {
    display: none;
}

.config-group {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.config-group label {
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.9em;
}

.config-group input[type="number"] {
    padding: 8px 12px;
    border: 2px solid #bdc3c7;
    border-radius: 8px;
    font-size: 0.9em;
    transition: border-color 0.3s ease;
}

.config-group input[type="number"]:focus {
    outline: none;
    border-color: #e74c3c;
}

.config-group input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
}

.config-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.config-actions .control-btn {
    flex: 1;
    font-size: 0.9em;
    padding: 8px 12px;
}

/* Mobile responsive for config panel */
@media (max-width: 768px) {
    .config-panel {
        margin-bottom: 10px;
        padding: 15px;
    }

    .config-actions {
        flex-direction: column;
    }

    .config-actions .control-btn {
        width: 100%;
    }
}