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

body {
    font-family: 'Roboto', Tahoma, Geneva, Verdana, sans-serif;
    background: #fff;
    min-height: 100vh;
    padding: 5px;
}

.container {
    max-width: 100%;
    margin: 0 0;
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 5px;
    height: calc(100vh - 10px);
    transition: grid-template-columns 0.3s ease;
}

.container.chatbot-hidden {
    grid-template-columns: 1fr 0px;
}

.main-content {
    background: white;
    border-radius: 5px;
    padding: 0px 10px 10px 10px;
    box-shadow: 0 5px 5px rgba(0,0,0,0.3);
    overflow-x: visible;
    display: flex;
    flex-direction: column;
    position: relative; /* test */
    overflow-y: auto;
    scrollbar-width: none; 
    -ms-overflow-style: none; 
}

.chatbot-panel {
    background: white;
    border-radius: 5px;
    box-shadow: 0 5px 5px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

.container.chatbot-hidden .chatbot-panel {
    opacity: 0;
    visibility: hidden;
    width: 0;
    min-width: 0;
}

.toggle-chatbot-btn {
    position: absolute;
    right: 26%;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 60px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    z-index: 10;
}

.toggle-chatbot-btn.shifted {
    right: 3px;
}

/* .toggle-chatbot-btn {
    position: absolute;
    right: -15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 60px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    z-index: 3;
} */

.toggle-chatbot-btn:hover {
    background: #f0f0f0;
    width: 25px;
}

.toggle-chatbot-btn .material-icons {
    font-size: 20px;
    color: #3A94C5;
    transition: transform 0.3s ease;
}

.container.chatbot-hidden .toggle-chatbot-btn .material-icons {
    transform: rotate(180deg);
}

h1 {
    color: #3A94C5;
    font-size: 20px;
    font-weight: 400;
}

.header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 20px;
    max-height: 36px;
    flex: 1;
}

.date-selector {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.date-selector label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.province-dropdown, .date-input{
    padding: 5px 5px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    color: #333;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    outline: none;
    /* min-width: 120px; */
}

.province-dropdown {
    min-width: 140px;
}

.date-input {
    min-width: 120px;
}

.province-dropdown:hover, .date-input:hover {
    border-color: #3A94C5;
}

.province-dropdown:focus, .date-input:focus {
    border-color: #3A94C5;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: auto 1fr 1fr;;
    gap: 10px;
    flex: 1;
}

.container.chatbot-hidden .stats-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: auto auto auto;
}

/* .container.chatbot-hidden .line-chart {
    grid-column: 1 / 3;
    grid-row: 2 / 4;
}

.container.chatbot-hidden .bar-chart-1 {
    grid-column: 3 / 5;
    grid-row: 2 / 3;
}

.container.chatbot-hidden .bar-chart-2 {
    grid-column: 3 / 5;
    grid-row: 3 / 4;
} */

.stat-card {
    color: white;
    padding: 15px;
    border-radius: 5px;
    border-bottom: 4px transparent;
    position: relative;
    overflow: visible;
    transition: transform 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: grid;
    grid-template-columns: 1.2fr auto;
    grid-template-rows: auto 1fr;
    gap: 10px;
    min-height: 100px;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    color: #000;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.stat-card.lowest {
    background: #00e40022;
    transition: 0.5s ease;
}

.stat-card.lowest:hover {
    border-bottom: solid 4px #00e400aa;
    background: #00e40033;
}

.stat-card.highest {
    background: #ff000022;
    transition: 0.5s ease;
}

.stat-card.highest:hover {
    border-bottom: solid 4px #ff0000aa; 
    background: #ff000033;
}

.stat-card.average {
    background: #ffff0022;
    transition: 0.5s ease;
}

.stat-card.average:hover {
    border-bottom: solid 4px #ffff00aa;
    background: #ffff0033;
}

.stat-card.bad-quality {
    background: #0096FF22;
    transition: 0.5s ease;
}

.stat-card.bad-quality:hover {
    border-bottom: solid 4px #0096FFaa;
    background: #0096FF33;
}

