/* === STYLE MODALU === */
.sub-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999 !important; /* Force this modal above the sticky nav tabs */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.sub-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 43, 69, 0.6); /* --color-primary z przezroczystością */
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    cursor: pointer;
}

.sub-modal-content {
    position: relative;
    background: #FFFFFF; /* --color-bg-alt */
    border-radius: 0.75rem; /* --border-radius */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 2rem;
    width: 100%;
    max-width: 650px; 
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1001;
    animation: modal-fade-in 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@keyframes modal-fade-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}


.sub-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: 0;
    font-size: 2rem;
    color: #6C757D; /* --color-text-muted */
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
.sub-modal-close:hover {
    color: #212529; /* --color-text */
}

.sub-modal-content h3 {
    margin: 0;
    color: #0D2B45; /* --color-primary */
    font-size: 1.75rem;
    font-weight: 700;
}

.sub-modal-teacher {
    font-size: 1rem;
    color: #6C757D; /* --color-text-muted */
    margin-top: 0.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #E9ECEF; /* --color-border */
    padding-bottom: 1rem;
}

/* === NOWY PASEK Z DZIENNYMI KOSZTAMI (NAD KAFELKAMI) === */
.sub-modal-info-bar {
    background: #e9f0f7; /* Jasny niebieski/szary */
    border: 1px solid #D1D5DB;
    border-radius: 0.5rem;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    color: #0D2B45;
    font-size: 0.95rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
}

.cost-item {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.cost-item span {
    font-weight: 600;
    color: #1D4E89;
    font-size: 0.85rem;
}

.cost-item strong {
    font-weight: 800;
    font-size: 1.1rem;
}
/* === KONIEC NOWEGO PASKA === */


/* === STYLE KAFELKÓW GRUP === */
.sub-modal-tiles-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 550px) {
    .sub-modal-tiles-container {
        grid-template-columns: 1fr 1fr;
    }
}

.group-tile {
    display: flex;
    flex-direction: column;
    width: 100%;
    background: #FDFDFD; /* --color-bg */
    border: 2px solid #E9ECEF; /* --color-border */
    border-radius: 0.75rem; /* --border-radius */
    padding: 1.25rem;
    transition: all 0.2s ease-out;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.group-tile:hover {
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

/* Stan ZAZNACZONY */
.group-tile.selected-static {
    border-color: #F79F1B; /* --color-accent */
    background: #fff8eb;
}
.group-tile.selected-digital {
    border-color: #1D4E89; /* --color-primary-light */
    background: #e9f0f7;
}
.group-tile.selected-none {
    opacity: 0.6;
}

.tile-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.tile-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0D2B45; /* --color-primary */
    line-height: 1.4;
    margin: 0 0 0.25rem 0;
}

.tile-short-name {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    color: #1D4E89; /* --color-primary-light */
    background-color: rgba(29, 78, 137, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 99px;
    white-space: nowrap;
}

.tile-students {
    font-size: 0.9rem;
    color: #6C757D; /* --color-text-muted */
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed #E9ECEF;
}

/* Kontener Opcji Planu */
.tile-plan-options {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tile-plan-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid #D1D5DB;
    background: #FFFFFF;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.tile-plan-btn:hover {
    border-color: #1D4E89;
    box-shadow: 0 0 0 2px rgba(29, 78, 137, 0.2);
}

.tile-plan-btn span {
    font-weight: 700;
}

/* Style dla wybranych planów */
.selected-static .btn-static {
    background-color: #F79F1B;
    color: #0D2B45; 
    border-color: #F79F1B;
    font-weight: 700;
}
.selected-static .btn-static:hover {
    background-color: #e59118;
}

.selected-digital .btn-digital {
    background-color: #1D4E89; 
    color: #FFFFFF;
    border-color: #1D4E89;
    font-weight: 700;
}
.selected-digital .btn-digital:hover {
    background-color: #1a457a;
}

.selected-none .btn-none {
    background-color: #E9ECEF; /* Szary dla 'Brak subskrypcji' */
    color: #0D2B45; 
    border-color: #E9ECEF;
    font-weight: 700;
}
.selected-none .btn-none:hover {
    background-color: #d8dbe0;
}


/* === STOPKA MODALA (KOSZT I PRZYCISK) === */
.sub-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1.5rem;
    margin-top: 1rem;
    border-top: 2px solid #E9ECEF;
}

.sub-modal-total span {
    font-size: 0.75rem;
    color: #6C757D;
    margin-right: 0.5rem;
}

.sub-modal-total strong {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0D2B45;
}

.sub-modal-footer .btn-submit {
    padding: 0.75rem 2rem;
    font-size: 1rem;
}

@media (max-width: 550px) {
    .sub-modal-content {
        padding: 1.5rem;
    }
    .sub-modal-info-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    .sub-modal-footer {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    .sub-modal-total {
        text-align: center;
    }
    .sub-modal-total strong {
        display: block;
        margin-top: 0.25rem;
    }
    .sub-modal-footer .btn-submit {
        width: 100%;
        padding: 0.75rem;
    }
}


/* === STYLE MODALU POTWIERDZENIA === */
.sub-modal-confirm {
    max-width: 450px;
    text-align: center;
}

.sub-modal-confirm h3 {
    text-align: center;
    width: 100%;
}

.sub-modal-confirm p {
    font-size: 1.1rem;
    color: #212529; /* --color-text */
    margin-top: 1rem;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.sub-modal-confirm-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.sub-modal-confirm-actions .btn {
    flex-grow: 1;
    font-size: 1rem;
    padding: 0.75rem 1rem;
}