/* Create watermark protection */
@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) rotate(-45deg) scale(1);
    }

    50% {
        transform: translate(-50%, -50%) rotate(-45deg) scale(1.05);
    }

    100% {
        transform: translate(-50%, -50%) rotate(-45deg) scale(1);
    }
}

.watermark-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    font-size: 8vw;
    font-weight: bold;
    color: rgba(255, 0, 0, 0.4);
    white-space: nowrap;
    pointer-events: none;
    z-index: 10002;
    text-transform: uppercase;
    font-family: Arial, sans-serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    user-select: none;
    width: 100%;
    text-align: center;
    animation: pulse 2s ease-in-out infinite;
}

.watermark-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10002;
    overflow: hidden;
}

.content-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.1);
    pointer-events: none;
    z-index: 10001;
}

@media (max-width: 768px) {
    .watermark-overlay {
        /* Larger font size for better visibility on mobile */
        font-size: 12vw;
        /* Slightly less rotation for better readability */
        transform: translate(-50%, -50%) rotate(-35deg);
        /* Reduced shadow for cleaner look on small screens */
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
        animation: pulse-mobile 2s ease-in-out infinite;
    }

    /* Reduced rotation */
    @keyframes pulse-mobile {
        0% {
            transform: translate(-50%, -50%) rotate(-35deg) scale(1);
        }

        50% {
            transform: translate(-50%, -50%) rotate(-35deg) scale(1.05);
        }

        100% {
            transform: translate(-50%, -50%) rotate(-35deg) scale(1);
        }
    }
}

/* Logo clicable link */
.hover-container:hover .hover-black-text {
    color: #000000 !important;
}

.hover-container:hover .hover-black-img {
    filter: brightness(0) saturate(100%) !important;
}

/* Width between the logo and headers */
.responsive-margin {
    /* Default margin for larger screen */
    margin-right: 230px;
}

@media (max-width: 768px) {
    .responsive-margin {
        margin-right: 25px;
    }
}

/* Body background color */
body {
    background-color: #f8f8f8;
}

/* Rounded corners */
.card {
    border-radius: 10px;
    overflow: hidden;
}

.js-plotly-plot {
    border-radius: 10px;
    overflow: hidden;
}

.nav-pills .nav-link {
    border-radius: 10px;
}

.form-control,
.selectize-input {
    border-radius: 10px;
}

/* Greetings image */
#greeting-image {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Allows interaction with content underneath */
    pointer-events: none;
    opacity: 1;
    /* Slower fade transition */
    transition: opacity 1s ease-in-out;
}

#greeting-image img {
    width: 220px;
    height: 220px;
}

/* Scroll to the top button */
#scroll-to-top-inf,
#scroll-to-top-ind,
#scroll-to-top-com,
#scroll-to-top-ig {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 999;
    font-size: 14px;
    border: none;
    outline: none;
    background-color: #158cba;
    color: white;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

#scroll-to-top-inf:hover,
#scroll-to-top-ind:hover,
#scroll-to-top-com:hover,
#scroll-to-top-ig:hover {
    background-color: #000000;
}

/* No plotly brand */
.js-plotly-plot .plotly .modebar {
    display: none !important;
}

/* Loading spinner for big plots */
.loader {
    border: 12px solid #f3f3f3;
    border-top: 12px solid #3498db;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

#loading-spinner-inf,
#loading-spinner-ind,
#loading-spinner-stc,
#loading-spinner-com,
#loading-spinner-ig {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    text-align: center;
}

/* To move spinner and chart together */
.chart-wrapper {
    position: relative;
    width: 100%;
}

#chart-container-inf,
#chart-container-ind,
#chart-container-stc,
#chart-container-com,
#chart-container-ig {
    position: relative;
    /* Adjust this value based on your expected chart height */
    min-height: 400px;
    /* To move spinner and chart together */
    width: 100%;
}

/* Hight of the plots to be adjusted as for inputs */
.responsive-height-inf {
    height: 30px;
}

@media (max-width: 768px) {
    .responsive-height-inf {
        height: 0px;
    }

    .responsive-height-re {
        height: 0px;
    }

    .responsive-height-rei {
        height: 0px;
    }

    .responsive-height-fi {
        height: 0px;
    }
}

