/**
 * Ecube Education — pastel palette, gradients, buttons, motion
 */
:root {
    --ecube-primary: #a18ee2;
    --ecube-primary-dark: #8a6fd4;
    --ecube-primary-light: #f3effc;
    --ecube-secondary: #4EC5BC;
    --ecube-secondary-light: #DFF5F3;
    --ecube-accent: #F5D054;
    --ecube-accent-light: #FFF6DC;
    --ecube-violet: #B8A9E0;
    --ecube-violet-light: #EDE8F7;
    --ecube-rose: #F08A9B;
    --ecube-rose-light: #FCE8EC;
    --ecube-sky: #DFF0FF;
    --ecube-sky-light: #E8F4FF;
    --ecube-page-bg: #F8F8F8;
    --ecube-card-bg: #ffffff;
    --ecube-gradient-hero: linear-gradient(180deg, #F8F8F8 0%, #FAF9F6 100%);
    --ecube-gradient-primary: linear-gradient(135deg, #a18ee2 0%, #ff003c 100%);
    --ecube-gradient-secondary: linear-gradient(135deg, #4EC5BC 0%, #8EDDD6 100%);
    --ecube-shadow-soft: 0 4px 24px rgba(161, 142, 226, 0.18);
    --ecube-shadow-card: 0 2px 16px rgba(61, 53, 85, 0.06);
}

[data-theme="light"] {
    --primary-600: var(--ecube-primary);
    --primary-50: var(--ecube-primary-light);
    --main-600: var(--ecube-primary);
    --blue-600: var(--ecube-secondary);
    --blue-50: var(--ecube-secondary-light);
}

body {
    background-color: var(--ecube-page-bg) !important;
}

.dashboard-main,
.dashboard-main-body {
    background-color: var(--ecube-page-bg) !important;
}

.bg-base {
    background-color: var(--ecube-page-bg) !important;
}

.dashboard-main-body {
    animation: ecubePageIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes ecubePageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cards — pure white on off-white page */
.card {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    box-shadow: var(--ecube-shadow-card);
}

.card.shadow-1 {
    box-shadow: var(--ecube-shadow-soft) !important;
}

.gradient-bg-end-1 { background: linear-gradient(135deg, #fff8eb 0%, #fff3e0 100%) !important; }
.gradient-bg-end-2 { background: linear-gradient(135deg, #eef4ff 0%, #e3edff 100%) !important; }
.gradient-bg-end-3 { background: linear-gradient(135deg, #f3efff 0%, #ebe4ff 100%) !important; }
.gradient-bg-end-4 { background: linear-gradient(135deg, #e8f7f4 0%, #dff5f1 100%) !important; }

/* Buttons — consistent hover */
.btn-primary-600,
.btn.btn-primary-600 {
    background: var(--ecube-gradient-primary) !important;
    border-color: var(--ecube-primary) !important;
    color: #fff !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-primary-600:hover,
.btn.btn-primary-600:hover {
    background: linear-gradient(135deg, #8a6fd4 0%, #e60036 100%) !important;
    border-color: #ff003c !important;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(47, 158, 143, 0.35);
}

.btn-outline-primary-600 {
    border-color: var(--ecube-primary) !important;
    color: var(--ecube-primary) !important;
    background: var(--ecube-primary-light) !important;
    transition: all 0.2s ease;
}

.btn-outline-primary-600:hover {
    background: var(--ecube-gradient-primary) !important;
    border-color: var(--ecube-primary) !important;
    color: #fff !important;
}

.btn-danger-600 {
    background: linear-gradient(135deg, #e53935 0%, #ef5350 100%) !important;
    border-color: #e53935 !important;
    color: #fff !important;
}

.btn-danger-600:hover {
    background: linear-gradient(135deg, #c62828 0%, #e53935 100%) !important;
    color: #fff !important;
    box-shadow: 0 6px 18px rgba(229, 57, 53, 0.35);
}

.btn-danger-200 {
    background: var(--ecube-rose-light) !important;
    color: #c2185b !important;
    border: 1px solid #f8bbd0 !important;
}

.btn-danger-200:hover {
    background: #f8bbd0 !important;
    color: #ad1457 !important;
}

.border.border-neutral-400.bg-hover-neutral-200,
a.border.border-neutral-400 {
    background: #fff !important;
    border-color: #d1d5db !important;
    color: #4b5563 !important;
    transition: all 0.2s ease;
}

.border.border-neutral-400:hover,
a.border.border-neutral-400:hover {
    background: var(--ecube-primary-light) !important;
    border-color: var(--ecube-primary) !important;
    color: var(--ecube-primary-dark) !important;
}

/* ——— Sidebar ——— */
.ecube-sidebar {
    background: #ffffff !important;
    border-right: 1px solid rgba(0, 0, 0, 0.06) !important;
    box-shadow: 2px 0 24px rgba(15, 23, 42, 0.04);
}

.ecube-sidebar .sidebar-logo {
    border-bottom: 1px solid rgba(47, 158, 143, 0.08);
    padding-bottom: 12px;
}

.ecube-sidebar .profile-dropdown__button {
    background: linear-gradient(135deg, #ffffff 0%, var(--ecube-primary-light) 100%) !important;
    border: 1px solid rgba(47, 158, 143, 0.12) !important;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.ecube-sidebar .profile-dropdown__button:hover {
    border-color: rgba(47, 158, 143, 0.28) !important;
    box-shadow: var(--ecube-shadow-soft);
}

.ecube-sidebar-avatar {
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(47, 158, 143, 0.15);
}

.ecube-sidebar .sidebar-menu li a {
    border-radius: 10px;
    margin: 2px 8px;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.ecube-sidebar .sidebar-menu li a:hover {
    background: var(--ecube-primary-light) !important;
    color: var(--ecube-primary-dark) !important;
}

.ecube-sidebar .sidebar-menu > li:nth-child(1) > a > i { color: #a18ee2; }
.ecube-sidebar .sidebar-menu > li:nth-child(2) > a > i { color: #4EC5BC; }
.ecube-sidebar .sidebar-menu > li:nth-child(3) > a > i { color: #B8A9E0; }
.ecube-sidebar .sidebar-menu > li:nth-child(4) > a > i { color: #F5D054; }
.ecube-sidebar .sidebar-menu > li:nth-child(5) > a > i { color: #F08A9B; }

/* Open dropdown parent — pastel only (not full active blue from base theme) */
.ecube-sidebar .sidebar-menu li.dropdown.open > a,
.ecube-sidebar .sidebar-menu li.dropdown.dropdown-open > a {
    background: var(--ecube-primary-light) !important;
    color: var(--ecube-primary-dark) !important;
    box-shadow: none !important;
}

.ecube-sidebar .sidebar-menu li.dropdown.open > a:hover,
.ecube-sidebar .sidebar-menu li.dropdown.dropdown-open > a:hover {
    color: var(--ecube-primary-dark) !important;
}

.ecube-sidebar .sidebar-menu li.dropdown.open > a i,
.ecube-sidebar .sidebar-menu li.dropdown.dropdown-open > a i {
    color: var(--ecube-primary) !important;
}

/* Active link — unified teal (parent items & submenu) */
.ecube-sidebar .sidebar-menu li > a.active-page,
.ecube-sidebar .sidebar-menu li a.active-page,
.ecube-sidebar .sidebar-menu .sidebar-submenu li.active-page a,
.ecube-sidebar .sidebar-menu .sidebar-submenu li a.active-page {
    background: var(--ecube-gradient-primary) !important;
    color: #fff !important;
    box-shadow: 0 4px 14px rgba(47, 158, 143, 0.28);
}

.ecube-sidebar .sidebar-menu li > a.active-page:hover,
.ecube-sidebar .sidebar-menu li a.active-page:hover,
.ecube-sidebar .sidebar-menu .sidebar-submenu li a.active-page:hover {
    color: #fff !important;
}

.ecube-sidebar .sidebar-menu li a.active-page i,
.ecube-sidebar .sidebar-menu .sidebar-submenu li a.active-page i,
.ecube-sidebar .sidebar-menu .sidebar-submenu li.active-page a i {
    color: #fff !important;
}

.ecube-sidebar .sidebar-submenu li a {
    border-radius: 8px;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem !important;
    margin: 2px 0;
}

.ecube-sidebar .sidebar-submenu li a:hover {
    background: var(--ecube-primary-light) !important;
    color: var(--ecube-primary-dark) !important;
}

/* Remove white halo on submenu bullet icons (base theme box-shadow) */
.ecube-sidebar .sidebar-submenu .circle-icon {
    box-shadow: none !important;
    background: transparent !important;
    color: #94a3b8 !important;
}

.ecube-sidebar .sidebar-submenu li a.active-page .circle-icon,
.ecube-sidebar .sidebar-menu .sidebar-submenu li.active-page a .circle-icon {
    color: rgba(255, 255, 255, 0.9) !important;
    background: transparent !important;
    box-shadow: none !important;
}

.ecube-sidebar .sidebar-submenu::before {
    border-color: rgba(47, 158, 143, 0.25);
}

/* Sortable syllabus rows */
.ecube-sortable-tbody tr {
    background: #fff;
}

.ecube-sortable-tbody.is-sorting tr {
    transition: none;
}

.ecube-sortable-tbody .ui-sortable-helper {
    display: table;
    background: var(--ecube-primary-light) !important;
    box-shadow: var(--ecube-shadow-soft);
}

.ecube-sortable-tbody .ui-sortable-placeholder {
    visibility: visible !important;
    background: var(--ecube-primary-light) !important;
    border: 2px dashed rgba(47, 158, 143, 0.35);
}

.ecube-sort-handle {
    cursor: grab;
    border: none;
}

.ecube-sort-handle:active {
    cursor: grabbing;
}

.ecube-sortable-tbody.is-saving {
    opacity: 0.65;
    pointer-events: none;
}

/* Back button */
.ecube-back-btn {
    min-width: 40px;
    min-height: 40px;
    padding: 8px 12px !important;
}

.ecube-back-btn:hover {
    transform: translateX(-2px);
}

/* Table avatars — small pastel */
.ecube-table-avatar {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.ecube-navbar-avatar {
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(47, 158, 143, 0.2);
}

.ecube-navbar-avatar-btn:focus-visible {
    outline: 2px solid var(--ecube-primary);
    outline-offset: 2px;
}

/* ——— Toasts ——— */
.ecube-toast-container {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: min(420px, calc(100vw - 2rem));
    pointer-events: none;
}

.ecube-toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.12);
    pointer-events: auto;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
    position: relative;
    overflow: hidden;
}

.ecube-toast.is-visible {
    transform: translateX(0);
    opacity: 1;
}

.ecube-toast.is-hiding {
    transform: translateX(120%);
    opacity: 0;
}

.ecube-toast__icon {
    flex-shrink: 0;
    font-size: 1.35rem;
    line-height: 1;
    margin-top: 1px;
}

.ecube-toast--success .ecube-toast__icon { color: #2e7d32; }
.ecube-toast--error .ecube-toast__icon { color: #c62828; }
.ecube-toast--warning .ecube-toast__icon { color: #ef6c00; }

.ecube-toast--success {
    background: linear-gradient(135deg, #ffffff 0%, #e8f5e9 100%);
    border-color: rgba(46, 125, 50, 0.2);
}

.ecube-toast--error {
    background: linear-gradient(135deg, #ffffff 0%, var(--ecube-rose-light) 100%);
    border-color: rgba(198, 40, 40, 0.15);
}

.ecube-toast__message {
    flex: 1;
    font-size: 0.9rem;
    color: #1e293b;
    line-height: 1.45;
    padding-right: 0.5rem;
}

.ecube-toast__close {
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    transition: color 0.15s ease;
}

.ecube-toast__close:hover {
    color: #475569;
}

.ecube-toast__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    transform-origin: left;
    animation: ecubeToastProgress linear forwards;
}

.ecube-toast--success .ecube-toast__progress {
    background: linear-gradient(90deg, #2e7d32, #66bb6a);
}

.ecube-toast--error .ecube-toast__progress {
    background: linear-gradient(90deg, #c62828, #ef5350);
}

@keyframes ecubeToastProgress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

/* Table toolbar */
.ecube-table-toolbar {
    background: linear-gradient(180deg, #fafcfd 0%, #fff 100%);
}

.text-id-link {
    color: var(--ecube-secondary) !important;
    font-weight: 600;
}

/* Hide duplicate DataTables empty row when we show our own */
.ecube-teacher-table-wrap[data-has-rows="0"] .dataTables_empty,
.ecube-teacher-table-wrap[data-has-rows="0"] tbody tr td.dataTables_empty {
    display: none !important;
}

.ecube-teacher-table-wrap .dataTables_empty:only-child {
    padding: 2rem;
}

/* Button loading state */
.ecube-btn.is-loading {
    position: relative;
    pointer-events: none;
    color: transparent !important;
}

.ecube-btn.is-loading .ecube-btn__label,
.ecube-btn.is-loading > i,
.ecube-btn.is-loading > img,
.ecube-btn.is-loading iconify-icon {
    visibility: hidden;
}

.ecube-btn.is-loading::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 1.125rem;
    height: 1.125rem;
    margin: -0.5625rem 0 0 -0.5625rem;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ecubeSpin 0.65s linear infinite;
}

.ecube-btn.btn-outline-primary-600.is-loading::after,
.ecube-btn.border-neutral-400.is-loading::after {
    border-color: rgba(47, 158, 143, 0.25);
    border-top-color: var(--ecube-primary);
}

/* Page navigation loader bar */
.ecube-page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 99999;
    background: transparent;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ecube-page-loader.is-active {
    opacity: 1;
}

.ecube-page-loader::before {
    content: '';
    display: block;
    height: 100%;
    width: 30%;
    background: var(--ecube-gradient-primary);
    animation: ecubeLoaderBar 1s ease-in-out infinite;
}

@keyframes ecubeLoaderBar {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

@keyframes ecubeSpin {
    to { transform: rotate(360deg); }
}

/* Colorful icons — no grayscale */
.icons8-icon {
    filter: none !important;
}

.bordered-tab .nav-link.active {
    color: var(--ecube-primary) !important;
    border-bottom-color: var(--ecube-primary) !important;
}

/* Status badges — pastel */
.bg-success-100 { background: #e8f5e9 !important; }
.bg-danger-100 { background: var(--ecube-rose-light) !important; }
.bg-primary-100 { background: var(--ecube-secondary-light) !important; }
.bg-warning-100 { background: var(--ecube-accent-light) !important; }

.ecube-detail-hero .card {
    background: var(--ecube-gradient-hero);
}

/* Mobile app logo */
.ecube-brand-link {
    text-decoration: none;
    min-height: 44px;
}

.ecube-brand-logo {
    max-height: 44px;
    width: auto;
    object-fit: contain;
}

.ecube-brand-logo-icon {
    max-height: 36px;
    width: auto;
}

.sidebar.active .ecube-brand-logo:not(.logo-icon),
.sidebar.sidebar-open .ecube-brand-logo:not(.logo-icon) {
    max-height: 40px;
}

.ecube-login-logo {
    max-height: 72px;
    width: auto;
    object-fit: contain;
}

/* Inline action badges (replaces 3-dot menus) */
.ecube-action-badges {
    max-width: 100%;
}

.ecube-action-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.ecube-action-badge i {
    font-size: 14px;
    line-height: 1;
}

.ecube-action-badge--default,
.ecube-action-badge--view {
    background: var(--ecube-primary-light);
    color: var(--ecube-primary-dark);
}

.ecube-action-badge--default:hover,
.ecube-action-badge--view:hover {
    background: var(--ecube-gradient-primary);
    color: #fff;
}

.ecube-action-badge--edit {
    background: var(--ecube-violet-light);
    color: #6b4fc9;
}

.ecube-action-badge--edit:hover {
    background: var(--ecube-violet);
    color: #fff;
}

.ecube-action-badge--danger {
    background: var(--ecube-rose-light);
    color: #c62828;
}

.ecube-action-badge--danger:hover {
    background: #ff003c;
    color: #fff;
}

.ecube-styled-table td .ecube-action-badges,
.ecube-styled-table-wrap td .ecube-action-badges,
.data-table td .ecube-action-badges {
    min-width: max-content;
}
