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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.5;
    color: #333;
    background-color: #f5f5f5;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 20px;
    padding: 25px 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 1.6rem;
    color: #2c3e50;
    margin-bottom: 8px;
    font-weight: 700;
}

header p {
    color: #666;
    font-size: 1rem;
    font-weight: 500;
}

main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

section {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

h2 {
    font-size: 1.2rem;
    color: #2c3e50;
    margin-bottom: 12px;
    font-weight: 600;
}

/* How It Works */
.how-it-works {
    background: #e8f4f8;
    border-left: 4px solid #3498db;
}

.how-it-works ol {
    margin-left: 20px;
    color: #2c3e50;
}

.how-it-works li {
    margin-bottom: 8px;
    line-height: 1.4;
}

/* Route Profiles */
.profile-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.profile-btn {
    flex: 1;
    min-width: 120px;
    padding: 14px 12px;
    border: 2px solid #ddd;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    text-align: center;
}

.profile-btn:hover {
    border-color: #3498db;
    background: #f8f9fa;
}

.profile-btn.active {
    border-color: #3498db;
    background: #3498db;
    color: #fff;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

.form-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 150px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

label small {
    font-weight: 400;
    color: #7f8c8d;
    font-size: 0.8rem;
    display: block;
    margin-top: 2px;
}

input[type="number"] {
    width: 100%;
    padding: 14px 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    background-color: #fafafa;
    transition: border-color 0.2s, background-color 0.2s;
}

input[type="number"]:focus {
    outline: none;
    border-color: #3498db;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.calculate-btn {
    width: 100%;
    padding: 16px;
    background: #27ae60;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.2);
}

.calculate-btn:hover {
    background: #219150;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

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

.action-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.secondary-btn {
    flex: 1;
    padding: 12px;
    background: #95a5a6;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background: #7f8c8d;
    transform: translateY(-1px);
}

/* Decision Result */
.decision-display {
    text-align: center;
    padding: 25px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.decision-badge {
    display: inline-block;
    padding: 16px 40px;
    border-radius: 8px;
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.decision-badge.accept {
    background: #27ae60;
    color: #fff;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.decision-badge.borderline {
    background: #f39c12;
    color: #fff;
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
}

.decision-badge.pass {
    background: #e74c3c;
    color: #fff;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.decision-explanation {
    color: #555;
    font-size: 0.95rem;
    line-height: 1.4;
    max-width: 500px;
    margin: 0 auto;
}

.key-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.metric {
    background: #fff;
    padding: 16px 12px;
    border-radius: 8px;
    text-align: center;
    border: 2px solid #e8f4f8;
    transition: all 0.2s;
}

.metric:hover {
    border-color: #3498db;
    transform: translateY(-2px);
}

.metric-label {
    display: block;
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-bottom: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: #2c3e50;
}

/* Profitability Breakdown */
.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    align-items: center;
}

.breakdown-item.total {
    background: #e8f4f8;
    font-weight: 700;
    border: 2px solid #3498db;
}

.breakdown-label {
    color: #555;
    font-size: 0.9rem;
    font-weight: 500;
}

.breakdown-value {
    font-weight: 600;
    color: #2c3e50;
}

/* Minimum Payout */
#minimumPayoutText {
    font-size: 1.1rem;
    color: #2c3e50;
    text-align: center;
    padding: 18px;
    background: #fff8e1;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
    font-weight: 500;
}

/* Advanced Inputs */
.toggle-advanced {
    width: 100%;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #2c3e50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.toggle-advanced:hover {
    background: #e9ecef;
}

.toggle-icon {
    transition: transform 0.2s;
}

.toggle-advanced.open .toggle-icon {
    transform: rotate(180deg);
}

.advanced-content {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

/* Cost Mode */
.cost-mode-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.cost-mode-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
}

.cost-mode-btn:hover {
    border-color: #3498db;
}

.cost-mode-btn.active {
    border-color: #3498db;
    background: #3498db;
    color: #fff;
}

.mileage-rate-input {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.mileage-rate-input small {
    display: block;
    margin-top: 5px;
    color: #999;
    font-size: 0.8rem;
}

/* Saved Audits */
.saved-audits-list {
    max-height: 400px;
    overflow-y: auto;
}

.audit-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 10px;
    border-left: 4px solid #ddd;
}

.audit-item.accept {
    border-left-color: #27ae60;
}

.audit-item.borderline {
    border-left-color: #f39c12;
}

.audit-item.pass {
    border-left-color: #e74c3c;
}

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

.audit-decision {
    font-weight: 700;
    font-size: 1.1rem;
}

.audit-decision.accept {
    color: #27ae60;
}

.audit-decision.borderline {
    color: #f39c12;
}

.audit-decision.pass {
    color: #e74c3c;
}

.audit-date {
    font-size: 0.85rem;
    color: #999;
}

.audit-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    font-size: 0.9rem;
}

.audit-detail {
    color: #666;
}

/* Settings / Backup */
.backup-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.backup-btn {
    flex: 1;
    min-width: 150px;
    padding: 12px;
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.2s;
}

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

/* Footer */
footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    color: #999;
    font-size: 0.85rem;
}

.disclaimer {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 15px;
    color: #856404;
    text-align: left;
}

.disclaimer strong {
    display: block;
    margin-bottom: 5px;
}

/* SEO Intro */
.seo-intro p {
    margin-bottom: 12px;
    line-height: 1.6;
    color: #555;
}

/* FAQ Section */
.faq-section {
    background: #f8f9fa;
}

.faq-item {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.faq-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.faq-item h3 {
    font-size: 1rem;
    color: #2c3e50;
    margin-bottom: 8px;
    font-weight: 600;
}

.faq-item p {
    color: #555;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Profitability Explanation */
.profitability-explanation p {
    margin-bottom: 12px;
    line-height: 1.6;
    color: #555;
}

.profitability-explanation strong {
    color: #2c3e50;
}

/* Responsive */
@media (min-width: 768px) {
    body {
        padding: 30px;
    }

    header h1 {
        font-size: 2.2rem;
    }

    header p {
        font-size: 1.1rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .form-row {
        flex-wrap: nowrap;
    }

    .key-metrics {
        grid-template-columns: repeat(4, 1fr);
    }

    .breakdown-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .breakdown-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Small mobile devices */
@media (max-width: 430px) {
    body {
        padding: 10px;
    }

    header {
        padding: 15px 10px;
    }

    header h1 {
        font-size: 1.3rem;
    }

    header p {
        font-size: 0.9rem;
    }

    h2 {
        font-size: 1.1rem;
    }

    section {
        padding: 14px;
    }

    .profile-buttons {
        flex-direction: column;
    }

    .profile-btn {
        font-size: 0.95rem;
        padding: 12px;
        width: 100%;
    }

    .calculate-btn {
        font-size: 1rem;
        padding: 14px;
    }

    .action-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .secondary-btn {
        font-size: 0.95rem;
        padding: 12px;
        width: 100%;
    }

    .key-metrics {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .breakdown-grid {
        grid-template-columns: 1fr;
    }

    .metric {
        padding: 10px;
    }
    
    .metric-label {
        font-size: 0.7rem;
    }

    .metric-value {
        font-size: 1.1rem;
    }

    .decision-badge {
        font-size: 1.5rem;
        padding: 12px;
        display: block;
        width: 100%;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .form-row .form-group {
        width: 100%;
    }
}

/* Extra small mobile devices */
@media (max-width: 390px) {
    body {
        padding: 8px;
    }

    header h1 {
        font-size: 1.2rem;
    }

    header p {
        font-size: 0.85rem;
    }

    h2 {
        font-size: 1rem;
    }

    section {
        padding: 12px;
    }

    .profile-btn {
        font-size: 0.9rem;
        padding: 10px;
    }

    .calculate-btn {
        font-size: 0.95rem;
        padding: 12px;
    }

    .secondary-btn {
        font-size: 0.9rem;
        padding: 10px;
    }

    .metric {
        padding: 8px;
    }

    .metric-label {
        font-size: 0.65rem;
    }

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

    .decision-badge {
        font-size: 1.4rem;
        padding: 10px;
    }
}

/* Ultra small mobile devices */
@media (max-width: 360px) {
    body {
        padding: 6px;
    }

    header h1 {
        font-size: 1.1rem;
    }

    header p {
        font-size: 0.8rem;
    }

    h2 {
        font-size: 0.95rem;
    }

    section {
        padding: 10px;
    }

    .profile-btn {
        font-size: 0.85rem;
        padding: 8px;
    }

    .calculate-btn {
        font-size: 0.9rem;
        padding: 10px;
    }

    .secondary-btn {
        font-size: 0.85rem;
        padding: 8px;
    }

    .metric {
        padding: 6px;
    }

    .metric-label {
        font-size: 0.6rem;
    }

    .metric-value {
        font-size: 0.95rem;
    }

    .decision-badge {
        font-size: 1.3rem;
        padding: 8px;
    }
}

/* What-If decision colors */
.metric-value.accept {
    color: #27ae60;
}

.metric-value.borderline {
    color: #f39c12;
}

.metric-value.pass {
    color: #e74c3c;
}

/* Ad container */
.ad-container {
    min-height: 90px;
    background: #f8f9fa;
    border: 1px dashed #ddd;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 0.9rem;
}

.ad-container:empty {
    display: none;
}

/* Error states */
input:invalid {
    border-color: #e74c3c;
}

input:focus:invalid {
    outline: none;
    border-color: #e74c3c;
}
