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

:root {
    --primary-color: #A52A2A;
    --primary-dark: #8B1A1A;
    --primary-light: #C53A3A;
    --secondary-color: #8B4513;
    --secondary-dark: #6B2F0A;
    --secondary-light: #AB5D1B;
    --accent-color: #CD853F;
    --accent-dark: #B8752F;
    --accent-light: #E1954F;
    --light-color: #DEB887;
    --light-dark: #C49A67;
    --lightest-color: #F5DEB3;
    --lightest-dark: #E8D1A3;
    --text-dark: #1A1A1A;
    --text-medium: #4A4A4A;
    --text-light: #6B6B6B;
    --text-muted: #8A8A8A;
    --background: #FAFAFA;
    --background-alt: #F5F5F5;
    --white: #FFFFFF;
    --shadow: rgba(0, 0, 0, 0.12);
    --shadow-medium: rgba(0, 0, 0, 0.18);
    --shadow-strong: rgba(0, 0, 0, 0.25);
    --border-radius: 12px;
    --transition: all 0.3s ease;
    --success-color: #2E7D32;
    --warning-color: #F57C00;
    --error-color: #D32F2F;
    --info-color: #1976D2;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background);
    color: var(--text-dark);
    line-height: 1.6;
    padding-bottom: 80px;
}

.app-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 10px var(--shadow);
}

.app-logo {
    height: 40px;
    width: auto;
    margin-bottom: 0.5rem;
    vertical-align: middle;
}

.app-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.app-header p {
    opacity: 0.9;
    font-size: 0.9rem;
}

.app-main {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.content-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.content-section.active {
    display: block;
}

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

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

.section-header h2 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.section-header p {
    color: var(--text-medium);
    font-size: 0.9rem;
    font-weight: 500;
}

.welcome-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: 0 4px 20px var(--shadow);
    margin-bottom: 2rem;
}

.welcome-card h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    text-align: center;
}

.welcome-card p {
    text-align: center;
    color: var(--text-medium);
    margin-bottom: 2rem;
    font-weight: 500;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.feature-card {
    background: var(--lightest-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px var(--shadow);
    border-color: var(--accent-color);
}

.feature-card i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.feature-card h3 {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.feature-card p {
    color: var(--text-medium);
    font-size: 0.8rem;
    font-weight: 500;
}

.form-container {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: 0 4px 20px var(--shadow);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--light-dark);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
    background: var(--white);
    color: var(--text-dark);
    font-weight: 500;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(165, 42, 42, 0.15);
    background: var(--white);
}

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

.form-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    justify-content: center;
    min-width: 120px;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
    font-weight: 600;
    border: 2px solid var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(165, 42, 42, 0.4);
}

.btn-secondary {
    background: var(--accent-color);
    color: var(--white);
    font-weight: 600;
    border: 2px solid var(--accent-color);
}

.btn-secondary:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(205, 133, 63, 0.4);
}

.letter-preview {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px var(--shadow);
    margin-top: 2rem;
    overflow: hidden;
}

.letter-preview.hidden {
    display: none;
}

.preview-header {
    background: var(--lightest-color);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--light-color);
}

.preview-header h3 {
    color: var(--primary-color);
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0.25rem;
}

.close-btn:hover {
    color: var(--primary-color);
}

.preview-content {
    padding: 2rem;
    line-height: 1.8;
    white-space: pre-line;
}

.calculation-results {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: 0 4px 20px var(--shadow);
    margin-top: 2rem;
}

.calculation-results.hidden {
    display: none;
}

.calculation-results h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    text-align: center;
}

.results-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--lightest-color);
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
    border: 1px solid var(--light-dark);
    font-weight: 500;
}

.results-item.total {
    background: var(--primary-color);
    color: var(--white);
    font-weight: bold;
    border-left-color: var(--white);
}

.results-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--lightest-color);
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
    border: 1px solid var(--light-dark);
    box-shadow: 0 2px 8px var(--shadow);
}

.results-section h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1rem;
    text-align: center;
}

.results-item.deduction {
    background: #ffebee;
    border-left-color: var(--error-color);
    border-color: #ffcdd2;
    color: var(--error-color);
}

.results-item.net {
    background: #e8f5e8;
    border-left-color: var(--success-color);
    border-color: #c8e6c9;
    color: var(--success-color);
}

.deduction-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.deduction-details small {
    color: var(--text-medium);
    font-size: 0.75rem;
    font-weight: 500;
}

.results-chart {
    margin-top: 2rem;
    text-align: center;
}

.results-chart canvas {
    max-width: 100%;
    height: auto;
}

.documents-container {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: 0 4px 20px var(--shadow);
}

.document-category {
    margin-bottom: 2rem;
}

.document-category h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--lightest-color);
}

.checklist {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 8px;
    transition: var(--transition);
    background: var(--lightest-color);
    border: 1px solid var(--light-dark);
    font-weight: 500;
}

.checkbox-item:hover {
    background: var(--light-color);
    border-color: var(--accent-color);
}

.checkbox-item input {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--accent-color);
    border-radius: 4px;
    margin-right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.checkbox-item input:checked + .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-item input:checked + .checkmark::after {
    content: '✓';
    color: var(--white);
    font-weight: bold;
}

