/* JHA Generator - Dark Theme Styles */
/* All sizes use rem units, minimum 1rem for text */

:root {
    --app-title: #81AAD9;
    --bg-primary: #000000;
    --bg-secondary: #000000;
    --bg-tertiary: #000000;
    --text-primary: #e8e8e8;
    --text-secondary: #b8b8b8;
    --accent-color: #00d9ff;
    --accent-hover: #00b8d9;
    --input-field-border-color: #3065A1;
    --input-field-border-color-focus: #5E93CF;
    --error-color: #ff6b6b;
    --success-color: #51cf66;
    --warning-color: #ffd43b;
    --border-unselected-job-type: #808080;
    --selected-job-type-border-color: #22c55e;
    --selected-job-type-accent-color: #22c55e;
    --button-background: #c23f3a;
}

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

html {
    font-size: 16px;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    padding: 1.5rem;
    min-height: 100vh;
}

.container {
    max-width: 75rem;
    margin: 0 auto;
}

h1 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--app-title);
    text-align: center;
}

h2 {
    font-size: 1.5rem;
    margin: 1.5rem 0 1rem 0;
    color: var(--accent-color);
    border-bottom: 0.125rem solid var(--bg-tertiary);
    padding-bottom: 0.5rem;
}

h3 {
    font-size: 1.25rem;
    margin: 1rem 0 0.75rem 0;
    color: var(--text-primary);
}

/* Form Styles */
.form-section {
    background-color: var(--bg-secondary);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    flex: 1;
    min-width: 12rem;
}

.form-group.full-width {
    flex: 100%;
    min-width: 100%;
}

.form-row.address-row {
    flex-wrap: nowrap;
    justify-content: space-between;
}

.form-group.city-field {
    flex: 1 1 auto;
    min-width: 8rem;
}

.form-group.state-field {
    flex: 0 0 auto;
    min-width: auto;
}

.form-group.postal-field {
    flex: 0 0 auto;
    min-width: auto;
}

label {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
    color: var(--text-primary);
}

input[type="text"],
select,
textarea {
    width: 100%;
    font-family: inherit;
    font-size: 1rem;
    padding: 0.5rem;
    border: 0.125rem solid var(--input-field-border-color);
    border-radius: 0.25rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--input-field-border-color-focus);
    box-shadow: 0 0 0 0.125rem rgba(0, 217, 255, 0.25);
}

input[type="text"]::placeholder {
    color: var(--text-secondary);
}

/* State field specific width */
input.state-input {
    width: 4rem;
}

/* Postal code field specific width */
input.postal-input {
    width: 7rem;
}

/* Checkbox Group for Job Type */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    border: 0.125rem solid var(--input-field-border-color);
    border-radius: 0.25rem;
    background-color: var(--bg-primary);
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: #000000;
    border: 0.125rem dashed var(--border-unselected-job-type);
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
    font-weight: normal;
}

.checkbox-item:hover {
    background-color: #000000;
    border: 0.125rem solid var(--selected-job-type-border-color);
}

.checkbox-item input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
    accent-color: var(--selected-job-type-accent-color);
    flex-shrink: 0;
}

.checkbox-item:has(input:checked) {
    background-color: #000000;
    border: 0.125rem solid var(--selected-job-type-border-color);
    box-shadow: 0 0 0 0.125rem rgba(34, 197, 94, 0.25);
}

.checkbox-item:has(input:checked) span {
    color: #ffffff;
}

.checkbox-item span {
    color: var(--text-primary);
}

/* Customer dropdown */
select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234a9fff' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

select option {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    padding: 0.5rem;
}

/* Button Styles */
.button-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.btn {
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    line-height: 1.5;
    box-sizing: border-box;
    text-align: center;
}

.btn-primary {
    background-color: var(--button-background);
    color: var(--bg-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--app-title);
    transform: translateY(-0.0625rem);
}

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

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 0.125rem solid var(--input-field-border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-secondary);
    border-color: var(--accent-color);
}

/* Loading Animation - Pure CSS */
.loading-indicator {
    display: none;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    color: var(--warning-color);
}

.loading-indicator.active {
    display: flex;
}

