* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0a0e15;
    min-height: 100vh;
    padding: 0;
    color: #e0e0e0;
}

/* Bootstrap navbar full width */
.navbar {
    background: #1a1f2e !important;
    border-bottom: 1px solid #2a3142 !important;
    margin-bottom: 0 !important;
    padding: 0.5rem 1rem;
}

.navbar-brand {
    color: #d4af37 !important;
    font-weight: 700;
    white-space: nowrap;
    transition: color 0.2s;
}

.navbar-brand:hover {
    color: #e5c158 !important;
}

.navbar-toggler {
    border-color: #d4af37;
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23d4af37' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 15px;
}

h1 {
    text-align: center;
    color: #d4af37;
    margin-bottom: 15px;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Bootstrap navbar overrides */
.navbar .nav-link {
    color: #b0b0b0 !important;
    padding: 10px 18px;
    border-radius: 6px;
    transition: all 0.2s;
    font-weight: 500;
    font-size: 0.95rem;
    white-space: nowrap;
}

.navbar .nav-link:hover {
    background: rgba(212, 175, 55, 0.1);
    color: #d4af37 !important;
}

.navbar .nav-link.active {
    background: rgba(46, 204, 113, 0.15);
    color: #2ecc71 !important;
}

.navbar .dropdown-menu {
    background: #0f1419 !important;
    border: 1px solid #2a3142 !important;
}

.navbar .dropdown-item {
    color: #b0b0b0 !important;
    transition: all 0.2s;
}

.navbar .dropdown-item:hover {
    background: rgba(212, 175, 55, 0.1) !important;
    color: #e0e0e0 !important;
}

.main-layout {
    display: block;
    max-width: 900px;
    margin: 0 auto;
}

/* Two-column mortgage layout */
.mortgage-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
    align-items: start;
}

.results-container {
    display: flex;
    flex-direction: column;
}

.result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 15px;
}

.result-item {
    background: #0f1419;
    border: 1px solid #2a3142;
    border-radius: 6px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.result-label {
    color: #888;
    font-size: 0.8rem;
    font-weight: 500;
}

.result-value {
    color: #2ecc71;
    font-size: 1rem;
    font-weight: 700;
}

.result-item.total-row {
    grid-column: 1 / -1;
    background: rgba(212, 175, 55, 0.1);
    border: 2px solid #d4af37;
}

.result-item.total-row .result-label {
    color: #d4af37;
}

.result-item.total-row .result-value {
    color: #d4af37;
    font-size: 1.2rem;
}

/* Educational content sections */
.content-section {
    background: #1a1f2e;
    border: 1px solid #2a3142;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
}

.content-section h2 {
    color: #d4af37;
    margin-bottom: 15px;
    font-size: 1.5rem;
    font-weight: 700;
}

.content-section h3 {
    color: #2ecc71;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.2rem;
    font-weight: 600;
}

.content-section h4 {
    color: #d4af37;
    margin-bottom: 8px;
    font-size: 1rem;
    font-weight: 600;
}

.content-section p {
    color: #b0b0b0;
    line-height: 1.7;
    margin-bottom: 12px;
}

.content-section ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.content-section li {
    color: #b0b0b0;
    line-height: 1.7;
    margin-bottom: 8px;
}

.content-section li strong {
    color: #2ecc71;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 15px;
}

.info-item {
    background: #0f1419;
    border: 1px solid #2a3142;
    border-radius: 8px;
    padding: 15px;
}

.info-item h4 {
    color: #d4af37;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.info-item p {
    color: #888;
    font-size: 0.85rem;
    line-height: 1.6;
    margin: 0;
}

.faq-item {
    background: #0f1419;
    border: 1px solid #2a3142;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.faq-item h4 {
    color: #2ecc71;
    margin-bottom: 10px;
    font-size: 1rem;
}

.faq-item p {
    color: #b0b0b0;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
}

.calculator-card {
    background: #1a1f2e;
    border: 1px solid #2a3142;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    margin-bottom: 20px;
}

.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #d4af37;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 10px 12px;
    background: #0f1419;
    border: 1px solid #2a3142;
    border-radius: 8px;
    font-size: 1rem;
    color: #e0e0e0;
    transition: all 0.3s;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
    background: #1a1f2e;
}