/* Style for inputs in case of changing background color */
input[type="number"],
input[type="password"],
input[type="date"],
select,
.form-control,
.shiny-date-range-input input,
.date-range-input input {
    color: #333 !important;
    background-color: #fff !important;
}

/* Style for placeholders in case of changing background color */
@media (prefers-color-scheme: dark) {
    input::placeholder {
        color: #a0a0a0 !important;
        opacity: 1;
    }
}

@media (prefers-color-scheme: dark) {
    input::-webkit-input-placeholder {
        color: #a0a0a0 !important;
    }

    input::-moz-placeholder {
        color: #a0a0a0 !important;
    }

    input:-ms-input-placeholder {
        color: #a0a0a0 !important;
    }

    input:-moz-placeholder {
        color: #a0a0a0 !important;
    }
}

/* Table headers in case of changing background color */
#protected_content th,
#protected_content thead,
#protected_content thead tr,
#protected_content thead th {
    color: #333 !important;
    background-color: #f8f8f8 !important;
}

/* Table hover in case of changing background color */
.react-data-grid-row:hover,
.datatable tr:hover td,
.dataTable tr:hover td,
table tr:hover td,
#sessions_table tr:hover td,
#interactions_table tr:hover td {
    background-color: #e6f2ff !important;
    /* Light blue hover */
    color: #333 !important;
}

/* Table cells in case of changing background color */
#sessions_table td,
#interactions_table td,
.react-data-grid-cell,
.datatable td {
    color: #333 !important;
    background-color: #fff !important;
}

/* Color of sliders */
.js-irs-0 .irs-single,
.js-irs-0 .irs-bar-edge,
.js-irs-0 .irs-bar,
.js-irs-1 .irs-single,
.js-irs-1 .irs-bar-edge,
.js-irs-1 .irs-bar,
.js-irs-2 .irs-single,
.js-irs-2 .irs-bar-edge,
.js-irs-2 .irs-bar {
    background: #158cba;
    border: 0.5px solid white;
}

/* Border around slider handle (circle) */
.js-irs-0 .irs-handle,
.js-irs-1 .irs-handle,
.js-irs-2 .irs-handle {
    border: 0.5px solid black;
}

/* Align headers of the savings account table to the left */
.table th {
    text-align: left !important;
    padding: 10px;
}

.table td {
    padding: 10px;
}

