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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f5e6d3 0%, #d4c4a8 100%);
    color: #333;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: #3d3226;
    margin-bottom: 40px;
    animation: slideDown 0.6s ease-out;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.95;
}

main {
    animation: fadeIn 0.8s ease-out;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

@media (max-width: 1024px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }
}

.panel {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.6s ease-out;
}

.panel h2 {
    font-size: 1.5em;
    color: #333;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #8b7355;
}

.panel h3 {
    font-size: 1.2em;
    color: #333;
    margin-bottom: 20px;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #555;
    font-size: 0.95em;
}

input[type="text"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95em;
    font-family: inherit;
    transition: all 0.3s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #8b7355;
    box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.1);
}

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

.help-text {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 15px;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    padding: 12px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 600;
    color: #666;
    font-size: 0.95em;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: #8b7355;
}

.tab-btn.active {
    color: #8b7355;
    border-bottom-color: #8b7355;
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

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

.upload-method {
    margin-bottom: 30px;
}

.upload-method h4 {
    font-size: 1.05em;
    color: #333;
    margin-bottom: 10px;
}

.divider {
    text-align: center;
    color: #999;
    margin: 30px 0;
    position: relative;
}

.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: calc(50% - 25px);
    height: 1px;
    background: #e0e0e0;
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

.file-input-wrapper {
    position: relative;
    margin-bottom: 15px;
}

.file-input {
    display: none;
}

.file-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 20px;
    border: 2px dashed #8b7355;
    border-radius: 8px;
    background: #faf7f2;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    color: #8b7355;
}

.file-label:hover {
    background: #f5eee2;
    border-color: #6d5940;
    color: #6d5940;
}

.file-input:focus + .file-label {
    outline: 2px solid #8b7355;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #8b7355 0%, #6d5940 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(139, 115, 85, 0.3);
}

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

.results-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.loading-spinner {
    text-align: center;
    padding: 40px 20px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #8b7355;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

.grant-card {
    background: white;
    border-left: 5px solid #8b7355;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.grant-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.grant-rank {
    display: inline-block;
    background: linear-gradient(135deg, #8b7355 0%, #6d5940 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.85em;
    margin-bottom: 12px;
}

.grant-rank.gold {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.grant-rank.silver {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
}

.grant-rank.bronze {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.grant-header {
    margin-bottom: 15px;
}

.grant-name {
    font-size: 1.2em;
    font-weight: 700;
    color: #333;
    margin-bottom: 5px;
}

.grant-funder {
    color: #666;
    font-size: 0.95em;
}

.grant-scores {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.score-box {
    background: #faf7f2;
    padding: 12px;
    border-radius: 6px;
    text-align: center;
}

.score-label {
    font-size: 0.8em;
    color: #666;
    font-weight: 600;
    margin-bottom: 5px;
}

.score-value {
    font-size: 1.3em;
    font-weight: 700;
    color: #8b7355;
}

.funding-fit {
    background: #fff9e6;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 0.9em;
    color: #333;
}

.insights-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.insight-block {
    margin-bottom: 12px;
}

.insight-title {
    font-weight: 700;
    color: #8b7355;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.insight-text {
    color: #555;
    font-size: 0.9em;
    line-height: 1.5;
}

.risk-alert {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.9em;
    margin-top: 12px;
    border-left: 3px solid #dc2626;
}

.download-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.btn-download {
    background: #10b981;
    color: white;
}

.btn-download:hover {
    background: #059669;
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3);
}

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

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