.helper-text {
    display: block;
    margin-top: 5px;
    font-size: 0.85rem;
    color: #2ecc71;
    font-weight: 500;
}

.calculate-btn {
    width: 100%;
    padding: 15px;
    background: #2ecc71;
    color: #0a0e15;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(46, 204, 113, 0.5);
    background: #27ae60;
}

.calculate-btn:active {
    transform: translateY(0);
}

.cmhc-notice {
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 6px;
    padding: 10px;
    margin-top: 12px;
    margin-bottom: 12px;
    border-left: 3px solid #d4af37;
}

.cmhc-notice strong {
    display: block;
    margin-bottom: 5px;
    color: #d4af37;
    font-size: 0.9rem;
}

.cmhc-notice p {
    margin: 3px 0;
    font-size: 0.8rem;
    color: #b0b0b0;
}

.results {
    margin-top: 15px;
    border-top: 1px solid #2a3142;
    padding-top: 15px;
}

.results h2 {
    color: #d4af37;
    margin-bottom: 12px;
    font-size: 1.2rem;
    font-weight: 700;
}

.result-main {
    background: rgba(212, 175, 55, 0.1);
    border: 2px solid #d4af37;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    margin-bottom: 15px;
}

.payment-amount {
    color: #e0e0e0;
}

.payment-amount span {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 3px;
    color: #d4af37;
}

.payment-amount small {
    font-size: 0.85rem;
    opacity: 0.8;
    color: #b0b0b0;
}

.result-details {
    background: #0f1419;
    border: 1px solid #2a3142;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 15px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #2a3142;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row span {
    color: #888;
    font-weight: 500;
    font-size: 0.9rem;
}

.detail-row strong {
    color: #2ecc71;
    font-size: 0.95rem;
    font-weight: 600;
}

.breakdown {
    margin-top: 15px;
}

.breakdown h3 {
    color: #d4af37;
    margin-bottom: 12px;
    font-size: 1rem;
    font-weight: 700;
}

.breakdown-item {
    margin-bottom: 12px;
}

.breakdown-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.85rem;
}

.breakdown-label span {
    color: #888;
    font-weight: 500;
}

.breakdown-label strong {
    color: #e0e0e0;
    font-weight: 600;
}

.bar {
    height: 24px;
    background: #0f1419;
    border: 1px solid #2a3142;
    border-radius: 6px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    transition: width 0.5s ease;
}

.bar-fill.principal {
    background: #d4af37;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
}

.bar-fill.interest {
    background: #2ecc71;
    box-shadow: 0 0 20px rgba(46, 204, 113, 0.3);
}

.info-section {
    display: none;
}

.info-section h3 {
    color: #d4af37;
    margin-bottom: 15px;
    font-size: 1.3rem;
    font-weight: 700;
}

.info-section ul {
    list-style: none;
}

.info-section li {
    padding: 10px 0;
    color: #b0b0b0;
    line-height: 1.6;
}

.info-section li strong {
    color: #2ecc71;
    font-weight: 600;
}

.charts-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-top: 15px;
}

.chart-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.chart-card {
    background: #1a1f2e;
    border: 1px solid #2a3142;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

#amortizationSection {
    max-height: 500px;
    overflow-y: auto;
}

#amortizationSection::-webkit-scrollbar {
    width: 8px;
}

#amortizationSection::-webkit-scrollbar-track {
    background: #0f1419;
    border-radius: 4px;
}

#amortizationSection::-webkit-scrollbar-thumb {
    background: #d4af37;
    border-radius: 4px;
}

#amortizationSection::-webkit-scrollbar-thumb:hover {
    background: #e5c158;
}

.chart-card h3 {
    color: #d4af37;
    margin-bottom: 20px;
    font-size: 1.2rem;
    font-weight: 700;
}

