/* ============================================
   Flagga elev (Särskilt stöd) - Feature Styles
   ============================================ */

/* Page header */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--gray-darker);
}

.page-header__subtitle {
    margin: 4px 0 0;
    font-size: 0.875rem;
    color: var(--gray-dark);
}

/* Context bar */
.context-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--white);
    border: 1px solid var(--gray-lighter);
    border-radius: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.context-bar__label {
    font-size: 0.8125rem;
    color: var(--gray-dark);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.context-bar select {
    padding: 6px 32px 6px 12px;
    border: 1px solid var(--gray-light);
    border-radius: 4px;
    font-size: 0.875rem;
    font-family: 'Roboto', sans-serif;
    background: var(--white);
    color: var(--gray-darker);
    cursor: pointer;
    appearance: auto;
}

.context-bar select:focus {
    outline: 2px solid var(--cl-hard);
    outline-offset: 1px;
}

/* Filter bar */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 16px;
    border: 1px solid var(--gray-light);
    background: var(--white);
    cursor: pointer;
    font-size: 0.8125rem;
    font-family: 'Roboto', sans-serif;
    color: var(--gray-darker);
    transition: all 0.2s;
}

.filter-chip:hover {
    background: var(--gray-lightest);
}

.filter-chip--active {
    background: var(--cl-super-soft);
    border-color: var(--cl-soft);
    color: var(--cl-hard);
}

.filter-chip .material-icons {
    font-size: 16px;
}

/* Student list table */
.student-list {
    background: var(--white);
    border-radius: 8px;
    border: 1px solid var(--gray-lighter);
    overflow: hidden;
}

.student-list__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-lighter);
    background: var(--gray-lightest);
}

.student-list__header-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-dark);
}

.student-list__count {
    font-size: 0.8125rem;
    color: var(--gray-dark);
}

.student-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-lighter);
    transition: background-color 0.15s;
    gap: 12px;
}

.student-row:last-child {
    border-bottom: none;
}

.student-row:hover {
    background-color: var(--gray-lightest);
}

.student-row__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--cl-super-soft);
    color: var(--cl-hard);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 500;
    flex-shrink: 0;
}

.student-row__info {
    flex: 1;
    min-width: 0;
}

.student-row__name {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--gray-darker);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.student-row__details {
    font-size: 0.8125rem;
    color: var(--gray-dark);
}

/* Flagging indicator */
.flag-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    flex-shrink: 0;
}

.flag-indicator--active {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
}

.flag-indicator--none {
    color: transparent;
}

.flag-indicator .material-icons {
    font-size: 14px;
}

/* Action buttons */
.student-row__actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 4px;
    border: 1px solid transparent;
    font-size: 0.8125rem;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.btn .material-icons {
    font-size: 18px;
}

.btn--primary {
    background: var(--cl-hard);
    color: var(--white);
    border-color: var(--cl-hard);
}

.btn--primary:hover {
    background: var(--cl-medium);
    border-color: var(--cl-medium);
}

.btn--secondary {
    background: var(--white);
    color: var(--cl-hard);
    border-color: var(--gray-light);
}

.btn--secondary:hover {
    background: var(--cl-super-soft);
    border-color: var(--cl-soft);
}

.btn--text {
    background: transparent;
    color: var(--cl-hard);
    padding: 6px 8px;
}

.btn--text:hover {
    background: var(--cl-super-soft);
}

.btn--danger {
    background: var(--white);
    color: #d32f2f;
    border-color: #d32f2f;
}

.btn--danger:hover {
    background: #ffebee;
}

.btn--small {
    padding: 4px 10px;
    font-size: 0.75rem;
}

.btn--disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Dialog / Modal */
.dialog-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.dialog-overlay--open {
    display: flex;
}

.dialog {
    background: var(--white);
    border-radius: 12px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
}

.dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--gray-lighter);
}

.dialog__title {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--gray-darker);
    margin: 0;
}

.dialog__close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    color: var(--gray-dark);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dialog__close:hover {
    background: var(--gray-lightest);
}

.dialog__body {
    padding: 20px 24px;
}

.dialog__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--gray-lighter);
}

/* Context info in dialog */
.context-info {
    background: var(--gray-lightest);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 20px;
}

.context-info__row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 0.875rem;
}

.context-info__row:last-child {
    margin-bottom: 0;
}

.context-info__label {
    color: var(--gray-dark);
    font-weight: 500;
    min-width: 110px;
    flex-shrink: 0;
}

.context-info__value {
    color: var(--gray-darker);
}

/* Form fields */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-darker);
}

.form-label--required::after {
    content: ' *';
    color: #d32f2f;
}

.form-hint {
    display: block;
    margin-bottom: 8px;
    font-size: 0.8125rem;
    color: var(--gray-dark);
    line-height: 1.4;
    font-style: italic;
}

.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-light);
    border-radius: 4px;
    font-size: 0.875rem;
    font-family: 'Roboto', sans-serif;
    color: var(--gray-darker);
    background: var(--white);
    transition: border-color 0.2s;
}

.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--cl-hard);
    box-shadow: 0 0 0 2px var(--cl-super-soft);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.5;
}

