/* Reset and base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

/* Header */
.header {
    background: #2c5aa0;
    color: white;
    padding: 2rem;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.header-logo {
    height: 60px;
    width: auto;
}

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

.title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    opacity: 0.9;
    margin: 0;
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .header-text {
        text-align: center;
    }
    
    .header-logo {
        height: 50px;
    }
}

/* Navigation */
.nav {
    background: #1e4080;
    padding: 0.5rem 0;
    text-align: center;
}

.nav-button {
    background: none;
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.nav-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-button.active {
    background: rgba(255, 255, 255, 0.2);
}

/* Container and layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

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

.section-title {
    color: #2c5aa0;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Form styles */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
}

.form-group label {
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    max-width: 100%;
    width: 100%;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-group input.error,
.form-group select.error,
.form-group textarea.error,
.checkbox-group input[type="checkbox"].error {
    border-color: #dc3545 !important;
    background-color: #fff5f5 !important;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2) !important;
}

.form-group input.error:focus,
.form-group select.error:focus,
.form-group textarea.error:focus {
    border-color: #dc3545 !important;
    background-color: #fff5f5 !important;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2) !important;
}

.checkbox-group input[type="checkbox"].error {
    outline: 2px solid #dc3545 !important;
    outline-offset: 2px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2c5aa0;
    box-shadow: 0 0 0 2px rgba(44, 90, 160, 0.1);
}

/* Buttons */
.button-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.location-button {
    padding: 0.75rem 1.5rem;
    border: 2px solid #2c5aa0;
    background: white;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.location-button:hover {
    background: #f0f0f0;
}

.location-button.active {
    border-color: #2c5aa0;
    background: #2c5aa0;
    color: white;
    box-shadow: 0 0 0 2px rgba(44, 90, 160, 0.3);
    transform: translateY(-1px);
}

.submit-button {
    padding: 1rem 2rem;
    background: #2c5aa0;
    color: white;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.submit-button:hover {
    background: #1e4080;
}

.submit-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Map */
.map-layout {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.map-search-panel {
    width: 250px;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    height: fit-content;
    max-height: 400px;
}

.map-search-panel label {
    display: block;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #333;
}

.map-search-panel input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
}

.map-search-panel input:focus {
    outline: none;
    border-color: #2c5aa0;
    box-shadow: 0 0 0 2px rgba(44, 90, 160, 0.1);
}

.map-container {
    height: 400px;
    min-height: 400px;
    width: 100%;
    flex: 1;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
}

.map-container > div {
    height: 100% !important;
    width: 100% !important;
}

@media (max-width: 768px) {
    .map-layout {
        flex-direction: column;
    }
    
    .map-search-panel {
        width: 100%;
    }
}

.map-note {
    font-size: 0.9em;
    color: #666;
    text-align: center;
    margin-bottom: 1rem;
}

/* Location form */
.location-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (max-width: 768px) {
    .location-form {
        grid-template-columns: 1fr;
    }
    
    .map-layout {
        flex-direction: column;
    }
    
    .map-search-panel {
        width: 100%;
    }
}

/* Tree message */
.tree-message {
    padding: 1rem;
    background: #f0f0f0;
    border-radius: 4px;
    color: #666;
    margin-top: 1rem;
}

/* Photo previews */
#photo-previews {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

#photo-previews img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

/* Confirmation */
.confirmation-content {
    text-align: center;
}

.confirmation-content h3 {
    color: #2c5aa0;
    margin-bottom: 1rem;
}

.confirmation-content p {
    font-size: 18px;
    margin-bottom: 1rem;
}

#sla-info {
    margin-bottom: 2rem;
    font-size: 16px;
}

/* Issues feed */
.issues-container {
    max-width: 800px;
    margin: 0 auto;
}

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

.issues-header h1 {
    color: #2c5aa0;
    margin-bottom: 0.5rem;
}

.issues-header p {
    color: #666;
}

.filter-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filter-button {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.filter-button:hover {
    background: #f0f0f0;
}

.filter-button.active {
    border-color: #2c5aa0;
    background: #2c5aa0;
    color: white;
}

.issues-feed {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.issue-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-left: 4px solid #dc3545;
}

.issue-card.in-progress {
    border-left-color: #ffc107;
}

.issue-card.resolved {
    border-left-color: #28a745;
}

.issue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.issue-type {
    font-weight: bold;
    color: #2c5aa0;
}

.issue-street {
    color: #666;
    margin-left: 0.5rem;
}

.status-badge {
    background: #dc3545;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.status-badge.in-progress {
    background: #ffc107;
    color: #000;
}

.status-badge.resolved {
    background: #28a745;
}

.issue-timestamp {
    font-size: 12px;
    color: #666;
    margin-bottom: 0.5rem;
}

.issue-description {
    color: #333;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.issue-photos {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.issue-photos img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
}

.progress-update {
    background: #f0f0f0;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 14px;
    color: #666;
    margin-top: 0.5rem;
}

/* Voting styles */
.issue-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.vote-button {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.vote-button:hover:not(:disabled) {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
}

.vote-button.voted {
    background: #2c5aa0;
    border-color: #2c5aa0;
    color: white;
}

.vote-button.voted:hover {
    background: #1e4080;
    border-color: #1e4080;
}

.vote-button:disabled {
    background: #f8f9fa;
    border-color: #dee2e6;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.vote-help {
    font-size: 12px;
    color: #6c757d;
    font-style: italic;
}

/* Problem type tooltip */
.problem-type-tooltip {
    background: #333;
    color: white;
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.4;
    max-width: 300px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    animation: fadeIn 0.3s ease;
}

.problem-type-tooltip::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 20px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid #333;
}

.tooltip-content strong {
    color: #fff;
    margin-bottom: 8px;
    display: block;
}

.tooltip-content small {
    color: #ccc;
    font-style: italic;
    margin-top: 8px;
    display: block;
}

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

/* Pest control help text */
.pest-control-help {
    background: #e8f4fd;
    border: 1px solid #bee5eb;
    border-radius: 4px;
    padding: 1rem;
    margin-top: 1rem;
    color: #0c5460;
}

.pest-control-help p {
    margin: 0 0 0.5rem 0;
}

.pest-control-help p:last-child {
    margin-bottom: 0;
}

.pest-control-help a {
    color: #2c5aa0;
    text-decoration: underline;
}

.pest-control-help a:hover {
    color: #1e4080;
}

/* Pollution acknowledgment section */
.pollution-acknowledgment {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.pollution-acknowledgment h3 {
    color: #2c5aa0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.acknowledgment-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.checkbox-group input[type="checkbox"] {
    margin-top: 0.25rem;
    min-width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.checkbox-group label {
    font-size: 14px;
    line-height: 1.4;
    color: #333;
    cursor: pointer;
    margin: 0;
}

.checkbox-group input[type="checkbox"]:focus {
    outline: 2px solid #2c5aa0;
    outline-offset: 2px;
}

.signature-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #dee2e6;
}

.signature-section .form-group {
    margin-bottom: 1rem;
}

.signature-section input[readonly] {
    background-color: #f8f9fa;
    color: #6c757d;
}

/* What3Words styling */
.what3words-container {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
    margin-bottom: 1.5rem;
}

.what3words-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    min-width: 300px;
}

.what3words-input.error {
    border-color: #dc3545 !important;
    background-color: #fff5f5 !important;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2) !important;
}

.what3words-input:focus {
    outline: none;
    border-color: #2c5aa0;
    box-shadow: 0 0 0 2px rgba(44, 90, 160, 0.1);
}

.what3words-button {
    padding: 0.75rem 1.5rem;
    background: #2c5aa0;
    color: white;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.what3words-button:hover {
    background: #1e4080;
}

.help-text {
    color: #666;
    font-size: 12px;
    margin-top: 0.25rem;
    display: block;
}

/* Tooltip styles */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    margin-left: 0.25rem;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 300px;
    background-color: #333;
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1000;
    bottom: 50%;
    left: 100%;
    margin-left: 10px;
    transform: translateY(50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
    line-height: 1.4;
    font-weight: normal;
}

.tooltip .tooltiptext:not(.problem-type-help) {
    bottom: 50%;
    left: 100%;
    margin-left: 10px;
    transform: translateY(50%);
    right: auto;
    top: auto;
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 100%;
    margin-top: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: transparent #333 transparent transparent;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Problem type specific tooltip */
.tooltip .problem-type-help {
    width: 350px !important;
    left: 100% !important;
    margin-left: 10px !important;
    right: auto !important;
    bottom: 50% !important;
    top: auto !important;
    transform: translateY(50%) !important;
    text-align: left;
}

.tooltip .problem-type-help::after {
    right: 100% !important;
    top: 50% !important;
    left: auto !important;
    bottom: auto !important;
    margin-top: -5px !important;
    margin-left: 0 !important;
    border-color: transparent #333 transparent transparent !important;
}

.problem-type-help strong {
    color: #fff;
}

.section {
    transition: transform 0.3s ease;
}

#problem-type-tooltip:hover ~ * {
    transform: translateX(370px);
}

@media (max-width: 768px) {
    .tooltip .problem-type-help {
        width: 90vw !important;
        left: 50% !important;
        right: auto !important;
        margin-left: 0 !important;
        transform: translateX(-50%) !important;
        top: 100% !important;
        bottom: auto !important;
        margin-top: 10px !important;
    }
    
    .tooltip .problem-type-help::after {
        left: 50% !important;
        top: auto !important;
        right: auto !important;
        bottom: 100% !important;
        margin-left: -5px !important;
        margin-top: 0 !important;
        border-color: transparent transparent #333 transparent !important;
    }
    
    #problem-type-tooltip:hover ~ * {
        transform: none;
    }
}

/* Progress bar */
.progress-container {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2c5aa0, #4a7bc8);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-text {
    text-align: center;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .section {
        padding: 1rem;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .location-button {
        width: 100%;
    }
    
    .issue-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .what3words-container {
        flex-direction: column;
    }
    
    .what3words-input {
        min-width: auto;
        width: 100%;
    }
    
    .tooltip .tooltiptext {
        width: 90vw;
        left: 50%;
        right: auto;
        margin-left: 0;
        transform: translateX(-50%);
        bottom: auto;
        top: 100%;
        margin-top: 10px;
    }
    
    .tooltip .tooltiptext::after {
        left: 50%;
        right: auto;
        top: auto;
        bottom: 100%;
        margin-left: -5px;
        margin-top: 0;
        border-color: transparent transparent #333 transparent;
    }
    
    .tooltip .tooltiptext:not(.problem-type-help) {
        width: 90vw;
        left: 50%;
        transform: translateX(-50%);
        bottom: auto;
        top: 100%;
        margin-top: 10px;
    }
    
    .tooltip .problem-type-help {
        width: 90vw !important;
        left: 50% !important;
        right: auto !important;
        margin-left: 0 !important;
        transform: translateX(-50%) !important;
        top: auto !important;
        bottom: 100% !important;
        margin-bottom: 10px !important;
    }
    
    .tooltip .problem-type-help::after {
        left: 50% !important;
        top: 100% !important;
        bottom: auto !important;
        margin-left: -5px !important;
        border-color: #333 transparent transparent transparent !important;
    }
    
    .issue-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .vote-button {
        width: 100%;
        justify-content: center;
    }
}

/* Character counter */
.char-counter {
    float: right;
    font-size: 12px;
    color: #666;
    font-weight: normal;
}

.char-counter.warning {
    color: #ffc107;
}

.char-counter.limit {
    color: #dc3545;
}

/* Summary Card */
.summary-card {
    background: white;
    border-radius: 8px;
    padding: 0;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.summary-header {
    background: #2c5aa0;
    color: white;
    padding: 1rem 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.summary-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.summary-toggle {
    font-size: 1.2rem;
    transition: transform 0.3s;
}

.summary-card.collapsed .summary-toggle {
    transform: rotate(-90deg);
}

.summary-content {
    padding: 1.5rem;
    max-height: 500px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

.summary-card.collapsed .summary-content {
    max-height: 0;
    padding: 0 1.5rem;
    overflow: hidden;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
    gap: 1rem;
}

.summary-item strong {
    color: #2c5aa0;
    min-width: 120px;
}

.summary-value {
    flex: 1;
    color: #333;
}

.summary-edit {
    background: #2c5aa0;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    transition: background 0.2s;
}

.summary-edit:hover {
    background: #1e4080;
}

@media (max-width: 768px) {
    .summary-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .summary-item strong {
        min-width: auto;
    }
    
    .summary-edit {
        align-self: flex-end;
    }
}