.chart-card canvas {
    max-height: 200px;
}

.bracket-item {
    padding: 10px;
    background: #0f1419;
    border: 1px solid #2a3142;
    border-radius: 6px;
    margin-bottom: 10px;
}

.bracket-item:last-child {
    margin-bottom: 0;
}

.swap-btn {
    background: rgba(212, 175, 55, 0.1);
    border: 2px solid #d4af37;
    color: #d4af37;
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.swap-btn:hover {
    background: #d4af37;
    color: #0a0e15;
    transform: scale(1.05);
}

.quick-conversions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quick-conversion-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #0f1419;
    border: 1px solid #2a3142;
    border-radius: 6px;
    font-size: 0.85rem;
}

.quick-conversion-item span {
    color: #b0b0b0;
}

.quick-conversion-item strong {
    font-size: 1.05rem;
}

@media (max-width: 1200px) {
    /* Layout already responsive - single column */
}

@media (max-width: 768px) {
    .mortgage-layout {
        grid-template-columns: 1fr;
    }
    
    .result-grid {
        grid-template-columns: 1fr;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    body {
        padding: 0;
    }
    
    .container {
        padding: 10px;
    }
    
    .calculator-card {
        padding: 15px;
    }
    
    .content-section {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }
    
    .payment-amount span {
        font-size: 1.6rem;
    }
    
    .chart-card {
        max-height: 220px;
    }
    
    .navbar-nav {
        text-align: center;
    }
    
    .navbar-brand {
        font-size: 0.9rem;
        margin-right: 10px !important;
    }
}

/* AI Chat Widget Styles */
#chatToggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d4af37, #e5c158);
    border: none;
    color: #0a0e15;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.4);
    transition: all 0.3s;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#chatToggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(212, 175, 55, 0.6);
}

#chatToggle.has-notification {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(212, 175, 55, 0.4);
    }
    50% {
        box-shadow: 0 4px 30px rgba(212, 175, 55, 0.8);
    }
}

.walter-notification {
    position: absolute;
    bottom: 70px;
    right: 0;
    background: #1a1f2e;
    border: 2px solid #d4af37;
    border-radius: 12px;
    padding: 12px 16px;
    color: #e0e0e0;
    font-size: 0.9rem;
    max-width: 250px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    display: none;
    line-height: 1.4;
    z-index: 999;
}

.walter-notification.show {
    opacity: 1;
    transform: translateY(0);
}

.walter-notification::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #d4af37;
}

#chatWidget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    height: 550px;
    background: #1a1f2e;
    border: 2px solid #d4af37;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    transform: translateY(calc(100% + 40px));
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1001;
    overflow: hidden;
}

#chatWidget.open {
    transform: translateY(0);
    opacity: 1;
}

.chat-header {
    background: linear-gradient(135deg, #d4af37, #e5c158);
    color: #0a0e15;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 10px 10px 0 0;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

#chatClose {
    background: none;
    border: none;
    color: #0a0e15;
    font-size: 1.5rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

#chatClose:hover {
    background: rgba(10, 14, 21, 0.1);
}

#chatMessages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #0f1419;
}

#chatMessages::-webkit-scrollbar {
    width: 6px;
}

#chatMessages::-webkit-scrollbar-track {
    background: #1a1f2e;
}

#chatMessages::-webkit-scrollbar-thumb {
    background: #d4af37;
    border-radius: 3px;
}

.chat-message {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.chat-message.bot .message-avatar {
    background: linear-gradient(135deg, #d4af37, #e5c158);
}

.chat-message.user .message-avatar {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
}

.message-content {
    background: #1a1f2e;
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 70%;
    word-wrap: break-word;
    color: #e0e0e0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.chat-message.user .message-content {
    background: #2a3142;
}

.chat-message.bot .message-content {
    border: 1px solid #2a3142;
}

.typing-indicator .message-content {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
}

.typing-indicator .message-content span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d4af37;
    animation: typing 1.4s infinite;
}

.typing-indicator .message-content span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator .message-content span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.chat-input-container {
    padding: 15px;
    background: #1a1f2e;
    border-top: 1px solid #2a3142;
}

#chatForm {
    display: flex;
    gap: 10px;
}

