:root {
    --primary-color: #D42426;
    /* Santa Red */
    --primary-dark: #A61B1D;
    --secondary-color: #165B33;
    /* Pine Green */
    --accent-color: #F8B229;
    /* Gold */
    --bg-color: #0F172A;
    /* Dark Night Blue */
    --card-bg: #1E293B;
    --text-light: #F1F5F9;
    --text-muted: #94A3B8;
    --success-color: #10B981;
    --error-color: #EF4444;
    --font-main: 'Outfit', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-light);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.app-container {
    width: 100%;
    max-width: 900px;
    background-color: rgba(15, 23, 42, 0.95);
    min-height: 100vh;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

/* Hero Section */
.hero-section {
    position: relative;
    height: 250px;
    overflow: hidden;
    border-bottom: 4px solid var(--accent-color);
    flex-shrink: 0;
}

.hero-image-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.3), rgba(15, 23, 42, 0.9));
}

.hero-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 2rem;
    text-align: center;
    z-index: 10;
}

.hero-content h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-light);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.hero-description {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Main Content */
.main-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex: 1;
}

.card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--accent-color);
}

.card p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    width: 100%;
    font-family: var(--font-main);
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(212, 36, 38, 0.3);
}

.primary-btn:hover {
    filter: brightness(1.1);
    transform: scale(1.02);
}

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

.secondary-btn:hover:not(:disabled) {
    background-color: #1a6b3d;
    transform: scale(1.02);
}

.secondary-btn:disabled {
    background-color: #334155;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Upload Area */
.upload-area {
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent-color);
    background-color: rgba(255, 255, 255, 0.02);
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.upload-label .icon {
    font-size: 2rem;
}

.file-name {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--accent-color);
    font-weight: 600;
}

/* Result Area */
.result-area {
    border-radius: 12px;
    animation: fadeIn 0.5s ease;
}

.result-area.hidden {
    display: none;
}

.result-success {
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    text-align: left;
}

.result-summary {
    padding: 1rem;
    text-align: right;
}

.result-error {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #FCA5A5;
}

.unique-code {
    display: block;
    font-family: monospace;
    font-size: 2rem;
    color: var(--accent-color);
    margin: 1rem 0;
    letter-spacing: 0.1em;
    font-weight: 800;
}

footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

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

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

@media (max-width: 600px) {
    .hero-content h1 {
        font-size: 1.8rem;
    }
}

/* Map Grid Styles */
.map-grid {
    display: grid;
    gap: 1px;
    background-color: #334155;
    /* Grid line color */
    border: 1px solid #334155;
    margin: 0 auto;
    font-family: monospace;
}

.map-cell {
    background-color: #1E293B;
    /* Default cell bg */
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #94A3B8;
    position: relative;
    user-select: none;
}

.cell-building {
    background-color: #475569;
    color: #F1F5F9;
}

.cell-river {
    background-color: #3B82F6;
    color: white;
}

.cell-street {
    background-color: #0F172A;
}

.cell-fortune {
    background: linear-gradient(135deg, #7C3AED, #F59E0B);
    color: white;
    font-weight: bold;
    box-shadow: 0 0 5px rgba(245, 158, 11, 0.5);
    z-index: 5;
}

.path-highlight {
    /* Base style for path cells, color applied dynamically */
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    transition: opacity 0.3s ease, filter 0.3s ease;
}

.map-grid.has-selection .path-highlight {
    opacity: 0.1;
    filter: grayscale(100%);
}

.path-selected {
    background-color: white !important;
    box-shadow: 0 0 8px white, inset 0 0 0 1px white !important;
    z-index: 20;
    color: black !important;
}

.map-grid.has-selection .path-highlight.path-selected {
    opacity: 1;
    filter: none;
}

/* Orders Table */
.orders-table-container {
    overflow-x: auto;
    margin-top: 2rem;
}

.orders-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.orders-table th,
.orders-table td {
    padding: 0.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.orders-table th {
    color: var(--accent-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

.orders-table tr {
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.orders-table tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.orders-table tr.selected-row {
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: inset 3px 0 0 var(--accent-color);
}

.color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 0.5rem;
    vertical-align: middle;
}