.progress-container {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--lightest-color);
}

.progress-container h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: var(--lightest-color);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    width: 0%;
    transition: width 0.5s ease;
}

#progressText {
    text-align: center;
    font-weight: 600;
    color: var(--primary-color);
}

.guidance-container {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: 0 4px 20px var(--shadow);
}

.contract-selector h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    text-align: center;
}

.contract-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.contract-btn {
    background: var(--lightest-color);
    border: 2px solid var(--light-dark);
    border-radius: var(--border-radius);
    padding: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-dark);
    font-weight: 500;
}

.contract-btn:hover,
.contract-btn.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.contract-btn i {
    font-size: 1.5rem;
}

.guidance-content {
    padding: 1.5rem;
    background: var(--lightest-color);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.guidance-content.hidden {
    display: none;
}

.guidance-content h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.guidance-content ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.guidance-content li {
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-weight: 500;
}

.faq-container {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px var(--shadow);
    overflow: hidden;
}

.faq-item {
    border-bottom: 1px solid var(--lightest-color);
}

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

.faq-question {
    width: 100%;
    padding: 1.5rem;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    transition: var(--transition);
    border-bottom: 1px solid var(--light-dark);
}

.faq-question:hover {
    background: var(--lightest-color);
}

.faq-question[aria-expanded="true"] {
    background: var(--lightest-color);
    color: var(--primary-color);
}

.faq-icon {
    font-size: 1.2rem;
    font-weight: bold;
    transition: var(--transition);
}

.faq-question[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 1.5rem 1.5rem;
    color: var(--text-medium);
    line-height: 1.6;
    animation: slideDown 0.3s ease;
    font-weight: 500;
}

.faq-answer[hidden] {
    display: none;
}

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

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid var(--light-color);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    box-shadow: 0 -2px 10px var(--shadow);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-medium);
    transition: var(--transition);
    padding: 0.5rem;
    border-radius: 8px;
    min-width: 60px;
    font-weight: 500;
}

.nav-item:hover,
.nav-item.active {
    color: var(--primary-color);
    background: var(--lightest-color);
}

.nav-item i {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.nav-item span {
    font-size: 0.7rem;
    font-weight: 500;
}

footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-light);
    font-size: 0.8rem;
    background: var(--lightest-color);
    margin-top: 2rem;
}

/* Footer links with no link appearance */
footer a {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    padding: 0 2px;
    border-bottom: 1px dotted transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

footer a:hover,
footer a:active {
    color: var(--primary-color);
    border-bottom-color: currentColor;
}

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .app-header h1 {
        font-size: 1.3rem;
    }
    
    .section-header h2 {
        font-size: 1.3rem;
    }
    
    .feature-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .feature-card {
        padding: 1rem;
    }
    
    .feature-card i {
        font-size: 1.5rem;
    }
    
    .feature-card h3 {
        font-size: 0.9rem;
    }
    
    .feature-card p {
        font-size: 0.75rem;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .btn {
        width: 100%;
        padding: 0.875rem 1.5rem;
    }
    
    .contract-options {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .results-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 1rem;
    }
    
    .results-chart canvas {
        width: 100%;
        height: 200px;
    }
    
    .letter-preview {
        margin-top: 1rem;
    }
    
    .preview-content {
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    .calculation-results {
        margin-top: 1rem;
        padding: 1rem;
    }
    
    .documents-container {
        padding: 1rem;
    }
    
    .guidance-container {
        padding: 1rem;
    }
    
    .faq-container {
        margin-bottom: 1rem;
    }
    
    .faq-question {
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    .faq-answer {
        padding: 0 1rem 1rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .app-main {
        padding: 0.5rem;
    }
    
    .app-header {
        padding: 0.75rem;
    }
    
    .app-header h1 {
        font-size: 1.2rem;
    }
    
    .app-header p {
        font-size: 0.8rem;
    }
    
    .form-container,
    .welcome-card,
    .documents-container,
    .guidance-container,
    .faq-container {
        padding: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .feature-card {
        padding: 0.75rem;
    }
    
    .feature-card i {
        font-size: 1.2rem;
    }
    
    .contract-options {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .contract-btn {
        padding: 0.75rem;
        font-size: 0.8rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.625rem;
        font-size: 0.9rem;
    }
    
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .results-item {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .nav-item {
        padding: 0.375rem;
        min-width: 50px;
    }
    
    .nav-item i {
        font-size: 1rem;
    }
    
    .nav-item span {
        font-size: 0.6rem;
    }
    
    .bottom-nav {
        padding: 0.375rem 0;
    }
    
    .faq-question {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
    
    .faq-answer {
        padding: 0 0.75rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .preview-content {
        padding: 0.75rem;
        font-size: 0.85rem;
        line-height: 1.5;
    }
    
    .calculation-results h3 {
        font-size: 1.2rem;
    }
    
    .section-header h2 {
        font-size: 1.2rem;
    }
    
    .section-header p {
        font-size: 0.8rem;
    }
}

@media (min-width: 1024px) {
    .app-main {
        padding: 2rem;
    }
    
    .feature-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .form-actions {
        justify-content: flex-end;
    }
    
    .btn {
        width: auto;
    }
}
