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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #323130;
}

.header {
    background-color: #005a70;
    color: white;
    padding: 15px 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
}

.header .subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 5px;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.tabs {
    display: flex;
    background-color: white;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.tab {
    flex: 1;
    padding: 15px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #605e5c;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab:hover {
    background-color: #f3f2f1;
    color: #323130;
}

.tab.active {
    color: #005a70;
    border-bottom-color: #005a70;
    background-color: #f8f9fa;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.dashboard-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #edebe9;
}

.card-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #edebe9;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: #323130;
}

.card-subtitle {
    font-size: 12px;
    color: #605e5c;
    margin-top: 2px;
}

.metric-value {
    font-size: 32px;
    font-weight: 700;
    color: #005a70;
    margin: 10px 0;
}

.metric-label {
    font-size: 14px;
    color: #605e5c;
    margin-bottom: 5px;
}

.metric-change {
    font-size: 12px;
    font-weight: 500;
}

.metric-change.positive {
    color: #107c10;
}

.metric-change.negative {
    color: #d13438;
}

.chart-container {
    height: 300px;
    width: 100%;
    margin-top: 15px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #edebe9;
}

.data-table th {
    background-color: #f3f2f1;
    font-weight: 600;
    color: #323130;
    font-size: 14px;
}

.data-table td {
    font-size: 13px;
    color: #323130;
}

.data-table tr:hover {
    background-color: #f8f9fa;
}

.full-width {
    grid-column: 1 / -1;
}

/* Enhanced table styling for better layout */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 12px;
    table-layout: fixed;
}

.data-table th,
.data-table td {
    padding: 8px 6px;
    text-align: left;
    border-bottom: 1px solid #edebe9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table th {
    background-color: #f3f2f1;
    font-weight: 600;
    color: #323130;
    font-size: 11px;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Purchase Timing Table specific column widths */
#purchaseTimingTable th:nth-child(1) { width: 10%; }
#purchaseTimingTable th:nth-child(2) { width: 18%; }
#purchaseTimingTable th:nth-child(3) { width: 12%; }
#purchaseTimingTable th:nth-child(4) { width: 12%; }
#purchaseTimingTable th:nth-child(5) { width: 13%; }
#purchaseTimingTable th:nth-child(6) { width: 11%; }
#purchaseTimingTable th:nth-child(7) { width: 24%; }

#purchaseTimingTable td:nth-child(1) { width: 10%; }
#purchaseTimingTable td:nth-child(2) { width: 18%; text-align: center; }
#purchaseTimingTable td:nth-child(3) { width: 12%; text-align: center; }
#purchaseTimingTable td:nth-child(4) { width: 12%; text-align: center; }
#purchaseTimingTable td:nth-child(5) { width: 13%; text-align: center; }
#purchaseTimingTable td:nth-child(6) { width: 11%; text-align: center; }
#purchaseTimingTable td:nth-child(7) { width: 24%; text-align: right; }

/* Make table scrollable on smaller screens */
.table-container {
    overflow-x: auto;
    max-width: 100%;
    margin: 10px 0;
}

/* Responsive table styling */
@media (max-width: 1200px) {
    .data-table {
        font-size: 11px;
    }
    
    .data-table th,
    .data-table td {
        padding: 6px 4px;
    }
}

.recommendations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

.recommendation-card {
    background: linear-gradient(135deg, #005a70 0%, #0078d4 100%);
    color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.recommendation-card h3 {
    font-size: 18px;
    margin-bottom: 15px;
}

.recommendation-item {
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
    border-left: 4px solid #ffffff;
}

.recommendation-item:last-child {
    margin-bottom: 0;
}

.recommendation-title {
    font-weight: 600;
    margin-bottom: 5px;
}

.recommendation-detail {
    font-size: 12px;
    opacity: 0.9;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.kpi-card {
    background: white;
    border-radius: 6px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-left: 4px solid #005a70;
}

.filter-bar {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-label {
    font-size: 12px;
    font-weight: 500;
    color: #605e5c;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid #c7c5c4;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    color: #323130;
    min-width: 120px;
}

.filter-select:focus {
    outline: none;
    border-color: #005a70;
}

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: #605e5c;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Chatbot Styles */
.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.chatbot-toggle {
    background: linear-gradient(135deg, #005a70 0%, #0078d4 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    font-size: 18px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.chatbot-toggle .eva-text {
    font-size: 10px;
    font-weight: 500;
    margin-top: 2px;
}

.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.chatbot-window.open {
    display: flex;
}

.chatbot-header {
    background: linear-gradient(135deg, #005a70 0%, #0078d4 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-title {
    font-size: 16px;
    font-weight: 600;
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.chat-message {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}

.chat-message.eva {
    align-items: flex-start;
}

.chat-message.user {
    align-items: flex-end;
}

.message-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
}

.chat-message.eva .message-bubble {
    background: white;
    color: #323130;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chat-message.user .message-bubble {
    background: #005a70;
    color: white;
    border-bottom-right-radius: 6px;
}

.message-sender {
    font-size: 11px;
    color: #605e5c;
    margin-bottom: 4px;
    font-weight: 500;
}

.chat-message.user .message-sender {
    text-align: right;
}

.chatbot-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #edebe9;
    display: flex;
    gap: 8px;
}

.chatbot-input {
    flex: 1;
    border: 1px solid #c7c5c4;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
}

.chatbot-input:focus {
    border-color: #005a70;
}

.chatbot-send {
    background: #005a70;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-send:hover {
    background: #0078d4;
}

.chatbot-send:disabled {
    background: #c7c5c4;
    cursor: not-allowed;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #605e5c;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}