/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-white: #ffffff;
    --bg-gray: #f9fafb;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-white);
}

/* Typography */
h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

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

/* Header */
header {
    background-color: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
}

nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

nav a:hover {
    color: var(--primary-color);
}

/* Main Content */
main {
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 3rem 0;
    background-color: var(--bg-gray);
    border-radius: 0.5rem;
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.125rem;
    max-width: 600px;
    margin: 0 auto 2rem;
}

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.card a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

/* Calculator Section */
.calculator-section {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 2rem;
    margin: 2rem 0;
}

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

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

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

.btn-secondary {
    background-color: var(--text-secondary);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--text-primary);
}

.btn-block {
    width: 100%;
}

/* Results */
.results {
    margin-top: 2rem;
    padding: 2rem;
    background-color: var(--bg-gray);
    border-radius: 0.5rem;
    display: none;
}

.results.show {
    display: block;
}

.result-item {
    padding: 1rem;
    margin-bottom: 1rem;
    background: var(--bg-white);
    border-left: 4px solid var(--primary-color);
    border-radius: 0.25rem;
}

.result-item:last-child {
    margin-bottom: 0;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.classification-first {
    border-left-color: #10b981;
}

.classification-first .result-value {
    color: #10b981;
}

.classification-21 {
    border-left-color: #3b82f6;
}

.classification-21 .result-value {
    color: #3b82f6;
}

.classification-22 {
    border-left-color: #f59e0b;
}

.classification-22 .result-value {
    color: #f59e0b;
}

.classification-third {
    border-left-color: #ef4444;
}

.classification-third .result-value {
    color: #ef4444;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

table th,
table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

table th {
    font-weight: 600;
    color: var(--text-primary);
    background-color: var(--bg-gray);
}

/* Dynamic Rows */
.dynamic-inputs {
    margin: 1rem 0;
}

.input-row {
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: end;
}

.input-row input {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
}

.btn-remove {
    padding: 0.75rem 1rem;
    background-color: var(--danger-color);
    color: white;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
}

.btn-remove:hover {
    background-color: #dc2626;
}

.btn-add {
    margin-top: 0.5rem;
    background-color: var(--success-color);
    color: white;
}

.btn-add:hover {
    background-color: #059669;
}

/* Content Section */
.content-section {
    margin: 3rem 0;
    padding: 2rem;
    background-color: var(--bg-gray);
    border-radius: 0.5rem;
}

.content-section h2 {
    margin-top: 2rem;
}

.content-section h2:first-child {
    margin-top: 0;
}

.content-section ul,
.content-section ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.content-section li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

/* FAQ */
.faq {
    margin: 2rem 0;
}

.faq-item {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
}

.faq-item h3 {
    color: var(--text-primary);
}

/* Footer */
footer {
    background-color: var(--bg-gray);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: 4rem;
}

footer .container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

footer h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

footer ul {
    list-style: none;
}

footer li {
    margin-bottom: 0.5rem;
}

footer a {
    color: var(--text-secondary);
    text-decoration: none;
}

footer a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.alert-info {
    background-color: #dbeafe;
    border-left: 4px solid #3b82f6;
    color: #1e40af;
}

.alert-warning {
    background-color: #fef3c7;
    border-left: 4px solid #f59e0b;
    color: #92400e;
}

.alert-success {
    background-color: #d1fae5;
    border-left: 4px solid #10b981;
    color: #065f46;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 1.75rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    nav ul {
        gap: 1rem;
        flex-wrap: wrap;
    }

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

    .input-row {
        grid-template-columns: 1fr;
    }

    .input-row .btn-remove {
        width: 100%;
    }

    footer .container {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 0.875rem;
    }

    table th,
    table td {
        padding: 0.5rem;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Print Styles */
@media print {
    header,
    footer,
    nav,
    .btn {
        display: none;
    }
}