.stat-label {
    color: #000a;
    font-size: 13px;
    white-space: nowrap;
    text-overflow: ellipsis;

    opacity: 0.9;
    margin-bottom: 8px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    grid-column: 1;
    grid-row: 1;
    align-self: start;
}

.info-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(0, 0, 0, 0.4);
    color: rgba(0, 0, 0, 0.4);
    font-size: 14px;
    font-weight: bold;
    cursor: help;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 5;
}

.info-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.info-popup {
    position: absolute;
    top: 100%;
    right: 0;
    width: 200px;
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: rgba(0, 0, 0, 0.7);
    padding: 10px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
    font-weight: 300;
    font-style: italic;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 10;
    pointer-events: none;
}

.info-popup::before {
    content: '';
    position: absolute;
    bottom: 100%;
    right: 8px;
    border: 6px solid transparent;
    border-bottom-color: rgba(0, 0, 0, 0.9);
}

.info-btn:hover .info-popup {
    opacity: 1;
    visibility: visible;
}

.stat-city {
    color: #000a;
    font-size: 20px;
    font-weight: 600;
    grid-column: 2;
    grid-row: 2;
    align-self: end;
    /* margin-bottom: 10px; */
}

.stat-value-container {
    grid-column: 1;
    grid-row: 2;
    align-self: end;
    text-align: right;
    display: flex; 
    align-items: baseline;
    gap: 6px;
}

.stat-value {
    color: #000a;
    font-size: 20px;
    font-weight: 500;
    /* line-height: 1; */
    /* margin-bottom: 5px; */
}

.stat-unit {
    color: #000a;
    font-size: 14px;
    opacity: 0.8;
}

.line-chart {
    grid-column: 1 / 4;
    grid-row: 2 / 3;
    min-height: 310px;
}

.bar-chart-1 {
    grid-column: 1 / 4;
    grid-row: 3 / 4;
    min-height: 310px;
}

.bar-chart-2 {
    grid-column: 4 / 5;
    grid-row: 2 / 4;
    min-height: 600px;
}

.chart-container.bar-chart-2 {
    padding: 0
}

.chart-container {
    background: white;
    border-radius: 5px;
    border-bottom: solid 4px transparent;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: 0.5s ease;
}

.chart-container:hover {
    border-bottom: solid 4px #3A94C5aa;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

.chart {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chatbot styles */
.chat-header {
    background: #3A94C5dd;
    color: white;
    padding: 10px 10px;
    font-weight: bold;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.message {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: #3A94C5;
}

.message.bot .message-avatar {
    background: #764ba2;
}

.message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 15px;
    line-height: 1.5;
}

.message.user .message-content {
    background: #3A94C5;
    color: white;
    border-bottom-right-radius: 5px;
}

.message.bot .message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.chat-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.chat-input:focus {
    border-color: #667eea;
}

.send-btn {
    padding: 12px 24px;
    background: #3A94C5;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s;
}

.send-btn:hover {
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.typing-indicator {
    display: none;
    padding: 10px;
    color: #666;
    font-style: italic;
}

.typing-indicator.active {
    display: block;
}

.quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.quick-question {
    padding: 8px 14px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-question:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

@media (max-width: 968px) {
    .container {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .chatbot-panel {
        height: 500px;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.page-switch {
    height: 80%;
    aspect-ratio: 1 / 1;
    padding: 0;
    margin: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.page-switch:hover {
    background: #f0f0f0;
    border-color: #999;
    color: var(--primary-color);
    background-color: var(--primary-color-10);
}

.dropdown-menu {
    z-index: 5;
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    z-index: 100;
}

.dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0px);
}

.dropdown-section {
    padding: 12px 16px;
}

.dropdown-section:not(:last-child) {
    border-bottom: 1px solid #eee;
}

.section-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 8px;
    font-weight: 600;
}

.language-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.language-select:hover {
    border-color: #999;
}

.language-select:focus {
    outline: none;
    border-color: #4CAF50;
}

.nav-button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s ease;
    text-decoration: none;
}

.nav-button:hover {
    background: #45a049;
}

.nav-button:active {
    transform: scale(0.98);
}

.nav-button .material-icons {
    font-size: 18px;
    color: white;
}

#map,
.leaflet-container,
.leaflet-pane {
    background: #ffffff !important;
}