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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #21144d 0%, #2d1f5e 100%);
    min-height: 100vh;
    padding: 20px;
    color: #c7d2fe;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    background: linear-gradient(135deg, #21144d 0%, #3a3969 100%);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    margin-bottom: 20px;
    text-align: left;
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}

.header-logo {
    height: 100px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.header-text {
    text-align: left;
}

h1 {
    color: #60a5fa;
    font-size: 2rem;
    margin-bottom: 5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    color: #a5b4fc;
}

.version {
    color: #a5b4fc;
    font-size: 0.85rem;
    margin-top: 5px;
}

.card {
    background: linear-gradient(135deg, #21144d 0%, #342857 100%);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
}

.card h2, .card h3 {
    color: #93c5fd;
}

.form-group {
    margin: 20px 0;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #c7d2fe;
}

input, select {
    width: 100%;
    padding: 10px;
    border: 2px solid #3a3969;
    border-radius: 8px;
    font-size: 1rem;
    background: #1a1142;
    color: #e0e7ff;
    font-weight: 500;
}

/* Brighter background for date inputs */
input[type="date"] {
    background: #252151;
    border-color: #4a4a7e;
}

option {
    background: #1a1142;
    color: #e0e7ff;
}

/* Style selected options to be clearly visible */
option:checked,
option[selected] {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    font-weight: 600;
}

/* Additional styling for webkit browsers */
select[multiple] option:checked {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    color: white !important;
}

input:focus, select:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96,165,250,0.1);
}

input[type="number"] {
    width: 200px;
}

/* Hide number input spinner buttons */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* Make date calendar icon more visible */
input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    background: #3a3969;
    opacity: 1;
    filter: invert(1) brightness(1.5);
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    background: #4a4a7e;
    filter: invert(1) brightness(2);
}

/* Improve date input text visibility */
input[type="date"] {
    color: #e0e7ff;
    font-weight: 500;
}

input[type="date"]::-webkit-datetime-edit-fields-wrapper {
    color: #e0e7ff;
}

input[type="date"]::-webkit-datetime-edit-text {
    color: #a5b4fc;
    padding: 0 2px;
}

input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-year-field {
    color: #e0e7ff;
    font-weight: 500;
}

button {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

button:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px rgba(0,0,0,0.4);
}

button:disabled {
    background: #3a3969;
    cursor: not-allowed;
    opacity: 0.6;
}

.status {
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
}

.status.success {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(110, 231, 183, 0.3);
}

.status.error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(252, 165, 165, 0.3);
}

