body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f4f8;
    color: #333;
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

#app {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 30px;
    max-width: 800px;
    width: 100%;
    text-align: center;
}

header {
    margin-bottom: 30px;
}

.logo-container {
    margin-bottom: 15px;
}

#header-logo {
    max-height: 70px;
    width: auto;
}

header h1 {
    color: #0f1e3d; /* Brand Dark Blue */
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 2em;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.security-badge {
    font-size: 0.5em;
    font-weight: bold;
    color: #28a745;
    background-color: #e6ffed;
    padding: 4px 8px;
    border-radius: 12px;
    border: 1px solid #b3e6c1;
    white-space: nowrap;
}

header p {
    color: #555;
    margin-bottom: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* --- CHAT STYLES --- */
#chat-widget {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow: hidden;
    transition: all 0.3s ease-in-out;
}

#chat-widget.collapsed #chat-body {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

#chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: #eef2f7;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
}

#chat-header h3 {
    margin: 0;
    color: #1f2937;
    font-size: 1.1em;
    display: flex;
    align-items: center;
}

.chat-icon {
    font-size: 1.3em;
    margin-right: 10px;
}

#toggle-chat-btn {
    background: none;
    border: none;
    font-size: 1.8em;
    font-weight: bold;
    color: #6b7280;
    cursor: pointer;
    padding: 0 10px;
}

#chat-body {
    transition: max-height 0.3s ease-in-out, padding 0.3s ease-in-out;
    max-height: 500px;
    overflow: hidden;
}

#chat-messages {
    height: 250px;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    display: flex;
    max-width: 80%;
}

.message p {
    margin: 0;
    padding: 10px 15px;
    border-radius: 18px;
    line-height: 1.5;
}

.bot-message {
    align-self: flex-start;
}
.bot-message p {
    background-color: #e5e7eb;
    color: #1f2937;
    border-bottom-left-radius: 4px;
}

.user-message {
    align-self: flex-end;
}
.user-message p {
    background-color: #0f1e3d; /* Brand Dark Blue */
    color: white;
    border-bottom-right-radius: 4px;
}

#chat-input-container {
    display: flex;
    padding: 15px 20px;
    border-top: 1px solid #e5e7eb;
    gap: 10px;
}

#chat-input {
    flex-grow: 1;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    padding: 10px;
    font-size: 1em;
}
#chat-input:focus {
    outline: none;
    border-color: #ff6b6b; /* Brand Red */
    box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.2);
}

#chat-send-btn {
    flex-shrink: 0;
}

.typing-indicator p {
    display: flex;
    align-items: center;
    padding: 10px 15px;
}
.typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: #9ca3af;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: bounce 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-of-type(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-of-type(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}

/* --- END CHAT STYLES --- */

#analysis-selection h2, #calculator-container h2, #oic-simulator-container h2 {
    color: #333;
    margin-bottom: 20px;
}

#calculator-container p, #oic-simulator-container p {
    color: #555;
    margin-bottom: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.analysis-option-btn {
    background-color: #ffffff;
    border: 2px solid #e0e7ff;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.analysis-option-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(15, 30, 61, 0.15); /* Shadow from Brand Blue */
    border-color: #0f1e3d; /* Brand Dark Blue */
}

.option-icon {
    font-size: 2.5em;
    margin-bottom: 20px;
}

.option-title {
    font-size: 1.1em;
    font-weight: bold;
    color: #0f1e3d; /* Brand Dark Blue */
    margin-bottom: 5px;
}

.option-desc {
    font-size: 0.9em;
    color: #555;
    flex-grow: 1;
}

#upload-container {
    border: 2px dashed #ccc;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 20px;
    background-color: #fafafa;
}

#upload-container p {
    margin-top: 0;
    font-weight: bold;
    color: #333;
    font-size: 1.2em;
}

input[type="file"] {
    display: block;
    margin: 15px auto;
    border: 1px solid #ccc;
    padding: 8px;
    border-radius: 5px;
    width: 90%;
    max-width: 400px;
    background-color: white;
    cursor: pointer;
}

input#w2-upload {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

button {
    background-color: #ff6b6b; /* Brand Red */
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    margin: 5px;
}

#back-btn, .back-btn-alt {
    background-color: #6c757d;
}

#back-btn:hover, .back-btn-alt:hover {
    background-color: #5a6268;
}

button:hover:not(:disabled) {
    background-color: #e05252; /* Darker Brand Red */
    transform: translateY(-2px);
}

