body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
}

header {
    background-color: #0078d4;
    color: white;
    padding: 1rem;
    text-align: center;
}

main {
    padding: 2rem;
}

form {
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

label {
    display: block;
    margin: 0.5rem 0;
}

select, button {
    margin-bottom: 1rem;
    padding: 0.5rem;
    width: 100%;
}

button {
    background-color: #ff5722; /* Contrasting color */
    color: white;
    font-weight: bold;
    border: none;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 5px;
}

button:hover {
    background-color: #e64a19;
}

#recommendation {
    background-color: white;
    padding: 1rem;
    border: 1px solid #ddd;
}

/* Add tooltips for dropdowns */
select {
    position: relative;
}

select:hover::after {
    content: attr(title);
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #333;
    color: #fff;
    padding: 0.5rem;
    border-radius: 5px;
    font-size: 0.875rem;
    white-space: nowrap;
    z-index: 10;
}

/* Two-panel layout */
.two-panel-layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}
.left-panel {
    flex: 1 1 350px;
    min-width: 320px;
}
.right-panel {
    flex: 1 1 350px;
    min-width: 320px;
    position: sticky;
    top: 2rem;
}

/* Summary card and recommendation panel */
.summary-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

/* Tooltip styles */
.info-icon {
    display: inline-block;
    margin-left: 0.3em;
    cursor: pointer;
    color: #0078d4;
    font-size: 1em;
    vertical-align: middle;
}
.custom-tooltip {
    position: fixed;
    background: #222;
    color: #fff;
    padding: 0.5em 1em;
    border-radius: 6px;
    font-size: 0.95em;
    z-index: 1000;
    pointer-events: none;
    max-width: 260px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Loading spinner */
#loading-spinner {
    margin: 1.5em 0;
    text-align: center;
    font-size: 1.2em;
    color: #0078d4;
}

/* Confidence bar */
.confidence-bar {
    background: #eee;
    border-radius: 6px;
    height: 12px;
    margin: 0.5em 0 0.2em 0;
    width: 100%;
    overflow: hidden;
}
.confidence-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #ffeb3b 80%, #f44336 100%);
}
.confidence-label {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 0.5em;
}

/* Dark mode */
body.dark-mode {
    background: #181a1b;
    color: #e0e0e0;
}
body.dark-mode header {
    background: #222b3a;
}
body.dark-mode .summary-card, body.dark-mode #recommendation {
    background: #23272b;
    color: #e0e0e0;
    border-color: #333;
}
body.dark-mode .custom-tooltip {
    background: #333;
    color: #fff;
}
body.dark-mode .confidence-bar {
    background: #333;
}

/* Responsive for two-panel */
@media (max-width: 900px) {
    .two-panel-layout {
        flex-direction: column;
    }
    .right-panel, .left-panel {
        min-width: 0;
        width: 100%;
    }
}

/* Ensure mobile responsiveness */
@media (max-width: 768px) {
    form {
        padding: 1rem;
        font-size: 0.9rem;
    }

    select, button {
        padding: 0.5rem;
        font-size: 0.9rem;
    }

    button {
        width: 100%;
    }
}

/* --- Theme Toggle Button --- */
#theme-toggle {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.6em;
    cursor: pointer;
    margin-left: 1em;
    transition: filter 0.2s;
    outline: none;
}
#theme-toggle:focus, #theme-toggle:hover {
    filter: brightness(1.3) drop-shadow(0 0 4px #ffeb3b);
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
}

/* --- Advanced Settings Toggle --- */
#toggle-advanced {
    background: #0078d4;
    color: #fff;
    border: none;
    border-radius: 5px;
    margin-bottom: 0.5em;
    font-size: 1em;
    padding: 0.5em 1em;
    width: auto;
    transition: background 0.2s;
}
#toggle-advanced[aria-expanded="true"] {
    background: #005fa3;
}
#toggle-advanced:focus, #toggle-advanced:hover {
    background: #005fa3;
}

#advanced-settings {
    background: #f7faff;
    border: 1px solid #b3d6f7;
    border-radius: 6px;
    padding: 1em;
    margin-bottom: 1em;
}
body.dark-mode #advanced-settings {
    background: #23272b;
    border-color: #333;
}

/* --- Live Summary --- */
#live-summary ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
#live-summary li {
    display: flex;
    align-items: center;
    margin-bottom: 0.4em;
    font-size: 1.05em;
}
#live-summary li .summary-icon {
    margin-right: 0.6em;
    font-size: 1.1em;
    opacity: 0.8;
}
#live-summary li .summary-label {
    font-weight: bold;
    margin-right: 0.3em;
}