/* Admin login - Dark Mode Resistant */
.admin-login-container {
    max-width: 400px;
    margin: 50px auto;
    padding: 30px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.admin-title {
    text-align: center;
    color: #2c3e50 !important;
    margin-bottom: 25px;
    font-weight: 600;
}

.admin-input-container {
    background-color: #ffffff;
    color: #333333 !important;
}

.admin-input-container .shiny-input-container {
    width: 100%;
    background-color: #ffffff;
}

.admin-input-container input {
    width: 100%;
    padding: 10px 15px;
    margin-bottom: 20px;
    border: 1px solid #dcdfe6;
    border-radius: 4px;
    transition: border-color 0.2s;
    background-color: #ffffff;
    color: #333333 !important;
}

.admin-input-container input:focus {
    border-color: #158cba;
    outline: none;
    box-shadow: 0 0 0 2px rgba(21, 140, 186, 0.2);
}

.admin-input-container input::placeholder {
    color: #909399 !important;
    opacity: 1 !important;
}

.admin-button {
    width: 100%;
    padding: 12px;
    background-color: #158cba;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.admin-button:hover {
    background-color: #000000;
    color: white;
}

.admin-note {
    text-align: center;
    margin-top: 15px;
    font-size: 12px;
    color: #909399;
}

/* ROA and ROE - Dark Mode Resistant */
.roa-outer-container {
    background: light-dark(#f8fafc, #0F172A);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid light-dark(#e9ecef, #334155);
    box-shadow: light-dark(0 2px 4px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.3));
}

.roa-responsive-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0;
    background: light-dark(#f8fafc, #0F172A);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: light-dark(#1a202c, #f1f5f9);
}

.roa-header-title {
    color: light-dark(#1a202c, #f1f5f9);
    margin: 0;
    font-weight: 600;
    font-size: clamp(18px, 4.5vw, 24px);
    letter-spacing: -0.5px;
}

.roa-header-border {
    margin-bottom: 16px;
    border-bottom: 2px solid light-dark(#e2e8f0, #334155);
    padding-bottom: 12px;
}

.roa-cash-flow-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: light-dark(#ffffff, #1e293b);
    border: 1px solid light-dark(#e2e8f0, #334155);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: light-dark(0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.3));
    gap: 12px;
}

.roa-cash-flow-content {
    flex: 1;
    min-width: 0;
}

.roa-cash-flow-title {
    color: light-dark(#4a5568, #94a3b8);
    margin: 0 0 6px 0;
    font-weight: 500;
    font-size: clamp(13px, 2.8vw, 15px);
}

.roa-cash-flow-amount {
    font-weight: 700;
    font-size: clamp(20px, 5vw, 28px);
    margin: 0;
    word-break: break-word;
}

.roa-cash-flow-icon {
    width: clamp(28px, 7vw, 40px);
    height: clamp(28px, 7vw, 40px);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.roa-section-title {
    color: light-dark(#1a202c, #f1f5f9);
    margin: 0 0 6px 0;
    font-weight: 600;
    font-size: clamp(16px, 3.5vw, 18px);
}

.roa-section-subtitle {
    color: light-dark(#718096, #94a3b8);
    font-size: clamp(11px, 2.2vw, 13px);
    margin-bottom: 12px;
}

.roa-metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.roa-metric-card {
    background: light-dark(#ffffff, #1e293b);
    border: 1px solid light-dark(#e2e8f0, #334155);
    border-radius: 6px;
    padding: 16px 12px;
    text-align: center;
    box-shadow: light-dark(0 1px 2px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.2));
}

.roa-metric-label {
    color: light-dark(#718096, #94a3b8);
    font-size: clamp(10px, 2.2vw, 12px);
    font-weight: 500;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.roa-metric-value {
    color: light-dark(#1a202c, #f1f5f9);
    font-size: clamp(18px, 4.5vw, 24px);
    font-weight: 700;
    margin: 0;
}

.roa-metric-value-colored {
    font-size: clamp(18px, 4.5vw, 24px);
    font-weight: 700;
    margin: 0;
}

.roa-section-container {
    margin-bottom: 16px;
}

.roa-cash-flow-amount.positive {
    color: light-dark(#065f46, #10b981) !important;
}

.roa-cash-flow-amount.negative {
    color: light-dark(#c53030, #f87171) !important;
}

.roa-metric-value-colored.positive {
    color: light-dark(#065f46, #10b981) !important;
}

.roa-metric-value-colored.negative {
    color: light-dark(#c53030, #f87171) !important;
}

.roa-cash-flow-icon.positive {
    background: light-dark(#d1fae5, #064e3b) !important;
}

.roa-cash-flow-icon.negative {
    background: light-dark(#fed7d7, #7f1d1d) !important;
}

@media (max-width: 640px) {
    .roa-outer-container {
        padding: 16px;
    }

    .roa-responsive-container {
        padding: 0;
    }

    .roa-cash-flow-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .roa-cash-flow-content {
        width: 100%;
    }

    .roa-cash-flow-icon {
        align-self: flex-end;
    }

    .roa-metric-card {
        padding: 12px 8px;
    }

    .roa-metrics-grid {
        gap: 6px;
    }
}

@media (max-width: 360px) {
    .roa-outer-container {
        padding: 12px;
    }

    .roa-responsive-container {
        padding: 0;
    }

    .roa-cash-flow-card {
        padding: 12px;
    }

    .roa-metric-card {
        padding: 10px 6px;
    }
}

/* Mortgage Overview - Disclaimer Box */
.disclaimer-box {
    background: #fffbe6;
    border: 1.5px solid #ffe066;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(255, 224, 102, 0.15);
    padding: 10px 14px;
    margin-bottom: 12px;
    font-family: 'Roboto', sans-serif;
    color: #4A5055;
}

@media (max-width: 640px) {
    .disclaimer-box {
        padding: 12px 8px;
    }
}