/* Custom CSS for AI Analytics Chatbot */

:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --login-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --login-card-bg: rgba(255, 255, 255, 0.95);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f6fa;
    margin: 0;
    padding: 0;
}

/* Sidebar Styles */
.sidebar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 0;
    color: white;
}

.sidebar-content {
    padding: 2rem 1.5rem;
    height: 100vh;
    overflow-y: auto;
}

.client-groups-section,
.metrics-section,
.query-history {
    margin-bottom: 1.5rem;
}

.client-groups-section h5,
.metrics-section h5,
.query-history h5 {
    color: white;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

/* Full Width Header */
.full-width-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 0;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.full-width-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.full-width-header p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0;
}

/* Main Content Styles */
.main-content {
    padding: 2rem;
    background-color: white;
    min-height: 100vh;
}

.main-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.main-header h1 {
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.main-header p {
    color: var(--secondary-color);
    font-size: 1.1rem;
}

/* Query Section */
.query-section {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

/* Query Suggestions in Main Content */
.query-suggestions {
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.query-suggestions #suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.suggestion-item {
    background: rgba(0, 123, 255, 0.1);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
    border: 1px solid rgba(0, 123, 255, 0.2);
    color: var(--primary-color);
    font-weight: 500;
}

.suggestion-item:hover {
    background: rgba(0, 123, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

.input-group {
    margin-bottom: 1rem;
}

#query-input {
    border-radius: 25px;
    padding: 0.75rem 1.5rem;
    border: 2px solid #e9ecef;
    font-size: 1rem;
    transition: all 0.3s ease;
    margin-right: 10px;
}

#query-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

#submit-query {
    border-radius: 25px;
    padding: 0.75rem 2rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

#submit-query:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

#clear-response {
    border-radius: 25px;
    padding: 0.75rem 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-left: 0.5rem;
}

#clear-response:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
    background-color: #6c757d;
    color: white;
}

.query-examples {
    margin-top: 1rem;
}

/* Results Section */
.results-section {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 1rem;
}

/* SQL Query Styles */
.sql-query-section {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 0.75rem;
    border-left: 4px solid #007bff;
    margin-bottom: 0.75rem;
}

.sql-query-section h6 {
    color: #007bff;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.sql-query-box {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    overflow-x: auto;
}

.sql-query-box code {
    color: #495057;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8rem;
    line-height: 1.3;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Analytics Results Styling */
.analytics-results {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.totals-section {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.campaign-breakdown {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.campaign-section {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.totals-section .card {
    transition: transform 0.2s ease;
}

.totals-section .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.campaign-breakdown .card {
    transition: transform 0.2s ease;
}

.campaign-breakdown .card:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}

/* Compact card styling for smaller metric boxes */
.compact-card {
    transition: transform 0.2s ease;
    min-height: 80px;
}

.compact-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.compact-card .card-body {
    padding: 0.5rem !important;
}

.compact-card .card-title {
    font-size: 0.75rem;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.compact-card .card-text {
    font-size: 1rem !important;
    line-height: 1.2;
}

.client-totals-section {
    background: white;
    border-radius: 6px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 0.75rem;
}

.client-section {
    background: #f8f9fa;
    border-radius: 4px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.results-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.results-header h4 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.results-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.results-content {
    padding: 1rem;
}

/* Loading Section */
.loading-section {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Error Section */
.error-section {
    margin-bottom: 2rem;
}

.alert {
    border-radius: 15px;
    border: none;
    padding: 1.5rem;
}

/* Welcome Section */
.welcome-section {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.features {
    margin-top: 3rem;
}

.feature-card {
    padding: 2rem 1rem;
    text-align: center;
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-card i {
    margin-bottom: 1rem;
}

.feature-card h5 {
    color: var(--dark-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--secondary-color);
    font-size: 0.9rem;
}

/* Client Groups and Metric Styles */
#client-groups-list,
#metrics-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.4rem;
}

.client-group-item,
.metric-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.75rem;
    border: 1px solid transparent;
    line-height: 1.2;
    text-align: center;
    min-height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.client-group-item:hover,
.metric-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.client-group-item {
    color: white; /* White text for client groups */
    font-weight: 500;
}

.metric-item {
    color: white; /* White text for metrics */
    flex-direction: column;
    padding: 0.3rem 0.4rem;
}

.metric-item .metric-name {
    font-weight: 600;
    margin-bottom: 0.1rem;
    font-size: 0.7rem;
    text-align: center;
}


/* History Styles */
.history-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
}

.history-item .query-text {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.history-item .query-meta {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Results Table Styles */
.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.results-table th,
.results-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
    font-size: 0.85rem;
}

.results-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: var(--dark-color);
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        min-height: auto;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .query-section {
        padding: 1rem;
    }
    
    .results-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .features .row {
        flex-direction: column;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* Custom Scrollbar */
.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

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

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Ratio Calculation Section */
.ratio-calculation-section {
    background: #e8f5e8;
    border: 1px solid #28a745;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.ratio-calculation-section h6 {
    color: #155724;
    margin-bottom: 10px;
    font-weight: 600;
}

.ratio-calculation-box {
    background: #ffffff;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    padding: 15px;
}

.calculation-step {
    background: #f8f9fa;
    border-left: 4px solid #28a745;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 0 4px 4px 0;
}

.calculation-step code {
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    color: #495057;
}

.calculation-result {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    padding: 15px;
    border-radius: 4px;
    font-size: 18px;
    font-weight: 600;
}

/* Query Information Panel Styles */
.query-info-panel {
    animation: slideDown 0.3s ease-out;
}

.query-info-panel .card {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

.query-info-panel .card-header {
    border-radius: 8px 8px 0 0 !important;
    font-weight: 600;
}

.query-info-panel .query-text {
    font-style: italic;
    color: #495057;
    margin-bottom: 0;
    word-wrap: break-word;
}

.query-info-panel .mapped-clients,
.query-info-panel .mapped-dates {
    min-height: 2rem;
    font-size: 0.9rem;
}

.query-info-panel .col-md-2 h6,
.query-info-panel .col-md-3 h6 {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.query-info-panel .col-md-7 h6 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.query-info-panel .badge {
    font-size: 0.75rem;
    padding: 0.4em 0.6em;
    border-radius: 6px;
}

.query-info-panel h6 {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

/* Responsive Design for Query Info Panel */
@media (max-width: 768px) {
    .query-info-panel .row {
        flex-direction: column;
    }
    
    .query-info-panel .col-md-4 {
        margin-bottom: 1rem;
    }
}

/* Login Page Styles */
.login-body {
    background: var(--login-bg);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.login-card {
    background: var(--login-card-bg);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 2.5rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: slideUp 0.6s ease-out;
}

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

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    box-shadow: 0 10px 20px rgba(0, 123, 255, 0.3);
}

.login-icon i {
    font-size: 2rem;
    color: white;
}

.login-title {
    color: var(--dark-color);
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
}

.login-subtitle {
    color: var(--secondary-color);
    font-size: 0.95rem;
    margin-bottom: 0;
}

.login-form .form-label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.login-form .form-label i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

.login-form .form-control {
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background-color: rgba(255, 255, 255, 0.8);
}

.login-form .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    background-color: white;
}

.password-input-group {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
    transition: color 0.3s ease;
}

.password-toggle:hover {
    color: var(--primary-color);
}

.login-btn {
    width: 100%;
    padding: 0.875rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    border: none;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.3);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.4);
    background: linear-gradient(135deg, #0056b3, #138496);
}

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

.login-footer {
    margin-top: 2rem;
    text-align: center;
}

.login-info {
    background: rgba(0, 123, 255, 0.1);
    border-radius: 10px;
    padding: 1rem;
    border: 1px solid rgba(0, 123, 255, 0.2);
}

.login-info h6 {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.login-info p {
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
    color: var(--dark-color);
}

.login-info code {
    background: rgba(0, 123, 255, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--primary-color);
}

/* Alert Styles for Login */
.alert {
    border-radius: 10px;
    border: none;
    padding: 0.875rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    animation: slideDown 0.3s ease-out;
}

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

.alert i {
    margin-right: 0.5rem;
}

/* Responsive Design for Login */
@media (max-width: 576px) {
    .login-card {
        margin: 1rem;
        padding: 2rem 1.5rem;
    }
    
    .login-title {
        font-size: 1.5rem;
    }
    
    .login-icon {
        width: 60px;
        height: 60px;
    }
    
    .login-icon i {
        font-size: 1.5rem;
    }
}

/* User Info Styles */
.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-welcome {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    font-weight: 500;
}

.user-welcome i {
    margin-right: 0.5rem;
    font-size: 1.1rem;
}

.logout-btn {
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
}

.logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
    transform: translateY(-1px);
}

.logout-btn i {
    margin-right: 0.25rem;
}

/* Responsive Design for User Info */
@media (max-width: 768px) {
    .full-width-header .d-flex {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .user-info {
        justify-content: center;
    }
    
    .user-welcome {
        font-size: 0.8rem;
    }
    
    .logout-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}
