@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #00023c;
    --primary-hover: #000125;
    --bg-light: #f4f7fe;
    --text-main: #2D3748;
    --text-muted: #718096;
    --white: #ffffff;
    --transition: all 0.3s ease;
    --border-radius: 20px;
    --shadow: 0 10px 30px rgba(0, 2, 60, 0.1);
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    margin: 0;
}

/* Base visual para todos los diálogos de la aplicación. */
body .modal-backdrop.show {
    opacity: .68 !important;
    background-color: rgba(10, 17, 32, .94);
    -webkit-backdrop-filter: blur(8px) saturate(.85) !important;
    backdrop-filter: blur(8px) saturate(.85) !important;
}

/* Desenfoca el contenido real detrás del modal como respaldo del backdrop-filter. */
body.modal-open #wrapper {
    filter: blur(5px);
    transition: filter .12s ease-out;
}

body .modal .modal-content {
    position: relative;
    overflow: hidden;
    border: 1px solid #e0e7f0;
    border-radius: 1.1rem;
    background: #fff;
    box-shadow: 0 24px 68px rgba(24, 35, 58, .22);
}

body .modal .modal-header,
body .modal .modal-footer {
    flex: 0 0 auto;
    padding: 1.15rem 1.4rem;
    border-color: #e6ebf2;
    background: #fff;
}

body .modal .modal-header {
    align-items: flex-start;
    gap: 1rem;
    background: #f8fafc;
}

body .modal .modal-header .modal-title {
    color: #233248;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.25;
}

body .modal .modal-header .btn-close {
    flex: 0 0 auto;
    width: 2.25rem;
    height: 2.25rem;
    margin: -.15rem -.25rem 0 0;
    padding: .7rem;
    border-radius: 50%;
    background-color: #f2f5f9;
    opacity: .78;
}

body .modal .modal-header .btn-close:hover {
    background-color: #e8edf4;
    opacity: 1;
}

body .modal .modal-body {
    min-width: 0;
    padding: 1.35rem 1.4rem;
    background: #fff;
}

body .modal .modal-footer {
    justify-content: flex-end;
    gap: .6rem;
}

body .modal .modal-footer .btn-primary {
    border-color: #155e9c;
    background-color: #155e9c;
}

body .modal .modal-footer .btn-primary:hover:not(:disabled) {
    border-color: #124f83;
    background-color: #124f83;
}

body .modal :is(button, a, input, select, textarea):focus-visible {
    outline: 3px solid rgba(23, 105, 170, .3);
    outline-offset: 2px;
}

@media (max-width: 575.98px) {
    body .modal .modal-dialog:not(.modal-fullscreen) {
        width: auto;
        margin: .6rem;
    }
    body .modal .modal-header,
    body .modal .modal-body,
    body .modal .modal-footer {
        padding-right: 1rem;
        padding-left: 1rem;
    }
    body .modal .modal-footer {
        flex-wrap: wrap;
    }
    body .modal .modal-footer .btn {
        min-height: 2.75rem;
    }
}

.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-wrap: wrap;
    min-height: 550px;
}

