/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color scheme */
    --highly-likely: #dc2626;
    --likely: #ea580c;
    --possible: #ca8a04;
    --unlikely: #16a34a;

    --yes-badge: #3b82f6;
    --maybe-badge: #8b5cf6;
    --no-badge: #6b7280;

    --bg-primary: #f9fafb;
    --bg-secondary: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Card */
.card {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px var(--shadow);
    margin-bottom: 1.5rem;
}

/* Input Group */
.input-group {
    display: flex;
    gap: 1rem;
    align-items: center;
}

input[type="number"] {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
}

input[type="number"]:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Buttons */
.btn-primary,
.btn-secondary {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background-color: #2563eb;
}

.btn-primary:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--bg-primary);
}

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

/* Loading Spinner */
#loading {
    text-align: center;
    padding: 3rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Alerts */
.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid #dc2626;
    margin-bottom: 1.5rem;
}

/* Results Section */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.results-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.job-meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Table */
.table-container {
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background-color: var(--bg-primary);
    border-bottom: 2px solid var(--border);
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    color: var(--text-secondary);
}

tbody tr {
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background-color 0.2s;
}

tbody tr:hover {
    background-color: var(--bg-primary);
}

td {
    padding: 1rem;
}

/* Confidence Band Badges */
.confidence-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    color: white;
}

.highly-likely {
    background-color: var(--highly-likely);
}

.likely {
    background-color: var(--likely);
}

.possible {
    background-color: var(--possible);
}

.unlikely {
    background-color: var(--unlikely);
}

/* Score Display */
.score-value {
    font-weight: 600;
    font-size: 1.1rem;
}

.score-positive {
    color: var(--highly-likely);
}

.score-negative {
    color: var(--unlikely);
}

/* Probability */
.probability {
    font-weight: 500;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border-radius: 12px;
    max-width: 800px;
    max-height: 90vh;
    width: 90%;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    z-index: 1001;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-primary);
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    z-index: 1;
}

.modal-close:hover {
    background-color: var(--border);
}

#modal-body {
    padding: 2rem;
}

/* Modal Header */
.modal-header {
    margin-bottom: 1.5rem;
}

.modal-location {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.modal-score {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.modal-confidence {
    font-size: 1.125rem;
}

/* Modal Image */
.modal-image {
    margin-bottom: 1.5rem;
}

.modal-image img {
    width: 100%;
    border-radius: 8px;
    display: block;
}

.image-meta {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    gap: 1rem;
}

/* Signals Section */
.signals-section {
    margin-top: 2rem;
}

.signals-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

.signal-group {
    margin-bottom: 1.5rem;
}

.signal-group-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.signal-group-title {
    font-weight: 600;
    font-size: 1rem;
}

.signal-count {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.assessment-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    color: white;
    text-transform: uppercase;
}

.badge-yes {
    background-color: var(--yes-badge);
}

.badge-maybe {
    background-color: var(--maybe-badge);
}

.badge-no {
    background-color: var(--no-badge);
}

/* Signal List */
.signal-list {
    list-style: none;
    padding-left: 0;
}

.signal-item {
    padding: 0.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--bg-primary);
}

.signal-item:last-child {
    border-bottom: none;
}

.signal-name {
    font-size: 0.9rem;
}

.signal-score {
    font-weight: 600;
    font-size: 0.9rem;
}

.score-high {
    color: var(--highly-likely);
}

.score-medium {
    color: var(--likely);
}

.score-low {
    color: var(--possible);
}

/* Modal Navigation */
.modal-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 2rem;
    border-top: 1px solid var(--border);
    background-color: var(--bg-primary);
}

.modal-nav button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .input-group {
        flex-direction: column;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    table {
        font-size: 0.875rem;
    }

    th, td {
        padding: 0.75rem 0.5rem;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-score {
        font-size: 2rem;
    }

    .modal-nav {
        padding: 1rem;
    }
}