/* --- Justification Card --- */
.justification-card {
    background: #e3f2fd;
    border-left: 4px solid #1976d2;
    border-radius: 6px;
    padding: 1em 1.2em;
    margin: 1em 0;
    color: #0d223a;
}
body.dark-mode .justification-card {
    background: #1a2633;
    color: #b3d6f7;
    border-left-color: #90caf9;
}

/* --- Comparison Table --- */
#comparison-table {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1em 1.5em;
    margin: 1.5em 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    overflow-x: auto;
}
#comparison-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.98em;
}
#comparison-table th, #comparison-table td {
    border: 1px solid #ccc;
    padding: 0.5em 0.8em;
    text-align: left;
}
#comparison-table th {
    background: #f0f4f8;
    font-weight: bold;
}
body.dark-mode #comparison-table {
    background: #23272b;
    color: #e0e0e0;
    border-color: #333;
}
body.dark-mode #comparison-table th {
    background: #1a1d21;
}

/* --- Feedback Section --- */
#feedback-section {
    margin-top: 1.5em;
    font-size: 1em;
}
#feedback-section label {
    margin-right: 0.5em;
}
#feedback-section select {
    width: auto;
    min-width: 120px;
}

/* --- Accessibility --- */
[aria-live] {
    outline: none;
}

/* --- Export Button --- */
#export-btn {
    background: #43a047;
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 0.5em 1.2em;
    margin-top: 1em;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
}
#export-btn:hover, #export-btn:focus {
    background: #2e7031;
}

/* --- Reset Button --- */
#reset-form {
    background: #bdbdbd;
    color: #222;
    border: none;
    border-radius: 5px;
    padding: 0.5em 1.2em;
    margin-left: 0.5em;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
}
#reset-form:hover, #reset-form:focus {
    background: #757575;
    color: #fff;
}

/* --- Tooltip Icon Button --- */
.tooltip-icon {
    background: none;
    border: none;
    color: #0078d4;
    font-size: 1em;
    cursor: pointer;
    margin-left: 0.3em;
    vertical-align: middle;
    outline: none;
}
.tooltip-icon:focus, .tooltip-icon:hover {
    color: #005fa3;
    text-shadow: 0 0 4px #90caf9;
}

/* --- Site Footer --- */
.site-footer {
    background: #f0f4f8;
    border-top: 1px solid #d0dce8;
    margin-top: 2.5rem;
    padding: 2rem 1rem 1.2rem;
    font-size: 0.95em;
    color: #444;
}
.footer-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
}
.footer-org {
    display: flex;
    justify-content: center;
}
.footer-org-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #0078d4;
    font-weight: 600;
    font-size: 1.05em;
    transition: color 0.2s;
}
.footer-org-link:hover {
    color: #005fa3;
}
.footer-org-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #0078d4;
    object-fit: cover;
}
.footer-org-name {
    max-width: 320px;
    line-height: 1.3;
}
.footer-divider {
    width: 60px;
    height: 2px;
    background: #d0dce8;
    border-radius: 2px;
}
.footer-owner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}
.footer-owner-label {
    font-size: 0.82em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #888;
    font-weight: 600;
}
.footer-owner-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.footer-owner-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #ccc;
    object-fit: cover;
}
.footer-owner-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: color 0.2s;
}
.footer-owner-link:hover {
    color: #0078d4;
}
.footer-linkedin {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    text-decoration: none;
    color: #0a66c2;
    font-weight: 500;
    transition: color 0.2s;
}
.footer-linkedin:hover {
    color: #004182;
}
.footer-copy {
    font-size: 0.85em;
    color: #999;
}

/* Dark mode footer */
body.dark-mode .site-footer {
    background: #1a1d21;
    border-top-color: #2d3238;
    color: #aaa;
}
body.dark-mode .footer-org-link {
    color: #90caf9;
}
body.dark-mode .footer-org-link:hover {
    color: #64b5f6;
}
body.dark-mode .footer-org-avatar {
    border-color: #90caf9;
}
body.dark-mode .footer-divider {
    background: #2d3238;
}
body.dark-mode .footer-owner-avatar {
    border-color: #444;
}
body.dark-mode .footer-owner-link {
    color: #ccc;
}
body.dark-mode .footer-owner-link:hover {
    color: #90caf9;
}
body.dark-mode .footer-linkedin {
    color: #64b5f6;
}
body.dark-mode .footer-copy {
    color: #666;
}