/* GT-Scolarix - Portail parents/eleves - styles custom. */

:root {
    --portal-sidebar-width: 260px;
    --portal-header-height: 60px;
}

/* ========================================
   Layout
   ======================================== */

.portal-wrapper {
    min-height: 100vh;
    position: relative;
}

.portal-main {
    margin-left: var(--portal-sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

[dir="rtl"] .portal-main {
    margin-left: 0;
    margin-right: var(--portal-sidebar-width);
}

.portal-content {
    flex-grow: 1;
}

/* ========================================
   Sidebar
   ======================================== */

.portal-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--portal-sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #1e3a5f 0%, #152238 100%);
    color: #fff;
    z-index: 1030;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

[dir="rtl"] .portal-sidebar {
    left: auto;
    right: 0;
}

.portal-sidebar-header {
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.portal-sidebar-brand {
    display: flex;
    align-items: center;
    color: #fff;
    text-decoration: none;
    min-width: 0;
}

.portal-sidebar-brand i {
    font-size: 1.75rem;
    flex-shrink: 0;
}

.portal-sidebar-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
}

.portal-sidebar-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-left: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

[dir="rtl"] .portal-sidebar-title {
    margin-left: 0;
    margin-right: 0.75rem;
}

.portal-sidebar-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    flex-shrink: 0;
}

.portal-sidebar-user {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.portal-user-avatar {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.portal-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.portal-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.portal-user-name {
    font-weight: 500;
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-user-role {
    font-size: 0.75rem;
    opacity: 0.7;
}

.portal-sidebar-nav {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem 0;
}

.portal-sidebar-nav .nav-item {
    margin-bottom: 0.125rem;
}

.portal-sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 0.7rem 1rem;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    transition: all 0.2s ease;
    border-radius: 0;
}

.portal-sidebar-nav .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.portal-sidebar-nav .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    border-left: 3px solid #fff;
}

[dir="rtl"] .portal-sidebar-nav .nav-link.active {
    border-left: none;
    border-right: 3px solid #fff;
}

.portal-sidebar-nav .nav-link i {
    font-size: 1.125rem;
    width: 1.5rem;
    margin-right: 0.75rem;
}

[dir="rtl"] .portal-sidebar-nav .nav-link i {
    margin-right: 0;
    margin-left: 0.75rem;
}

.portal-sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.portal-footer-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.5rem;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 0.875rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.portal-footer-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.portal-footer-link.text-danger {
    color: #ff8a8a !important;
}

.portal-footer-link.text-danger:hover {
    color: #fff !important;
    background: rgba(220, 53, 69, 0.3);
}

.portal-footer-link i {
    font-size: 1rem;
    width: 1.5rem;
    margin-right: 0.5rem;
}

[dir="rtl"] .portal-footer-link i {
    margin-right: 0;
    margin-left: 0.5rem;
}

.portal-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1029;
    display: none;
}

/* ========================================
   Top header
   ======================================== */

.portal-header {
    height: var(--portal-header-height);
    background: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.portal-header-title {
    font-weight: 600;
    margin-left: 0.25rem;
}

.portal-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    color: #495057;
    text-decoration: none;
    font-size: 1.25rem;
    padding: 0.25rem;
}

.portal-header-icon .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    font-size: 0.6rem;
}

/* ========================================
   Footer
   ======================================== */

.portal-footer {
    background: #fff;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding: 1.5rem 0;
    margin-top: auto;
}

/* ========================================
   Design tokens (repris de style.css / --gt-*,
   redeclares ici car style.css n'est pas charge
   sur le portail)
   ======================================== */

:root {
    --gt-shadow-sm: 0 0.125rem 0.375rem rgba(15, 23, 42, 0.06);
    --gt-shadow: 0 0.5rem 1.5rem rgba(15, 23, 42, 0.1);
    --gt-border-radius-lg: 0.75rem;
}

/* ========================================
   Cartes du contenu portail
   ======================================== */

.portal-content .card {
    border-color: var(--bs-border-color-translucent, var(--bs-border-color));
    border-radius: var(--gt-border-radius-lg);
    box-shadow: var(--gt-shadow-sm);
}

.portal-card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.portal-card-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--gt-shadow);
}

/* ========================================
   Cartes statistiques (KPI)
   ======================================== */

.portal-stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 100%;
    padding: 1.25rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color-translucent, var(--bs-border-color));
    border-radius: var(--gt-border-radius-lg);
    box-shadow: var(--gt-shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.portal-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--gt-shadow);
}

.portal-stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    min-width: 52px;
    border-radius: 50%;
    font-size: 1.375rem;
    color: #fff;
}

.portal-stat-icon.icon-primary { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.portal-stat-icon.icon-success { background: linear-gradient(135deg, #22c55e, #15803d); }
.portal-stat-icon.icon-danger  { background: linear-gradient(135deg, #f87171, #dc2626); }
.portal-stat-icon.icon-warning { background: linear-gradient(135deg, #fbbf24, #d97706); }
.portal-stat-icon.icon-info    { background: linear-gradient(135deg, #22d3ee, #0891b2); }
.portal-stat-icon.icon-dark    { background: linear-gradient(135deg, #1e3a5f, #152238); }

.portal-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.15;
    margin: 0;
}

.portal-stat-label {
    font-size: 0.8125rem;
    color: var(--bs-secondary-color);
}

/* ========================================
   Selecteur d'enfant
   ======================================== */

.portal-child-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem 0.6rem 0.6rem;
    border-radius: var(--gt-border-radius-lg);
    border: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.portal-child-card:hover {
    color: inherit;
    transform: translateY(-1px);
    box-shadow: var(--gt-shadow-sm);
}

.portal-child-card.active {
    border-color: transparent;
    background: linear-gradient(135deg, #1e3a5f, #152238);
    color: #fff;
    box-shadow: var(--gt-shadow-sm);
}

.portal-child-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: rgba(30, 58, 95, 0.1);
    color: #1e3a5f;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.portal-child-card.active .portal-child-avatar {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.portal-child-name {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.2;
}

.portal-child-sub {
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
}

.portal-child-card.active .portal-child-sub {
    color: rgba(255, 255, 255, 0.75);
}

/* ========================================
   Barres de progression paiement
   ======================================== */

.portal-progress {
    height: 8px;
    border-radius: 50rem;
    overflow: hidden;
}

.portal-progress .progress-bar {
    border-radius: 50rem;
    background: linear-gradient(90deg, #22c55e, #16a34a);
}

/* ========================================
   Mobile responsive
   ======================================== */

@media (max-width: 991.98px) {
    .portal-main {
        margin-left: 0;
    }

    [dir="rtl"] .portal-main {
        margin-right: 0;
    }

    .portal-sidebar {
        transform: translateX(-100%);
    }

    [dir="rtl"] .portal-sidebar {
        transform: translateX(100%);
    }

    .portal-sidebar.show {
        transform: translateX(0);
    }

    .portal-sidebar-overlay.show {
        display: block;
    }
}
