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

:root {
    /* Update these to match thele.co.uk header styling */
    --site-header-bg: #2F3E51;
    --site-header-border: rgba(255, 255, 255, 0.15);
    --site-header-link: #ffffff;
    --site-header-link-hover: #ffffff;
}

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

/* Simple site-style header (Home link only) */
.site-header {
    background: var(--site-header-bg);
    border-bottom: 1px solid var(--site-header-border);
}

.site-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.site-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.site-logo img {
    height: 26px;
    max-height: 26px;
    width: auto;
    display: block;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 14px;
}

.site-nav-link {
    display: inline-block;
    text-decoration: none;
    font-weight: 600;
    color: var(--site-header-link);
}

.site-nav-link:hover,
.site-nav-link:focus {
    text-decoration: underline;
    color: var(--site-header-link-hover);
    outline: none;
}

.calculator-container {
    max-width: 850px;
    margin: 24px auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 25px;
}

.calculator-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.calculator-inputs {
    flex: 0 0 350px;
    min-width: 0;
}

.calculator-results {
    flex: 0 0 400px;
    min-width: 0;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

h1 {
    color: #2c3e50;
    margin-bottom: 0;
    font-size: 26px;
    flex: 1;
}

.subtitle {
    color: #7f8c8d;
    margin-bottom: 20px;
    font-size: 14px;
}

.form-group {
    margin-bottom: 14px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #34495e;
    font-size: 14px;
}

input[type="number"],
input[type="text"],
select {
    width: 100%;
    max-width: 300px;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    transition: border-color 0.3s;
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: #3498db;
}

input[type="number"].error,
input[type="text"].error,
select.error {
    border-color: #e74c3c;
}

.error-message {
    color: #e74c3c;
    font-size: 13px;
    margin-top: 5px;
    display: none;
}

.error-message.show {
    display: block;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 0;
    margin-bottom: 15px;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
}

button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

.btn-reset {
    background-color: #95a5a6;
    color: white;
}

.btn-reset:hover {
    background-color: #7f8c8d;
}

.btn-cta {
    background-color: #3498db;
    color: white;
    flex: 1;
}

.btn-cta:hover {
    background-color: #2980b9;
}

.results-section {
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border-left: 4px solid #3498db;
    display: none;
    position: sticky;
    top: 20px;
}

.results-section h2 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 20px;
}

.result-item {
    margin-bottom: 12px;
    padding: 10px;
    background: white;
    border-radius: 4px;
}

.result-label {
    font-weight: 600;
    color: #34495e;
    margin-bottom: 5px;
    font-size: 14px;
}

.result-value {
    font-size: 18px;
    color: #2c3e50;
    font-weight: 700;
}

.result-summary {
    margin-top: 15px;
    padding: 12px;
    background: #e8f4f8;
    border-radius: 4px;
    font-size: 14px;
    color: #2c3e50;
    font-style: italic;
}

.results-actions {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-copy {
    background-color: #27ae60;
    color: white;
    padding: 10px 20px;
    font-size: 14px;
}

.btn-copy:hover {
    background-color: #229954;
}

.copy-success {
    color: #27ae60;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s;
}

.copy-success.show {
    opacity: 1;
}

.attribution {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
    font-size: 12px;
    color: #7f8c8d;
    text-align: center;
}

.matrix-message {
    color: #e67e22;
    font-weight: 600;
    padding: 15px;
    background: #fef5e7;
    border-radius: 4px;
    border-left: 4px solid #e67e22;
    margin-top: 10px;
}

.results-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-copy {
    background-color: #27ae60;
    color: white;
    padding: 8px 16px;
    font-size: 14px;
}

.btn-copy:hover {
    background-color: #229954;
}

.copy-success {
    color: #27ae60;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s;
}

.copy-success.show {
    opacity: 1;
}

.attribution {
    margin-left: auto;
    font-size: 12px;
    color: #7f8c8d;
    font-style: italic;
    margin-top: 0;
    margin-bottom: 0;
}

@media (max-width: 600px) {
    .results-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .attribution {
        margin-left: 0;
        margin-top: 10px;
    }
}

details {
    margin-top: 30px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 4px;
}

summary {
    font-weight: 600;
    color: #2c3e50;
    cursor: pointer;
    padding: 10px;
    user-select: none;
}

summary:hover {
    color: #3498db;
}

details ul {
    margin-top: 15px;
    margin-left: 20px;
    padding-left: 20px;
}

details li {
    margin-bottom: 8px;
    color: #555;
    line-height: 1.8;
}

@media (max-width: 900px) {
    .calculator-layout {
        flex-direction: column;
        gap: 20px;
    }

    .calculator-inputs {
        flex: 1;
        width: 100%;
    }

    .calculator-results {
        width: 100%;
    }

    .results-section {
        position: static;
    }

    input[type="number"],
    input[type="text"],
    select {
        max-width: 100%;
    }
}

@media (max-width: 600px) {
    .calculator-container {
        padding: 20px;
    }

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

    .btn-cta {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .site-logo img {
        height: 22px;
        max-height: 22px;
    }
}

/* Info trigger button */
.info-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 6px;
    padding: 0;
    border: 1px solid #3498db;
    border-radius: 50%;
    background: white;
    color: #3498db;
    font-size: 12px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    vertical-align: middle;
    transition: background-color 0.2s, color 0.2s;
}

.info-trigger:hover,
.info-trigger:focus {
    background: #3498db;
    color: white;
    outline: 2px solid #2980b9;
    outline-offset: 2px;
}

/* Info modal */
.info-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

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

.info-modal-content {
    position: relative;
    max-width: 500px;
    max-height: 80vh;
    margin: 50px auto;
    padding: 25px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    z-index: 1001;
}

.info-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    background: transparent;
    color: #7f8c8d;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s;
}

.info-modal-close:hover,
.info-modal-close:focus {
    color: #2c3e50;
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.info-modal-title {
    margin: 0 30px 15px 0;
    color: #2c3e50;
    font-size: 20px;
    font-weight: 600;
}

.info-modal-body {
    color: #555;
    line-height: 1.6;
}

.info-modal-body p {
    margin: 0 0 12px 0;
}

.info-modal-body ul {
    margin: 12px 0 12px 20px;
    padding-left: 20px;
}

.info-modal-body li {
    margin-bottom: 8px;
}

@media (max-width: 600px) {
    .info-modal-content {
        margin: 20px;
        max-height: 85vh;
        padding: 20px;
    }
}
