/* ============================================
   ESTILOS CUSTOM - sapns App
   Solo estilos que no cubre Bootstrap 5
   ============================================ */

/* Variables CSS para theme — enlazadas a Bootstrap 5 cuando esté disponible */
:root {
    /* colores principales: usan las variables de Bootstrap si existen */
    --sp-primary: var(--bs-primary, #0d6efd);
    --sp-primary-rgb: 13,110,253; /* usado para fondos rgba */
    --sp-secondary: var(--bs-secondary, #6c757d);
    --sp-link-color: var(--bs-link-color, var(--sp-primary));

    /* layout */
    --sp-sidebar-width: 240px;
    --sp-header-height: 56px;

    /* tipografía: Bootstrap define sus propias variables en muchos proyectos; usamos fallback */
    --sp-font-family: var(--bs-font-sans-serif, "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial);
    --sp-body-bg: var(--bs-body-bg, #ffffff);
    --sp-body-color: var(--bs-body-color, #212529);
}

/* ========== LAYOUT CUSTOM ========== */

/* Sidebar - estilos ahora en sidebar.html */

/* Menubar */
#menubar {
    min-height: 50px;
}

#menubar .nav-link {
    color: #495057;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

#menubar .nav-link:hover {
    background-color: #f8f9fa;
    color: var(--sp-primary);
}

#menubar .navbar-nav {
    flex-wrap: wrap;
}

#menubar .dropdown-menu {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border-radius: 0.5rem;
}

/* Main content */
main {
    min-height: calc(100vh - var(--sp-header-height));
}

/* ========== UTILIDADES CUSTOM ========== */

/* Responsive */
@media (max-width: 767.98px) {
    /* Sidebar responsive ahora en sidebar.html */
}

/* ========== LEGACY - Compatibilidad ========== */

/* Body y textos base */
html {
    background: var(--sp-body-bg);
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: var(--sp-font-family);
    color: var(--sp-body-color);
}

body {
    margin: 0 auto;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: var(--sp-font-family);
    color: var(--sp-body-color);
    background-color: var(--sp-body-bg);
}

a {
    color: var(--sp-link-color);
    text-decoration: none;
}

h2 {
    color: var(--sp-secondary);
    font-size: 1.8em;
    overflow: hidden;
    width: 100%;
    margin-top: 10px;
    margin-bottom: 2px;
}

h4, .h4 {
    font-size: 1.2em;
}

/* Wrappers legacy */
.wrapper {
    margin: 0 auto;
    padding: 0;
    min-height: 91%;
}

.wrapper_full_screen {
    margin: 0 auto;
    padding: 0;
    min-height: 91%;
}

/* Header legacy */
.sp_header {
    position: relative;
    margin: 0 auto;
    z-index: 200;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.sp_header ul.dropdown-menu {
    position: absolute;
    opacity: 1;
}

.sp_header_top {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 30px;
    background-color: var(--sp-primary);
    color: var(--bs-white, #fff);
    z-index: 1000;
}

/* Footer */
.sp-footer-separator {
    clear: both;
    height: 10px;
    display: block;
    width: 100%;
}

.sp-footer {
    position: relative;
    height: 85px;
    padding: 0 1rem;
    border-top: 1px solid #ccc;
    background: #eee;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.sp-footer-menu {
    margin-left: auto;
    padding-top: 10px;
}

.sp-footer-content {
    height: 60px;
    padding: 10px;
    width: 100%;
    margin: 0 auto;
}

/* Shortcuts sidebar */
.text_sb {
    font-size: 13px;
    padding-top: 3px;
    margin-left: 5px;
    display: block;
    width: 130px;
    margin-bottom: 3px;
}

.text_sb,
.subaction {
    padding: 3px;
    cursor: pointer;
    width: 150px;
    transition-duration: 0.3s;
}

.text_sb:hover,
.subaction:hover {
    background-color: #1e3a4d;
    border-radius: 3px;
}

.text_sb a {
    font-weight: bold;
    color: #333;
}

.text_sb a:hover {
    color: black;
}

.subactions {
    clear: left;
    min-height: 22px;
    background-color: #f1f4dc;
    padding: 2px;
    border-radius: 2px;
}

.subactions .item {
    margin-left: 15px;
}

.subactions ul {
    margin-top: 0;
    margin-bottom: 0;
    list-style-type: none;
}

/* User menu legacy */
#sp-user-menu {
    width: 330px;
    display: none;
    margin-top: 5px;
    padding-bottom: 5px;
}

.sp-user-option {
    padding: 2px 2px 2px 10px;
    color: #000;
    border-radius: 3px;
    cursor: pointer;
    margin-left: 1px;
    width: 99%;
    transition: background-color 0.3s;
}

.sp-user-option:hover {
    background-color: var(--bs-warning, #ffc107);
    color: #fff;
}

.sp-user-option img {
    width: 20px;
    height: 20px;
    margin-right: 5px;
}

/* Logout legacy */
.sp-logout-user {
    padding-left: 10px;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-style: italic;
    font-size: 13px;
    width: auto;
    height: 18px;
    opacity: 1;
    border-radius: 10px;
    font-weight: normal;
    transition: background-color 0.5s;
}

.sp-logout-user:hover {
    background-color: rgba(var(--sp-primary-rgb), 0.06);
    font-weight: bold;
}

.sp-logout-user * {
    float: none;
    height: 16px;
}

.sp-logout-user img {
    width: 16px;
    margin-top: 1px;
    margin-right: 5px;
}

.sp-logout-user .user-name {
    margin-top: 2px;
    color: #444;
}

/* Field rows */
.sp-field-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    height: auto;
    margin-bottom: 5px;
    gap: .5rem;
}

.sp-field-row .sp-field {
    display: inline-block;
    margin-right: 5px;
}

.sp-field .label.required {
    font-weight: bold;
}

/* Select custom */
.ui-multiselect {
    border: 1px solid #6C7A89;
    border-radius: 0px;
    background: #fff;
    color: #333;
    font-size: 14px;
    padding: 6px 3px !important;
    height: 26px;
}

/* Selector */
.selector {
    width: 100%;
}

.sp-select-text.loading {
    background: #eee url('/images/sapns/loading.gif') no-repeat right center;
    background-size: contain;
}

.sp-select-button {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    margin-top: 0;
    font-size: 16px;
    margin-left: -30px;
    color: var(--bs-white, #fff);
    border: none;
    background: none;
    padding: 0;
    min-width: 15px;
    background-color: var(--sp-primary);
    padding-top: 6px;
    height: 28px;
    margin-top: 1px;
    padding: 5px 0 0 2px;
    position: relative;
    right: 0;
    z-index: 1000;
}

/* Course/curso styles */
.curso {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    color: #495057;
    text-decoration: none;
    border-radius: 0.375rem;
    transition: all 0.15s ease;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
}

.curso:hover {
    background-color: var(--sp-primary);
    color: var(--bs-white, #fff);
}

.curso i {
    color: #fff;
}

.curso * {
    float: none;
}

.curso img {
    width: 20px;
    height: 20px;
}

.curso .nombre {
    margin-left: 3px;
    font-size: 14px;
    padding: 2px;
    width: 100%;
}

.curso .nombre i {
    padding-top: 2px;
    margin-right: 5px;
}

.curso_seleccionado {
    background-color: rgba(var(--sp-primary-rgb), 0.15) !important;
    border-left: 3px solid var(--sp-primary);
    color: var(--sp-primary) !important;
}

/* Inline actions */
.inline_color_delete {
    color: rgb(202, 59, 59);
}

.inline_actions .inline_color_delete {
    color: transparent;
}

.inline_actions {
    display: inline-flex;
    align-items: center;
    margin-left: 28px;
    color: transparent;
}

.sp-grid-row:hover .inline_actions .inline_color_delete {
    color: rgb(202, 59, 59);
}

.sp-grid-row:hover .inline_actions,
.sp-grid-row:hover .inline_actions a {
    color: inherit;
}

.sp-grid-row a.inline_action {
    cursor: pointer;
    font-size: 1px;
    color: transparent;
}

.inline_action {
    cursor: pointer;
    font-size: 16px;
}

.inline_action:hover,
.sp-grid-row a.inline_action:hover {
    color: #565823;
}

.inline_action i {
    margin: 0 5px;
}

/* Export styles */
.export-separator {
    clear: both;
}

.export-label {
    border-radius: .25rem;
    padding: .25rem .5rem;
    margin-bottom: .25rem;
    height: 20px;
    width: 155px;
    font: 13px arial;
    text-align: center;
    cursor: default;
    display: inline-block;
    margin-right: .5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.export-label.selected {
    background-color: #ecefcc;
    font-weight: bold;
}

.export-label.selected:hover {
    color: #1e3a4d;
}

.export-label.unselected {
    background-color: #d5d5d5;
    color: #777;
}

/* Delete dialog */
#sp-delete-dialog .question {
    font-size: 20px;
    padding: 10px;
}

#sp-delete-dialog .title {
    overflow: auto;
    height: 120px;
    padding: 5px;
    background-color: #eee;
    border-radius: 5px;
}

#sp-delete-dialog .error-message div.error-title {
    color: #e00000;
    font-size: 18px;
    font-weight: bold;
    padding: 10px;
}

#sp-delete-dialog .error-message .related-classes {
    height: 105px;
    overflow: auto;
    padding: 5px;
    background-color: #eee;
    margin-top: 10px;
}

#sp-delete-dialog .error-message .related-classes .rc {
    display: inline-block;
    color: #fff;
    background-color: #444;
    border-radius: .3125rem;
    margin-right: .3125rem;
    margin-bottom: .3125rem;
    padding: .125rem .3125rem;
    min-width: 90px;
    text-align: center;
    cursor: default;
    font-size: 13px;
}