.status.info {
    background: rgba(96, 165, 250, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(147, 197, 253, 0.3);
}

.hidden {
    display: none;
}

.spinner {
    border: 4px solid rgba(255,255,255,0.1);
    border-top: 4px solid #60a5fa;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.timeline-summary {
    background: linear-gradient(135deg, #21144d 0%, #342857 100%);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 20px;
}

.timeline-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.timeline-summary-header h2 {
    color: #93c5fd;
    font-size: 1.3rem;
    margin: 0;
}

.timeline-summary-header .total-time {
    color: #60a5fa;
    font-size: 1.5rem;
    font-weight: 700;
}

.timeline-bar-container {
    position: relative;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    margin-bottom: 15px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.timeline-bar-segment {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    min-width: 5%;
}

.timeline-bar-segment:hover {
    filter: brightness(1.1);
}

.timeline-bar-segment.connected {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.timeline-bar-segment.disconnected {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
}

.timeline-bar-label {
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    z-index: 1;
}

.timeline-legend {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.timeline-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.timeline-legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.timeline-legend-color.connected {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.timeline-legend-color.disconnected {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
}

.timeline-legend-label {
    color: #c7d2fe;
    font-size: 0.95rem;
}

.timeline-legend-value {
    color: #93c5fd;
    font-weight: 600;
}

.mode-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.mode-card {
    color: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.mode-card.mode-1 {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.mode-card.mode-2 {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.mode-card.mode-3 {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.mode-card h4 {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 10px;
}

.mode-card .time {
    font-size: 2rem;
    font-weight: 700;
    margin: 10px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th {
    background: rgba(96, 165, 250, 0.15);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid rgba(96, 165, 250, 0.3);
    color: #93c5fd;
}

td {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #c7d2fe;
}

tr:hover {
    background: rgba(96, 165, 250, 0.05);
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
}

.badge.mode-1 { background: #10b981; }
.badge.mode-2 { background: #f59e0b; }
.badge.mode-3 { background: #ef4444; }

canvas {
    max-height: 400px;
}

.chart-grid .card {
    display: flex;
    flex-direction: column;
    min-height: 550px;
}

.chart-grid .card canvas {
    width: 100% !important;
    height: 100% !important;
    max-height: 350px;
}

.chart-grid .card h2,
.chart-grid .card h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    min-height: 28px;
    display: flex;
    align-items: center;
}

.chart-grid .card p {
    min-height: 48px;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
}

@media (max-width: 768px) {
    .grid-3 {
        grid-template-columns: 1fr;
    }
}

.query-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.records-badge {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.records-badge span {
    font-size: 1.2rem;
    font-weight: 700;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 1200px) {
    .chart-grid {
        grid-template-columns: 1fr;
    }
}

.collapsible-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    transition: all 0.2s;
}

.collapsible-header:hover {
    color: #60a5fa;
}

.collapsible-header:hover h2 {
    color: #60a5fa;
}

.collapsible-header h2 {
    margin: 0;
    transition: color 0.2s;
}

.collapse-icon {
    font-size: 1.5rem;
    font-weight: bold;
    color: #a5b4fc;
    transition: transform 0.3s ease, color 0.2s;
}

.collapsible-header:hover .collapse-icon {
    color: #60a5fa;
}

.collapse-icon.expanded {
    transform: rotate(180deg);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.collapsible-content.expanded {
    max-height: none;
    overflow: visible;
}

.decline-row {
    background-color: #ffebee !important;
}

.increase-row {
    background-color: #e8f5e8 !important;
}

.controls {
    margin: 10px 0;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 5px;
}

.controls label {
    margin-right: 10px;
    font-weight: bold;
}

.controls select {
    margin-right: 15px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.controls button {
    padding: 5px 15px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.controls button:hover {
    background: #45a049;
}

#declineRateChart {
    /* border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin: 20px 0;
    background: rgba(255, 255, 255, 0.02); */
}

#declineAnalysisSection {
    color: #f8fafc; /* Very light text */
}

#declineAnalysisSection h3 {
    color: #fbbf24; /* Golden yellow for main title */
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

#declineAnalysisSection h4 {
    color: #60a5fa; /* Light blue for card titles */
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

/* Update the decline analysis controls to match the application style */
#declineAnalysisSection .controls {
    margin: 20px 0;
    padding: 15px;
    background: rgba(96, 165, 250, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(96, 165, 250, 0.2);
}

#declineAnalysisSection .controls label {
    color: #c7d2fe;
    font-weight: 600;
    margin-right: 10px;
}

#declineAnalysisSection .controls select {
    background: #1a1142;
    color: #e0e7ff;
    border: 2px solid #3a3969;
    border-radius: 8px;
    padding: 8px 12px;
    margin-right: 15px;
    font-weight: 500;
}

#declineAnalysisSection .controls select:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96,165,250,0.1);
}

#declineAnalysisSection .controls button {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

#declineAnalysisSection .controls button:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px rgba(0,0,0,0.4);
}

/* Style the decline analysis tables to match other session tables */
#declineAnalysisSection table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    overflow: hidden;
}

#declineAnalysisSection th {
    background: rgba(96, 165, 250, 0.15);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid rgba(96, 165, 250, 0.3);
    color: #93c5fd;
    font-size: 0.95rem;
}

#declineAnalysisSection td {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #c7d2fe;
    font-size: 0.9rem;
}

#declineAnalysisSection tr:hover {
    background: rgba(96, 165, 250, 0.05);
}

/* Style specific decline analysis badges/indicators */
#declineAnalysisSection .decline-indicator {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

#declineAnalysisSection .decline-indicator.declining {
    background: #ef4444;
}

#declineAnalysisSection .decline-indicator.stable {
    background: #10b981;
}

#declineAnalysisSection .decline-indicator.increasing {
    background: #3b82f6;
}

/* Chart styling consistency */
#declineRateChart {
    /* border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin: 20px 0;
    background: rgba(255, 255, 255, 0.02); */
}

/* Summary card consistency within decline analysis */
#declineAnalysisSection .summary-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

/* Numeric value styling for consistency */
#declineAnalysisSection .numeric-value {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-weight: 600;
}

#declineAnalysisSection .positive-value {
    color: #10b981;
}