.login-form-side {
    flex: 1;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-brand-side {
    flex: 1;
    background: linear-gradient(135deg, var(--primary-color) 0%, #1a1c5e 100%);
    color: var(--white);
    padding: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-brand-side::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    top: -100px;
    right: -100px;
}

.login-brand-side::after {
    content: '';
    position: absolute;
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    bottom: -50px;
    left: -50px;
}

h2 {
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    font-weight: 400;
}

.form-label {
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.input-group-custom {
    position: relative;
    margin-bottom: 1.5rem;
}

.input-group-custom > i:first-child {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
}

.form-control-custom {
    border: none;
    border-bottom: 2px solid #E2E8F0;
    border-radius: 0;
    padding: 0.75rem 0.5rem 0.75rem 2rem;
    width: 100%;
    transition: var(--transition);
    background: transparent;
}

.toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.toggle-password:hover {
    color: var(--primary-color);
}

.form-control-custom:focus {
    outline: none;
    border-bottom-color: var(--primary-color);
    box-shadow: none;
}

.form-control-custom::placeholder {
    color: #A0AEC0;
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.forgot-password {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
}

.forgot-password:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.btn-login {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 12px;
    padding: 0.8rem;
    font-weight: 600;
    font-size: 1rem;
    width: 100%;
    margin-top: 2rem;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(0, 2, 60, 0.3);
}

.btn-login:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 2, 60, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

.brand-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    z-index: 1;
}

.brand-text {
    font-size: 1.1rem;
    opacity: 0.9;
    z-index: 1;
    max-width: 250px;
}

/* Dots animation */
.dots {
    display: flex;
    gap: 8px;
    margin-top: 2rem;
    z-index: 1;
}

.dot {
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
}

.dot.active {
    background: var(--white);
    width: 25px;
    border-radius: 10px;
}

.brand-logo {
    max-width: 150px;
    z-index: 1;
}

/* Responsive Adjustments for Login */
@media (max-width: 768px) {
    .auth-body {
        background-color: var(--bg-light);
        padding: 5px;
        align-items: flex-start;
        display: block;
    }

    .login-container {
        flex-direction: column;
        min-height: 100vh;
        width: 100%;
        margin: 0;
        border-radius: 30px;
        overflow: visible;
        background: transparent;
        box-shadow: none;
    }

    .login-brand-side {
        flex: none;
        width: 100%;
        padding: 3rem 1.5rem 6rem; /* Increased bottom padding for overlap */
        background: var(--primary-color) !important; /* Flat purple as per mockup */
        border-radius: 0 0 50px 50px;
        min-height: 400px;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        position: relative;
    }

    .brand-logo {
        max-width: 120px;
        margin-bottom: 1.5rem;
        z-index: 5;
    }

    .login-brand-side::before,
    .login-brand-side::after {
        display: none;
    }

    .back-home {
        position: absolute;
        top: 2rem;
        left: 1.5rem;
        color: rgba(255, 255, 255, 0.9);
        text-decoration: none;
        font-size: 0.95rem;
        font-weight: 500;
        z-index: 10;
    }

    .brand-title {
        color: var(--white) !important;
        font-size: 3rem;
        font-weight: 700;
        margin-top: 1.5rem;
        line-height: 1;
    }

    .brand-text {
        font-size: 1.15rem;
        color: rgba(255, 255, 255, 0.8) !important;
        opacity: 1 !important;
        max-width: 100%;
        margin-top: 0.8rem;
    }

    .login-form-side {
        flex: none;
        width: 90%;
        margin: -80px auto 40px; /* More dramatic overlap */
        background: var(--white);
        border-radius: 50px;
        padding: 3.5rem 2rem;
        box-shadow: 0 20px 40px rgba(0,0,0,0.15);
        display: flex;
        flex-direction: column;
        z-index: 10;
    }

    .login-form-side h2 {
        color: var(--primary-color);
        font-size: 1.8rem;
        font-weight: 700;
        text-align: center;
        margin-bottom: 0.5rem;
    }

    .login-form-side .subtitle {
        text-align: center;
        display: block;
        margin-bottom: 2rem;
    }

    .login-form-side .form-label {
        display: none; /* Hide labels on mobile to match mockup */
    }

    /* Underlined Inputs */
    .form-control-custom {
        border: none;
        border-bottom: 1.5px solid #CBD5E0;
        padding: 0.75rem 0.5rem 0.75rem 2.2rem;
        font-size: 1.05rem;
        border-radius: 0;
        width: 100%;
        background: transparent;
    }

    .form-control-custom:focus {
        border-bottom-color: var(--primary-color);
        outline: none;
    }

    .input-group-custom > i:first-child {
        font-size: 1.25rem;
        color: #A0AEC0;
    }

    .btn-login {
        background: var(--primary-color);
        border-radius: 18px;
        padding: 1rem;
        font-size: 1.15rem;
        color: var(--white);
        border: none;
        width: 100%;
        font-weight: 600;
        box-shadow: 0 8px 20px rgba(123, 97, 255, 0.3);
        margin-top: 1rem;
    }

    .btn-signup {
        border: 2px solid var(--primary-color);
        color: var(--primary-color);
        background: transparent;
        border-radius: 18px;
        padding: 0.7rem 2rem;
        font-weight: 600;
        display: inline-block;
        transition: var(--transition);
        text-decoration: none;
        margin-top: 0.5rem;
    }

    .sign-up-section {
        text-align: center;
        margin-top: 2rem;
    }

    .dots {
        margin-top: 2.5rem;
        justify-content: center;
        display: flex;
        gap: 8px;
    }

    .form-check {
        margin-bottom: 0.5rem;
    }

    .login-form-side .d-flex.justify-content-between {
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.5rem;
    }
}

/* Dashboard Layout & Sidebar Styles */
.dashboard-body {
    overflow-x: hidden;
    background-color: #f8f9fc;
    display: block;
}

#wrapper {
    display: flex;
}

.bg-dark-blue {
    background-color: #00023c;
}

#sidebar-wrapper {
    min-width: 280px;
    max-width: 280px;
    height: 100vh;
    height: 100dvh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: margin-left 0.25s ease-out;
}

@media (min-width: 1200px) and (max-width: 1500px) {
    #cotizacionesTable {
        min-width: 1030px;
        font-size: 0.82rem;
    }

    #cotizacionesTable th,
    #cotizacionesTable td {
        padding: 0.7rem 0.55rem !important;
        white-space: nowrap;
    }

    #cotizacionesTable td:first-child,
    #cotizacionesTable th:first-child {
        padding-left: 0.9rem !important;
    }

    #cotizacionesTable td:last-child,
    #cotizacionesTable th:last-child {
        padding-right: 0.9rem !important;
    }

    #cotizacionesTable .btn {
        margin-right: 0.15rem !important;
        padding: 0.35rem 0.45rem;
    }
}