/* Labels */
.label {
    /* Compatibilidad con badges de Bootstrap */
    display: inline-block;
    padding: 0.25em 0.4em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    color: var(--bs-white, #fff);
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
    background-color: var(--sp-secondary);
}

/* Spacing utilities custom */
.top40 { margin-top: 40px; }
.top30 { margin-top: 30px; }
.top20 { margin-top: 20px; }
.top10 { margin-top: 10px; }
.top5 { margin-top: 5px; }

.negrita { font-weight: bold; }
.bbottom_dotted { border-bottom: 1px dotted #ccc; }
.padding_5 { padding: 5px; }

.align-middle {
    vertical-align: middle !important;
    padding-top: 20px;
    display: block;
    width: 100%;
}

/* jQuery UI overrides */
.ui-dialog {
    box-shadow: 0 .5rem 1rem rgba(0,0,0,.15);
    overflow-y: auto !important;
}

.ui-widget {
    font-size: 14px;
    font-family: inherit;
}

.ui-datepicker select.ui-datepicker-month,
.ui-datepicker select.ui-datepicker-year {
    color: #666;
}

/* Language selector */
#sp-language-selector {
    font-size: 9px;
}

#sp-language-selector-out {
    display: block;
    text-align: right;
    margin: 5px 5px 0 0;
}