button:disabled {
    background-color: #aaa;
    cursor: not-allowed;
}

#result-container {
    text-align: left;
    padding: 20px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 8px;
}

#result-buttons {
    margin-top: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

#result-buttons button {
    margin: 5px;
}

#generate-pdf-btn {
    background-color: #17a2b8; /* A different, professional color */
}

#generate-pdf-btn:hover {
    background-color: #138496;
}

#generate-letter-btn {
    background-color: #0f1e3d; /* Brand Dark Blue */
}

#generate-letter-btn:hover {
    background-color: #1f2937;
}

#back-from-result-btn {
    background-color: #6c757d;
}

#back-from-result-btn:hover {
    background-color: #5a6268;
}

#result-container h2 {
    color: #0f1e3d; /* Brand Dark Blue */
    margin-top: 0;
    text-align: center;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.hidden {
    display: none;
}

#loader {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #ff6b6b; /* Brand Red */
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

#analysis-output .analysis-section {
    margin-bottom: 25px;
}

#analysis-output .analysis-section h3 {
    color: #0f1e3d; /* Brand Dark Blue */
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

#analysis-output ul {
    list-style-type: none;
    padding: 0;
}

#analysis-output li {
    display: flex;
    align-items: flex-start;
    background-color: #e7eaf0; /* Lighter Brand Blue */
    border-left: 5px solid #0f1e3d; /* Brand Dark Blue */
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 4px;
    line-height: 1.5;
}

#analysis-output li ul {
    list-style-type: disc;
    padding-left: 20px;
    margin-top: 5px;
}
#analysis-output li ul li {
    background: none;
    border: none;
    padding: 2px 0;
    margin-bottom: 0;
    font-size: 0.95em;
}
#analysis-output li ul li::before {
    content: none;
}

#analysis-output li.warning {
    background-color: #fffbe6;
    border-left-color: #ffc107;
}

#analysis-output li.good {
    background-color: #e6ffed;
    border-left-color: #28a745;
}

#analysis-output li.good, #analysis-output li.good::before {
    color: #155724;
}

#analysis-output li.info {
    background-color: #eef1f3;
    border-left-color: #6c757d;
}

#analysis-output li::before {
    content: 'i';
    font-family: 'Georgia', serif;
    font-weight: bold;
    margin-right: 15px;
    font-size: 1.5em;
    min-width: 25px;
    text-align: center;
    line-height: 1.2;
    color: #0f1e3d;
}

#analysis-output li strong {
    color: #0f1e3d;
}

#analysis-output li.good::before {
    content: '✓';
    color: #28a745;
}

#analysis-output li.warning::before {
    content: '⚠️';
    color: #ffc107;
}

#analysis-output li.info::before {
    content: 'ℹ️';
    color: #6c757d;
}

.disclaimer {
    margin-top: 20px;
    padding: 10px;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    border-radius: 5px;
    font-size: 0.9em;
    text-align: center;
}

/* Form Styles */
#refund-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    text-align: left;
    max-width: 550px;
    margin: 0 auto;
}

.form-section {
    border: 1px solid #e0e7ff;
    padding: 20px;
    border-radius: 8px;
    margin: 0;
}

.form-section legend {
    font-weight: bold;
    color: #0f1e3d;
    padding: 0 10px;
    font-size: 1.1em;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
}

.form-group input[type="number"],
.form-group input[type="file"],
.form-group select {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1em;
    width: 100%;
    box-sizing: border-box;
}

.form-group small {
    font-size: 0.8em;
    color: #555;
    margin-top: 5px;
}

.form-group input[type="number"]:focus,
.form-group select:focus {
    outline: none;
    border-color: #ff6b6b; /* Brand Red */
    box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.2);
}

.form-group input[type="file"] {
    cursor: pointer;
}

.button-group {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

#ocr-status {
    margin-top: 10px;
    font-style: italic;
    color: #0f1e3d; /* Brand Dark Blue */
    text-align: center;
    min-height: 1.2em;
}

/* Footer & Security Notice */
footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.security-notice {
    background-color: #eef2f7;
    border: 1px solid #dbe2ea;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.security-notice h3 {
    margin: 0 0 10px 0;
    color: #0f1e3d;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.security-notice p {
    margin: 0;
    color: #374151;
    line-height: 1.7;
    max-width: 650px;
    margin-left: auto;
    margin-right: auto;
}

.security-notice strong {
    color: #0f1e3d;
}

/* End Form Styles */