.form-char-count {
    text-align: right;
    font-size: 0.75rem;
    color: var(--gray-dark);
    margin-top: 4px;
}

.form-char-count--over {
    color: #d32f2f;
}

.form-error {
    display: none;
    font-size: 0.8125rem;
    color: #d32f2f;
    margin-top: 4px;
}

.form-error--visible {
    display: block;
}

/* Success / notification toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: #fff;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 0.875rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-width: 90vw;
}

.toast--visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast--success {
    background: #2e7d32;
}

.toast--error {
    background: #c62828;
}

.toast--info {
    background: var(--cl-hard);
}

.toast .material-icons {
    font-size: 20px;
}

/* Info banner (prerequisites not met) */
.info-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.875rem;
    line-height: 1.5;
}

.info-banner--warning {
    background: #fff8e1;
    border: 1px solid #ffecb3;
    color: #f57f17;
}

.info-banner--error {
    background: #ffebee;
    border: 1px solid #ffcdd2;
    color: #c62828;
}

.info-banner--info {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    color: #1565c0;
}

.info-banner .material-icons {
    font-size: 22px;
    flex-shrink: 0;
    margin-top: 1px;
}

.info-banner__content {
    flex: 1;
}

.info-banner__title {
    font-weight: 500;
    margin-bottom: 4px;
}

/* EHT view specific */
.flagging-card {
    background: var(--white);
    border: 1px solid var(--gray-lighter);
    border-radius: 8px;
    margin-bottom: 12px;
    transition: box-shadow 0.2s;
    overflow: hidden;
}

.flagging-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.flagging-card__header {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    gap: 12px;
    cursor: pointer;
}

.flagging-card__status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.flagging-card__student-name {
    font-weight: 500;
    color: var(--gray-darker);
    flex: 1;
    min-width: 0;
}

.flagging-card__meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.8125rem;
    color: var(--gray-dark);
    flex-shrink: 0;
}

.flagging-card__date {
    white-space: nowrap;
}

.flagging-card__badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.flagging-card__expand {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    color: var(--gray-dark);
    display: flex;
    transition: transform 0.2s;
}

.flagging-card__expand--open {
    transform: rotate(180deg);
}

.flagging-card__body {
    display: none;
    padding: 0 16px 16px;
    border-top: 1px solid var(--gray-lighter);
}

.flagging-card__body--open {
    display: block;
    padding-top: 16px;
}

.flagging-detail {
    margin-bottom: 12px;
}

.flagging-detail__label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.flagging-detail__value {
    font-size: 0.875rem;
    color: var(--gray-darker);
    line-height: 1.5;
}

.flagging-card__actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-lighter);
    margin-top: 12px;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 24px;
    margin-top: 12px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--gray-lighter);
}

.timeline__item {
    position: relative;
    padding-bottom: 12px;
    font-size: 0.8125rem;
}

.timeline__item:last-child {
    padding-bottom: 0;
}

.timeline__item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cl-hard);
    border: 2px solid var(--white);
}

.timeline__date {
    color: var(--gray-dark);
    font-size: 0.75rem;
}

.timeline__text {
    color: var(--gray-darker);
}

/* Duplicate warning dialog content */
.duplicate-info {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: #fff8e1;
    border-radius: 8px;
    border: 1px solid #ffecb3;
    margin-bottom: 16px;
}

.duplicate-info .material-icons {
    color: #f57f17;
    font-size: 22px;
    flex-shrink: 0;
}

.duplicate-info__text {
    font-size: 0.875rem;
    color: var(--gray-darker);
    line-height: 1.5;
}

/* Stats summary */
.stats-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--gray-lighter);
    border-radius: 8px;
    padding: 14px 18px;
    min-width: 120px;
    flex: 1;
}

.stat-card__value {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--gray-darker);
}

.stat-card__label {
    font-size: 0.8125rem;
    color: var(--gray-dark);
    margin-top: 2px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-dark);
}

.empty-state .material-icons {
    font-size: 48px;
    color: var(--gray-light);
    margin-bottom: 12px;
}

.empty-state__title {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--gray-darker);
}

.empty-state__text {
    font-size: 0.875rem;
    line-height: 1.5;
}

/* View flagging (own) */
.own-flagging {
    background: var(--gray-lightest);
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
}

.own-flagging__header {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray-dark);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.own-flagging__text {
    font-size: 0.875rem;
    color: var(--gray-darker);
    line-height: 1.5;
    margin-bottom: 8px;
}

.own-flagging__meta {
    font-size: 0.8125rem;
    color: var(--gray-dark);
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 959px) {
    .student-row {
        flex-wrap: wrap;
    }
    .student-row__actions {
        width: 100%;
        padding-top: 8px;
    }
    .stats-bar {
        flex-direction: column;
    }
    .flagging-card__meta {
        flex-wrap: wrap;
        gap: 8px;
    }
}

@media (max-width: 599px) {
    .context-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .dialog {
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
        height: 100vh;
    }
    .dialog-overlay {
        padding: 0;
    }
    .page-header {
        flex-direction: column;
    }
    .filter-bar {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }
}