/* App title */
.sp_app_title {
    position: absolute;
    left: 0;
    top: 5px;
    font-size: 15px;
    text-align: left;
    margin-left: 10px;
    color: var(--bs-warning, #FFB835);
}

.sp_app_title_sep {
    color: #000;
    font-weight: bold;
}

.sp_app_subtitle {
    font-size: 12px;
    text-align: left;
    color: #723532;
}

/* Checkbox */
.sp-checkbox-big {
    height: 25px;
    width: 25px;
}

/* Messages */
.sp_messages {
    font-size: 10px;
    color: navy;
}

/* Sidebar messages */
.sidebar-messages {
    position: fixed;
    right: 10px;
    top: 20px;
    width: 200px;
    padding: 5px;
    z-index: 100000;
}

.sidebar-messages .sbm-message {
    position: relative;
    padding: 8px;
    border-radius: 10px;
    box-shadow: 2px 2px #999;
    min-height: 50px;
    opacity: 0.7;
    margin-bottom: 5px;
}

.sbm-message-std {
    background-color: #ffb328;
    font: bold 13px arial;
}

/* No shortcuts */
.sp-no-shortcuts {
    font: 20px arial;
    color: #999;
    text-align: left;
}

.sp-no-shortcuts span.subtitle {
    font: 15px arial;
}

.sp-no-shortcuts span.here {
    font-weight: bold;
    cursor: pointer;
}

/* Error */
.sp-field-error {
    color: red;
}

/* Input focus */
input[type=text]:focus,
input[type=password]:focus,
textarea:focus {
    border-color: #797C33;
}

/* Bloque */
.bloque {
    border: 2px solid var(--sp-primary);
    background-color: rgba(var(--sp-primary-rgb), 0.04) !important;
    color: var(--sp-secondary);
    border-radius: .25rem;
}

/* Center */
.sp_center {
    /* Mobile-first: centro responsivo */
    position: static;
    width: 100%;
    height: auto;
    left: auto;
    top: auto;
    border: none;
    border-radius: 0;
    padding: 1rem;
    box-sizing: border-box;
}

.sp_center.no-sidebar {
    border-radius: 0;
}

@media (min-width: 576px) {
    /* Tablet */
    .sp_center {
        max-width: 720px;
        margin: 0 auto;
    }
}

@media (min-width: 768px) {
    /* Portátil */
    .sp_center {
        position: absolute;
        width: 997px;
        height: 600px;
        left: 200px;
        top: 0;
        border: 1px solid #eee;
        border-radius: 0 0 10px 0;
    }
    .sp_center.no-sidebar {
        border-radius: 0 0 10px 10px;
    }
}

@media (min-width: 1200px) {
    /* Monitor grande */
    .sp_center {
        left: 240px;
        width: 1100px;
    }
}

/* Login form legacy */
#wrong-login {
    width: 410px;
    margin: 25px auto;
    height: 32px;
    background-color: #fee1ad;
    border-radius: 3px;
    padding: 6px 5px 5px 5px;
    font: 14px arial;
    color: #444;
    text-align: center;
}

#wrong-login span {
    font-weight: bold;
}

#forgot_password {
    text-align: center;
}

#forgot_password label {
    font-weight: normal;
    font-size: 11px;
    color: #223f85;
    cursor: pointer;
}

#forgot_password label:hover {
    color: #1e3a4d;
}

/* Item sortable */
.item_sb {
    min-height: 22px;
    width: 100px;
    margin: 0 auto;
}

.item_sb_dragging {
    border: 1px solid #1e3a4d;
    border-radius: 3px;
    height: 25px;
}

.item_sb a {
    font-weight: normal;
}

.item_sb_sortable img {
    width: 18px;
    height: 18px;
}

.icon_sb {
    width: 25px;
    height: 25px;
    cursor: pointer;
    display: inline-block;
    vertical-align: middle;
}

.return_sb {
    margin-left: 5px;
}

.item_sb .subaction {
    font-weight: normal;
    color: #999;
    font: 11px arial;
    height: 18px;
}

.item_sb .subaction:hover {
    color: black;
}