#chatInput {
    flex: 1;
    padding: 10px 14px;
    background: #0f1419;
    border: 1px solid #2a3142;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 0.9rem;
    resize: none;
    font-family: inherit;
}

#chatInput:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.1);
}

#chatInput:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-send-btn {
    background: #2ecc71;
    border: none;
    color: #0a0e15;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
    font-size: 1.1rem;
}

.chat-send-btn:hover:not(:disabled) {
    background: #27ae60;
    transform: translateY(-2px);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 600px) {
    #chatWidget {
        width: calc(100% - 20px);
        height: calc(100% - 20px);
        bottom: 10px;
        right: 10px;
    }
    
    #chatToggle {
        bottom: 15px;
        right: 15px;
    }
}

/* Homepage Chat Styles */
.home-chat-container {
    max-width: 900px;
    margin: 0 auto;
}

.chat-card {
    background: #1a1f2e;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.chat-welcome {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #2a3142;
}

.walter-avatar {
    font-size: 4rem;
    margin-bottom: 15px;
}

.chat-welcome h2 {
    color: #d4af37;
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.chat-welcome p {
    color: #b0b0b0;
    font-size: 1.1rem;
    line-height: 1.6;
}

.home-chat-messages {
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
    padding: 15px;
    background: #0f1419;
    border-radius: 8px;
    margin-bottom: 15px;
}

.home-chat-messages::-webkit-scrollbar {
    width: 8px;
}

.home-chat-messages::-webkit-scrollbar-track {
    background: #1a1f2e;
    border-radius: 4px;
}

.home-chat-messages::-webkit-scrollbar-thumb {
    background: #d4af37;
    border-radius: 4px;
}

.home-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #e5c158;
}

.home-chat-input form {
    display: flex;
    gap: 10px;
}

.home-chat-input input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid #2a3142;
    border-radius: 8px;
    background: #0f1419;
    color: #e0e0e0;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.home-chat-input input:focus {
    border-color: #d4af37;
}

.home-chat-input .chat-send-btn {
    padding: 14px 20px;
    background: #d4af37;
    color: #0a0e15;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: bold;
}

.home-chat-input .chat-send-btn:hover {
    background: #e5c158;
}

/* Calculator Grid */
.calculator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    padding: 0 10px;
    margin-bottom: 40px;
}

.calculator-link-card {
    background: #1a1f2e;
    border-radius: 12px;
    padding: 25px;
    text-decoration: none;
    color: #e0e0e0;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.calculator-link-card:hover {
    transform: translateY(-5px);
    border-color: #d4af37;
    box-shadow: 0 6px 12px rgba(212, 175, 55, 0.3);
    color: #e0e0e0;
}

.calc-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.calculator-link-card h3 {
    color: #d4af37;
    font-size: 1.3rem;
    margin-bottom: 10px;
}

.calculator-link-card p {
    color: #b0b0b0;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

/* Message styles for home chat */
.home-chat-messages .message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 8px;
    line-height: 1.6;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

.home-chat-messages .message.user {
    background: #d4af37;
    color: #0a0e15;
    margin-left: auto;
    margin-right: 0;
    text-align: right;
}

.home-chat-messages .message.assistant {
    background: #2a3142;
    color: #e0e0e0;
    margin-right: auto;
    margin-left: 0;
}

.home-chat-messages .message.loading {
    background: #2a3142;
    color: #d4af37;
    margin-right: auto;
    margin-left: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments for homepage */
@media (max-width: 768px) {
    .chat-welcome h2 {
        font-size: 1.5rem;
    }
    
    .walter-avatar {
        font-size: 3rem;
    }
    
    .calculator-grid {
        grid-template-columns: 1fr;
    }
    
    .home-chat-messages {
        min-height: 250px;
        max-height: 400px;
    }
}
