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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1e1e1e;
    min-height: 100vh;
    color: #cccccc;
    line-height: 1.5;
}

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

header {
    text-align: left;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #333;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 0.25rem;
}

.subtitle {
    font-size: 0.875rem;
    color: #808080;
}

.card {
    background: #252526;
    border: 1px solid #3c3c3c;
    border-radius: 4px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.card h2 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.address-input-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

#address-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid #3c3c3c;
    border-radius: 3px;
    background: #3c3c3c;
    color: #ffffff;
    transition: border-color 0.15s ease;
}

#address-input:focus {
    outline: none;
    border-color: #0e639c;
    background: #3c3c3c;
}

#address-input::placeholder {
    color: #808080;
}

.location-btn {
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

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

.btn-primary {
    background: #0e639c;
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: #1177bb;
}

.btn-secondary {
    background: #0e639c;
    color: #fff;
}

.btn-secondary:hover:not(:disabled) {
    background: #1177bb;
}

.btn-outline {
    background: transparent;
    border: 1px solid #3c3c3c;
    color: #cccccc;
}

.btn-outline:hover:not(:disabled) {
    background: #3c3c3c;
}

.btn-icon {
    font-size: 1rem;
}

.map-controls {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

#map {
    width: 100%;
    height: 450px;
    border-radius: 3px;
    border: 1px solid #3c3c3c;
    background: #1e1e1e;
}

.pitch-section {
    margin-bottom: 1.25rem;
}

.pitch-section label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #cccccc;
    font-size: 0.8125rem;
}

.pitch-selector {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

#roof-pitch {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid #3c3c3c;
    border-radius: 3px;
    background: #3c3c3c;
    color: #ffffff;
    min-width: 200px;
    cursor: pointer;
}

#roof-pitch:focus {
    outline: none;
    border-color: #0e639c;
}

#roof-pitch option {
    background: #252526;
    color: #ffffff;
}

.pitch-visual {
    display: flex;
    align-items: center;
}

#pitch-diagram {
    position: relative;
    width: 80px;
    height: 50px;
}

.pitch-line {
    position: absolute;
    bottom: 10px;
    left: 10px;
    width: 60px;
    height: 2px;
    background: #0e639c;
    transform-origin: left center;
    transform: rotate(-18.43deg);
    transition: transform 0.2s ease;
}

.pitch-base {
    position: absolute;
    bottom: 10px;
    left: 10px;
    width: 60px;
    height: 1px;
    background: #4d4d4d;
}

.pitch-label {
    position: absolute;
    bottom: 18px;
    right: 0;
    font-size: 0.6875rem;
    color: #808080;
}

.results-display {
    background: #2d2d2d;
    border-radius: 3px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #3c3c3c;
}

.result-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #3c3c3c;
}

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

.result-label {
    flex: 1;
    color: #f1f1f1;
    font-size: 0.8125rem;
}

.result-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #ffffff;
    margin-right: 0.5rem;
    font-family: 'Consolas', 'Monaco', monospace;
}

.result-unit {
    color: #808080;
    font-size: 0.75rem;
}

.result-total {
    background: #1e3a5f;
    border-radius: 3px;
    padding: 0.75rem;
    margin: 0.5rem 0;
    border: 1px solid #0e639c;
}

.result-total .result-value {
    color: #4fc1ff;
    font-size: 1.5rem;
}

.result-squares {
    background: #1e3a2f;
    border-radius: 3px;
    padding: 0.75rem;
    margin: 0.5rem 0;
    border: 1px solid #2ea043;
}

.result-squares .result-value {
    color: #3fb950;
    font-size: 1.5rem;
}

.info-box {
    background: #2d2d2d;
    border: 1px solid #3c3c3c;
    border-left: 3px solid #0e639c;
    border-radius: 3px;
    padding: 0.75rem 1rem;
}

.info-box h3 {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #4fc1ff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-box p {
    font-size: 0.8125rem;
    color: #f1f1f1;
}

.help-text {
    font-size: 0.75rem;
    color: #f1f1f1;
}

.unit-section {
    margin-bottom: 1.25rem;
}

.unit-section label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #cccccc;
    font-size: 0.8125rem;
}

.unit-toggle {
    display: flex;
    gap: 0.5rem;
}

.btn-unit {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    background: #3c3c3c;
    border: 1px solid #3c3c3c;
    color: #808080;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-unit:hover {
    background: #4d4d4d;
    color: #cccccc;
}

.btn-unit.active {
    background: #0e639c;
    border-color: #0e639c;
    color: #ffffff;
}

footer {
    text-align: left;
    padding: 1rem 0;
    margin-top: 0.5rem;
    border-top: 1px solid #333;
}

footer p {
    font-size: 0.75rem;
    color: #6e6e6e;
}

footer strong {
    color: #cccccc;
}

footer a {
    color: #0e639c;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

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

    header h1 {
        font-size: 1.25rem;
    }

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

    .map-controls {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    #map {
        height: 300px;
    }

    .pitch-selector {
        flex-direction: column;
        align-items: stretch;
    }

    #roof-pitch {
        width: 100%;
    }

    .result-value {
        font-size: 1rem;
    }

    .result-total .result-value,
    .result-squares .result-value {
        font-size: 1.25rem;
    }
}

.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #3c3c3c;
    border-top-color: #0e639c;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

#map.drawing-mode {
    cursor: crosshair !important;
}

.polygon-info {
    position: absolute;
    background: #252526;
    color: #cccccc;
    padding: 0.5rem 0.75rem;
    border-radius: 3px;
    font-size: 0.75rem;
    border: 1px solid #3c3c3c;
    pointer-events: none;
    z-index: 1000;
}
