/* Modern Modal Styles */
/* Global polish for Bootstrap modals to feel more contemporary */
.modal-backdrop,
.modal-backdrop.show {
    background-color: transparent !important;
    opacity: 0 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.modal-backdrop {
    z-index: 1990 !important;
}

.modal {
    z-index: 2000 !important;
}

.modal.fade .modal-dialog {
    transition: transform 200ms ease, opacity 200ms ease;
    transform: translateY(10px) scale(0.98);
}

.modal.show .modal-dialog {
    transform: translateY(0) scale(1);
}

.modal-dialog {
    margin-top: 1.75rem;
    margin-bottom: 1.75rem;
}

.modal-content {
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
    box-shadow: 0 20px 56px rgba(2, 6, 23, 0.18);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px) saturate(120%);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
}

.modal-header {
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.92), rgba(248, 250, 252, 0.76));
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    padding: 0.85rem 1.25rem;
}

.modal-title {
    font-weight: 700;
    letter-spacing: 0.2px;
}

.modal-body {
    padding: 1.25rem 1.5rem;
}

.modal-footer {
    background-color: rgba(248, 250, 252, 0.72);
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    padding: 0.85rem 1.25rem;
}

.modal .btn {
    border-radius: 0.5rem; /* slightly rounder in modals */
}

.modal .btn-primary {
    box-shadow: 0 8px 20px rgba(0, 123, 255, 0.25);
}

.modal .btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    border: none;
}

.modal .btn-close {
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.08));
}

@media (max-width: 576px) {
    .modal-dialog {
        margin: 1rem; /* comfortable spacing on small screens */
    }
    .modal-content {
        border-radius: 14px;
    }
}

/* Override: samakan warna header modal dengan header navbar */
.modal-header {
    background: linear-gradient(180deg, rgba(11, 61, 145, 0.96), rgba(9, 46, 109, 0.94));
    color: #fff;
}
.modal-header .modal-title,
.modal-header i { color: #fff; }
.modal-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Brand theme variables and unified modal look */
:root {
    --brand-primary: #0b3d91; /* navbar background */
    --brand-primary-dark: #092e6d;
    --brand-primary-contrast: #ffffff;
}

/* Make footer subtly tinted to match header tone */
.modal-footer {
    background: linear-gradient(180deg, rgba(11, 61, 145, 0.05), rgba(11, 61, 145, 0.03));
}

/* Unify primary button tone inside modals */
.modal .btn-primary {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-dark) 100%);
    border: none;
    box-shadow: 0 8px 20px rgba(11, 61, 145, 0.25);
}

/* Ensure primary button hover stays in the same palette */
.modal .btn-primary:hover {
    background: linear-gradient(135deg, var(--brand-primary-dark) 0%, #081f57 100%);
    transform: translateY(-1px);
}

/* Slight accent on content border to harmonize with theme */
.modal-content {
    border-color: rgba(15, 23, 42, 0.12) !important;
}
.modal .modal-body > .modal-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.modal .modal-body .form-control,
.modal .modal-body .form-select,
.modal .modal-body textarea {
    background: linear-gradient(180deg, #f6fbff 0%, #ffffff 100%);
    border-color: #bcd6f4;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.03);
}

.modal .modal-body .form-control:focus,
.modal .modal-body .form-select:focus,
.modal .modal-body textarea:focus {
    border-color: #84b6f4;
    box-shadow: 0 0 0 0.2rem rgba(132, 182, 244, 0.25);
    background: linear-gradient(180deg, #eaf6ff 0%, #ffffff 100%);
}

.modal .modal-body .form-label,
.modal .modal-body label {
    color: #3f5c80;
}

/* Wide modal for data-heavy forms/tables */
#agentPerformanceComparisonModal .modal-dialog {
    max-width: min(98vw, 1400px);
    width: 98vw;
}

#agentPerformanceComparisonModal .modal-body {
    overflow-x: auto;
}

#welcomeModal .modal-dialog {
    max-width: min(92vw, 860px);
}

#welcomeModal .modal-content {
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.90);
    border-color: rgba(15, 23, 42, 0.10) !important;
    box-shadow: 0 26px 72px rgba(2, 6, 23, 0.22);
}

#welcomeModal .welcome-modal-body {
    padding: 0;
}

#welcomeModal .welcome-hero {
    background: var(--wm-bg);
    color: var(--wm-text);
    padding: 1.6rem 1.75rem;
    position: relative;
    overflow: hidden;
}

#welcomeModal .welcome-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(520px 240px at 18% 0%, rgba(255, 255, 255, 0.22) 0%, transparent 60%),
        radial-gradient(620px 320px at 92% 18%, rgba(255, 255, 255, 0.18) 0%, transparent 62%);
    pointer-events: none;
}

#welcomeModal .welcome-hero-inner {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
}

#welcomeModal .welcome-icon {
    width: 68px;
    height: 68px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

#welcomeModal .welcome-hero[data-tone="light"] .welcome-icon {
    background: rgba(255, 255, 255, 0.55);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

#welcomeModal .welcome-icon i {
    font-size: 1.85rem;
    color: var(--wm-icon);
}

#welcomeModal .welcome-copy {
    min-width: 0;
}

#welcomeModal .welcome-greet {
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    opacity: 0.95;
}

#welcomeModal .welcome-name {
    font-weight: 900;
    font-size: clamp(1.6rem, 3.4vw, 2.2rem);
    line-height: 1.1;
    margin-top: 0.15rem;
}

#welcomeModal .welcome-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

#welcomeModal .welcome-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.38rem 0.72rem;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.86rem;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.26);
    color: var(--wm-text);
}

#welcomeModal .welcome-hero[data-tone="light"] .welcome-pill {
    background: rgba(255, 255, 255, 0.65);
    border-color: rgba(0, 0, 0, 0.08);
    color: #0b1a2b;
}

#welcomeModal .welcome-pill i {
    opacity: 0.95;
}

#welcomeModal .welcome-pill-soft {
    background: rgba(255, 255, 255, 0.12);
}

#welcomeModal .welcome-hero[data-tone="light"] .welcome-pill-soft {
    background: rgba(255, 255, 255, 0.55);
}

#welcomeModal .welcome-motivation {
    margin-top: 0.9rem;
    color: var(--wm-sub);
    font-weight: 650;
    font-size: 1.02rem;
    max-width: 56ch;
}

@media (max-width: 576px) {
    #welcomeModal .welcome-hero {
        padding: 1.25rem 1.15rem;
    }
    #welcomeModal .welcome-hero-inner {
        flex-direction: column;
        gap: 0.9rem;
    }
    #welcomeModal .welcome-icon {
        width: 60px;
        height: 60px;
        border-radius: 16px;
    }
}