#declineAnalysisSection .negative-value {
    color: #ef4444;
}

#declineAnalysisSection .neutral-value {
    color: #60a5fa;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(33, 20, 77, 0.95);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-spinner {
    text-align: center;
    padding: 40px;
    background: linear-gradient(135deg, #21144d 0%, #342857 100%);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    border: 2px solid rgba(96, 165, 250, 0.3);
}

.spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    border: 4px solid rgba(96, 165, 250, 0.2);
    border-top-color: #60a5fa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner p {
    color: #93c5fd;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 10px 0;
}

.loading-subtext {
    color: #a5b4fc;
    font-size: 0.95rem !important;
    font-weight: 400 !important;
    opacity: 0.8;
}

.progress-bar-container {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: rgba(96, 165, 250, 0.2);
    border-radius: 4px;
    margin: 20px auto;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #60a5fa 0%, #3b82f6 100%);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.loading-progress-text {
    color: #a5b4fc;
    font-size: 0.85rem !important;
    font-weight: 400 !important;
    margin-top: 10px;
}

/* Opportunity Lost Filter Styling */
.checkbox-filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 600px;
}

.checkbox-filter-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.checkbox-filter-group label:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.checkbox-filter-group input[type="checkbox"] {
    display: none;
}

.checkbox-filter-group input[type="checkbox"] + span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.checkbox-filter-group input[type="checkbox"] + span::before {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 4px;
    background: transparent;
    transition: all 0.2s ease;
}

.checkbox-filter-group input[type="checkbox"]:checked + span::before {
    background: white;
    border-color: white;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23dc2626'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
    background-size: 14px;
    background-position: center;
    background-repeat: no-repeat;
}

.checkbox-filter-group label:has(input:checked) {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}

/* ===== LOGIN STYLES ===== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: linear-gradient(135deg, #21144d 0%, #342857 100%);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.login-logo {
    height: 80px;
    width: auto;
    margin-bottom: 20px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.login-title {
    color: #60a5fa;
    font-size: 1.8rem;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.login-subtitle {
    color: #a5b4fc;
    font-size: 1rem;
    margin-bottom: 30px;
}

.login-card .form-group {
    text-align: left;
    margin-bottom: 20px;
}

.login-card input[type="email"],
.login-card input[type="password"] {
    width: 100%;
    padding: 14px;
    border: 2px solid #3a3969;
    border-radius: 8px;
    font-size: 1rem;
    background: #1a1142;
    color: #e0e7ff;
    transition: all 0.2s;
}

.login-card input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96,165,250,0.2);
}

.login-btn {
    width: 100%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    margin-top: 10px;
}

.login-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.4);
}

.login-btn:disabled {
    background: #3a3969;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

.forgot-password {
    margin-top: 20px;
    color: #a5b4fc;
    font-size: 0.9rem;
}

.forgot-password a {
    color: #60a5fa;
    text-decoration: none;
    transition: color 0.2s;
}

.forgot-password a:hover {
    color: #93c5fd;
    text-decoration: underline;
}

.login-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.login-footer p {
    color: #6b7280;
    font-size: 0.85rem;
}

/* User menu in header */
.user-menu {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-email {
    color: #a5b4fc;
    font-size: 0.9rem;
}

.logout-btn {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    transform: translateY(-1px);
}

/* Responsive adjustments for header with user menu */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        text-align: center;
    }

    .user-menu {
        margin-left: 0;
        margin-top: 15px;
        width: 100%;
        justify-content: center;
    }
}

/* Login status messages */
#loginStatus {
    margin-top: 20px;
    text-align: center;
}