.loading-spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 0.1875rem solid var(--bg-tertiary);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Output Section */
.output-section {
    background-color: var(--bg-secondary);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.coordinates-display {
    font-size: 1.125rem;
    padding: 1rem;
    background-color: var(--bg-tertiary);
    border-radius: 0.25rem;
    margin-bottom: 1rem;
}

.coordinates-label {
    color: var(--text-secondary);
}

.coordinates-value {
    color: var(--accent-color);
    font-weight: 600;
}

/* Emergency Services Grid */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.service-card {
    background-color: var(--bg-tertiary);
    border-radius: 0.375rem;
    padding: 1rem;
    border-left: 0.25rem solid var(--accent-color);
}

.service-card h4 {
    font-size: 1.125rem;
    color: var(--accent-color);
    margin-bottom: 0.75rem;
}

.service-card .service-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.service-card .service-detail {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
    display: flex;
    gap: 0.5rem;
}

.service-card .service-detail strong {
    color: var(--text-primary);
    min-width: 5rem;
}

.service-card.hospital {
    border-left-color: #ff6b6b;
}

.service-card.police {
    border-left-color: #4a9fff;
}

.service-card.fire {
    border-left-color: #ff922b;
}

.service-card.urgent-care {
    border-left-color: #51cf66;
}

/* Map Container */
.map-container {
    margin-top: 1.5rem;
    border-radius: 0.375rem;
    overflow: hidden;
    border: 0.125rem solid var(--input-field-border-color);
}

.map-container h3 {
    padding: 1rem;
    background-color: var(--bg-tertiary);
    margin: 0;
}

#map {
    width: 100%;
    height: 25rem;
    background-color: var(--bg-primary);
}

/* Report Section */
.report-section {
    background-color: var(--bg-secondary);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.report-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.report-meta {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: var(--bg-tertiary);
    border-radius: 0.25rem;
}

.report-content {
    background-color: white;
    color: #333;
    padding: 2rem;
    border-radius: 0.25rem;
    font-size: 1rem;
    line-height: 1.8;
}

.report-content h1,
.report-content h2,
.report-content h3 {
    color: #1a1a2e;
}

.report-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.report-content th,
.report-content td {
    border: 0.0625rem solid #ddd;
    padding: 0.75rem;
    text-align: left;
}

.report-content th {
    background-color: #f5f5f5;
}

/* Data Sources */
.data-sources {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: var(--bg-tertiary);
    border-radius: 0.25rem;
}

.data-sources h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.data-sources ul {
    list-style: disc;
    padding-left: 1.5rem;
}

.data-sources li {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

/* Error Messages */
.error-message {
    background-color: rgba(255, 107, 107, 0.1);
    border: 0.0625rem solid var(--error-color);
    color: var(--error-color);
    padding: 1rem;
    border-radius: 0.25rem;
    margin: 1rem 0;
    font-size: 1rem;
}

.success-message {
    background-color: rgba(81, 207, 102, 0.1);
    border: 0.0625rem solid var(--success-color);
    color: var(--success-color);
    padding: 1rem;
    border-radius: 0.25rem;
    margin: 1rem 0;
    font-size: 1rem;
}

/* Token Warning */
.token-warning {
    background-color: rgba(255, 212, 59, 0.1);
    border: 0.125rem solid var(--warning-color);
    color: var(--warning-color);
    padding: 1rem;
    border-radius: 0.25rem;
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

/* Responsive Layout */
@media (min-width: 48rem) {
    .form-row.inline {
        flex-wrap: nowrap;
    }
}

@media (max-width: 48rem) {
    body {
        padding: 1rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .form-row.address-row {
        flex-wrap: wrap;
    }
    
    .form-group.city-field {
        flex: 1 0 100%;
        min-width: 100%;
    }
    
    .form-group.state-field {
        flex: 0 0 auto;
    }
    
    .form-group.postal-field {
        flex: 1 1 auto;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
    }
    
    .button-row {
        // flex-direction: column;
        // align-items: stretch;
    }
    
    .loading-indicator {
        justify-content: center;
    }
}

/* Print Styles */
@media print {
    body {
        background-color: white;
        color: black;
        padding: 0;
    }
    
    .form-section,
    .button-row,
    .report-actions,
    .loading-indicator {
        display: none !important;
    }
    
    .report-content {
        box-shadow: none;
        padding: 0;
    }
}

/* Template Content in Report */
.template-content {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 0.125rem solid #ddd;
}

.template-content h3 {
    color: #1a1a2e;
    margin-bottom: 1rem;
}

/* Download link styling */
.download-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent-color);
    text-decoration: none;
    font-size: 1rem;
    padding: 0.5rem 0;
}

.download-link:hover {
    text-decoration: underline;
}