#sidebar-wrapper .sidebar-heading {
    padding: 1.5rem 1.25rem;
    font-size: 1.5rem;
    flex: 0 0 auto;
}

#sidebar-wrapper .list-group {
    width: 100%;
}

#sidebar-wrapper .sidebar-navigation {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.4) transparent;
}

#sidebar-wrapper .sidebar-navigation::-webkit-scrollbar {
    width: 8px;
}

#sidebar-wrapper .sidebar-navigation::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.4);
    border-radius: 8px;
}

/* Sidebar Link Styles */
#sidebar-wrapper .list-group-item {
    background-color: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
}

#sidebar-wrapper .list-group-item:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.05);
}

#sidebar-wrapper .list-group-item.active {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
    border-left: 4px solid #fff;
}

#page-content-wrapper {
    flex: 1;
    min-width: 0;
    width: 100%;
}

/* Sidebar Toggle Logic */
body.sb-sidenav-toggled #sidebar-wrapper {
    margin-left: -280px;
}

@media (min-width: 768px) {
    #sidebar-wrapper {
        margin-left: 0;
    }

    body.sb-sidenav-toggled #sidebar-wrapper {
        margin-left: -280px;
    }
}

/* Navbar Custom Styles */
.navbar {
    background: #fff;
    border-radius: 0;
}

#menu-toggle {
    cursor: pointer;
    background: transparent;
    border: none;
    color: var(--primary-color);
}

.app-back-link {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid #e0e7f0;
    border-radius: 0.65rem;
    background: #f5f7fb;
    color: #31506c;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.app-back-link:hover {
    border-color: #b9cee2;
    background: #eaf1f8;
    color: #155e9c;
}

.app-back-link:focus-visible {
    outline: 3px solid rgba(21, 94, 156, 0.28);
    outline-offset: 2px;
}

@media (max-width: 575.98px) {
    .app-back-link {
        width: 44px;
        min-width: 44px;
        min-height: 44px;
        padding: 0;
        font-size: 1.1rem;
    }

    .app-back-link span {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
}

.avatar-sm {
    width: 32px;
    height: 32px;
}

.fw-600 {
    font-weight: 600;
}

.fw-700 {
    font-weight: 700;
}

.fw-500 {
    font-weight: 500;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    #sidebar-wrapper {
        margin-left: -280px;
        position: fixed;
        z-index: 1050;
        box-shadow: 10px 0 30px rgba(0,0,0,0.1);
    }

    body.sb-sidenav-toggled #sidebar-wrapper {
        margin-left: 0;
    }
    
    #page-content-wrapper {
        min-width: 100vw;
    }

    /* Overlay for mobile */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1040;
        transition: all 0.3s ease;
    }
    
    body.sb-sidenav-toggled .sidebar-overlay {
        display: block;
    }
}

/* Portátiles: recuperar área útil sin reducir todo el navegador al 80 %. */
@media (min-width: 769px) and (max-width: 1500px) {
    #sidebar-wrapper {
        min-width: 220px;
        max-width: 220px;
    }

    #sidebar-wrapper .list-group {
        padding-block: 0.8rem !important;
    }

    #sidebar-wrapper .sidebar-heading {
        padding: 1rem 0.75rem !important;
    }

    #sidebar-wrapper .list-group-item {
        padding: 0.8rem 0.9rem !important;
    }

    #sidebar-wrapper .list-group-item i {
        margin-right: 0.65rem !important;
    }

    body.sb-sidenav-toggled #sidebar-wrapper {
        margin-left: -220px;
    }

    #page-content-wrapper > .navbar {
        padding: 0.7rem 1rem !important;
    }

    #page-content-wrapper > .container-fluid {
        padding: 1.25rem !important;
    }
}

.pending-quotes-inline-notice {
    position: fixed;
    z-index: 1090;
    right: 1rem;
    top: 5rem;
    max-width: min(27rem, calc(100vw - 2rem));
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: #fff;
    color: #17243d;
    border: 1px solid #cfd7e2;
    border-radius: 0.75rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
}

.pending-quotes-inline-notice a {
    white-space: nowrap;
}

.pending-quotes-inline-notice .btn-close {
    flex: 0 0 auto;
}
