/* Real-Time Announcement Notification Banner Styles */

.announcement-notification-banner {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 350px;
    max-width: 450px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    animation: slideInRight 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.announcement-notification-banner:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

/* Priority-based colors */
.announcement-notification-banner.urgent {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    animation: slideInRight 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55), pulse 2s infinite;
}

.announcement-notification-banner.high {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

/* Banner content layout */
.banner-content {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    gap: 12px;
}

.banner-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

.banner-icon .material-icons {
    font-size: 24px;
    color: white;
}

.banner-text {
    flex: 1;
    min-width: 0;
}

.banner-text strong {
    display: block;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.3;
}

.banner-text p {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
    opacity: 0.95;
    word-break: break-word;
}

.banner-close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    margin: -4px -4px -4px 0;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

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

/* Animations */
@keyframes slideInRight {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 8px 32px rgba(245, 87, 108, 0.6), 0 0 0 8px rgba(245, 87, 108, 0.1);
    }
}

/* Stack multiple notifications */
.announcement-notification-banner:nth-child(n+2) {
    top: calc(20px + (80px * var(--notification-index, 0)));
}

/* Mobile responsive */
@media (max-width: 768px) {
    .announcement-notification-banner {
        left: 10px;
        right: 10px;
        min-width: auto;
        max-width: none;
    }

    .banner-content {
        padding: 12px;
    }

    .banner-text strong {
        font-size: 14px;
    }

    .banner-text p {
        font-size: 13px;
    }

    /* Mobile optimizations - revert to vertical layout */
    .announcement-strip {
        flex-direction: column;
        min-height: auto;
    }

    .strip-type {
        width: 100%;
        height: 3px;
    }

    .announcement-strip:hover .strip-type {
        height: 4px;
    }

    .strip-content {
        width: 100%;
        padding: 8px 10px 6px 10px;
        gap: 4px;
    }

    .strip-actions {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 5px 10px;
        gap: 6px;
        border-left: none;
        border-top: 1px solid #f0f0f0;
    }

    .action-buttons {
        margin-left: auto;
        margin-top: 0;
    }

    .compact-btn {
        min-width: 26px !important;
        padding: 2px 4px !important;
        height: 24px !important;
    }

    .compact-btn .mdc-button__icon {
        font-size: 14px;
    }
}

/* Announcement Cards (Main Page) - Compact Strip Layout */
.announcement-strip {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    background: white;
    border-radius: 6px;
    margin-bottom: 0; /* Grid handles spacing */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    overflow: hidden;
    position: relative;
    min-height: 55px;
    max-height: 95px;
}

.announcement-strip:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    border-color: rgba(247, 8, 128, 0.3);
}

.strip-type {
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    transition: width 0.2s ease;
}

.announcement-strip:hover .strip-type {
    width: 4px;
}

.strip-content {
    width: 60%;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 5px 8px 5px 12px;
    min-width: 0;
    justify-content: center;
}

.strip-title {
    display: flex;
    align-items: center;
    gap: 4px;
}

.priority-indicator {
    font-size: 11px;
    line-height: 1;
    flex-shrink: 0;
}

.title-text {
    font-size: 12px;
    font-weight: 600;
    color: #2c3e50;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.strip-message {
    font-size: 10px;
    color: #6c757d;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.strip-actions {
    width: 40%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    padding: 4px 8px;
    border-left: 1px solid #f0f0f0;
    background: rgba(247, 8, 128, 0.02);
    flex-shrink: 0;
    font-size: 9px;
    justify-content: flex-start;
    overflow: visible;
}

.strip-actions > * {
    width: 100%;
}

.strip-actions .top-row {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: space-between;
    width: 100%;
}

.strip-actions .bottom-row {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: space-between;
    width: 100%;
}

.meta-type {
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 8px;
    font-weight: 500;
    text-transform: capitalize;
    display: inline-block;
    line-height: 1.2;
    flex-shrink: 0;
}

.meta-role {
    display: flex;
    align-items: center;
    gap: 2px;
    text-transform: capitalize;
    font-size: 9px;
    line-height: 1.2;
}

.meta-role .material-icons {
    font-size: 11px;
}

.meta-date {
    color: #8898aa;
    font-size: 8px;
    line-height: 1.2;
    flex: 1;
    text-align: right;
}

.strip-reads {
    display: flex;
    align-items: center;
    gap: 2px;
    color: #8898aa;
    font-size: 9px;
    white-space: nowrap;
    padding: 0;
    line-height: 1.2;
    flex-shrink: 0;
}

.strip-reads .material-icons {
    font-size: 11px;
}

.compact-btn {
    min-width: 24px !important;
    padding: 1px 4px !important;
    height: 22px !important;
    flex-shrink: 0;
}

.compact-btn .mdc-button__icon {
    font-size: 14px;
    margin: 0;
}

.strip-actions .top-row .delete-btn {
    color: #f5365c;
    border-color: #f5365c;
    flex-shrink: 0;
    margin-left: auto;
}

.strip-actions .top-row .delete-btn:hover {
    background: rgba(245, 54, 92, 0.1);
}

/* Legacy card styles for backwards compatibility */
.announcement-card:not(.announcement-strip) {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.announcement-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.announcement-type {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
}

.priority-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: white;
}

.announcement-meta {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #6c757d;
}

.announcement-role {
    display: flex;
    align-items: center;
    gap: 4px;
}

.announcement-role .material-icons {
    font-size: 16px;
}

.announcement-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 8px 0;
}

.announcement-message {
    color: #495057;
    line-height: 1.6;
    margin: 0 0 16px 0;
}

.announcement-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 16px 0;
}

.announcement-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid #e9ecef;
    flex-wrap: wrap;
}

.announcement-reads {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #6c757d;
    font-size: 14px;
    flex-shrink: 0;
}

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

.announcement-footer .mdc-button {
    margin-left: auto;
}

.announcement-footer .delete-btn {
    margin-left: 0;
}

/* Announcement History alignment */
.announcements-list-container {
    width: 100%;
    max-width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: minmax(55px, 95px);
    gap: 8px;
    margin-bottom: 0;
}

/* Single column on tablets */
@media (max-width: 1200px) {
    .announcements-list-container {
        grid-template-columns: 1fr;
    }
}

/* Single column on mobile */
@media (max-width: 768px) {
    .announcements-list-container {
        grid-template-columns: 1fr;
    }
}

/* Override header flex for history page */
#announcement-history .announcement-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

#announcement-history .announcement-meta {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #6c757d;
    flex-shrink: 0;
}

#announcement-history .filters-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

#announcement-history .compact-select {
    min-width: 150px;
    padding: 10px 14px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 14px;
    color: #32325d;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#announcement-history .compact-select:hover {
    border-color: var(--primary-color, #f70880);
}

#announcement-history .compact-select:focus {
    outline: none;
    border-color: var(--primary-color, #f70880);
    box-shadow: 0 0 0 3px rgba(247, 8, 128, 0.1);
}

/* Announcement card in history - Strip style */
#announcement-history .announcement-strip {
    min-height: 64px;
}

#announcement-history .strip-content {
    padding: 14px 18px;
}

#announcement-history .title-text {
    font-size: 14px;
    font-weight: 600;
    color: #32325d;
}

#announcement-history .strip-message {
    color: #525f7f;
    line-height: 1.6;
    margin: 0 0 16px 0;
    font-size: 14px;
}

#announcement-history .announcement-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
    flex-wrap: wrap;
}

#announcement-history .announcement-footer .mdc-button {
    margin-left: auto;
}

#announcement-history .announcement-footer .delete-btn {
    margin-left: 8px;
    color: #f5365c;
    border-color: #f5365c;
}

#announcement-history .announcement-footer .delete-btn:hover {
    background: rgba(245, 54, 92, 0.1);
}

/* Type badges */
#announcement-history .announcement-type {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Material card body padding for announcements */
#announcement-history .material-card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* Ensure grid takes available space */
#announcement-history .announcements-list-container {
    flex: 1;
    align-content: start;
}

/* Pagination styling - at bottom */
#announcementsPagination {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 2px solid #f0f0f0;
}

#announcementsPagination .pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 8px 0;
}

#announcementsPagination .page-info {
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
}

#announcementsPagination .mdc-button {
    min-width: 100px;
}

/* Empty state */
.empty-state {
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state .material-icons {
    font-size: 72px;
    color: #dee2e6;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 600;
    color: #495057;
    margin: 0 0 8px 0;
}

.empty-state p {
    font-size: 14px;
    margin: 0 0 20px 0;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .announcement-notification-banner {
        animation: none;
    }
    
    .announcement-notification-banner.urgent {
        animation: none;
    }
}

/* Print styles */
@media print {
    .announcement-notification-banner {
        display: none;
    }
}

/* Real-Time Broadcast presence card */
.rt-broadcast-card {
    margin-bottom: 16px;
    background: linear-gradient(135deg, rgba(247, 8, 128, 0.05), rgba(254, 173, 139, 0.05));
    border: 1px solid rgba(247, 8, 128, 0.15);
    overflow: hidden;
    transition: box-shadow 0.35s ease, border-color 0.35s ease, background 0.35s ease;
}

.rt-broadcast-card.rt-flash-join {
    border-color: rgba(45, 206, 137, 0.55);
    box-shadow: 0 0 0 3px rgba(45, 206, 137, 0.18), 0 8px 24px rgba(45, 206, 137, 0.12);
    background: linear-gradient(135deg, rgba(45, 206, 137, 0.08), rgba(247, 8, 128, 0.04));
}

.rt-broadcast-card.rt-flash-leave {
    border-color: rgba(251, 99, 64, 0.5);
    box-shadow: 0 0 0 3px rgba(251, 99, 64, 0.16), 0 8px 24px rgba(251, 99, 64, 0.1);
    background: linear-gradient(135deg, rgba(251, 99, 64, 0.08), rgba(247, 8, 128, 0.04));
}

.rt-broadcast-body {
    padding: 16px 20px !important;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rt-broadcast-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.rt-broadcast-identity {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rt-broadcast-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color, #f70880), var(--accent-color, #ff8552));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.rt-broadcast-icon .material-icons {
    color: white;
    font-size: 20px;
}

.rt-broadcast-icon.rt-icon-pulse {
    animation: rtIconPulse 0.7s ease;
}

.rt-broadcast-icon.rt-icon-pulse::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(247, 8, 128, 0.45);
    animation: rtRipple 0.7s ease-out;
}

.rt-broadcast-title {
    font-weight: 600;
    color: #32325d;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rt-broadcast-subtitle {
    font-size: 12px;
    color: #8898aa;
}

.rt-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(45, 206, 137, 0.12);
    color: #1aae6f;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.rt-live-badge.is-offline {
    background: rgba(136, 152, 170, 0.16);
    color: #8898aa;
}

.rt-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2dce89;
    box-shadow: 0 0 0 0 rgba(45, 206, 137, 0.55);
    animation: rtLivePulse 1.6s ease-out infinite;
}

.rt-live-badge.is-offline .rt-live-dot {
    background: #8898aa;
    animation: none;
    box-shadow: none;
}

.rt-broadcast-counts {
    display: flex;
    gap: 20px;
}

.rt-count-block {
    text-align: center;
    min-width: 64px;
    padding: 4px 8px;
    border-radius: 10px;
    transition: background 0.3s ease;
}

.rt-count-block.rt-role-hot {
    background: rgba(94, 114, 228, 0.1);
}

.rt-count-block[data-count-role="trainer"].rt-role-hot {
    background: rgba(45, 206, 137, 0.12);
}

.rt-count-block[data-count-role="total"].rt-role-hot {
    background: rgba(247, 8, 128, 0.1);
}

.rt-count-value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.15;
    display: inline-block;
}

.rt-count-students { color: #5e72e4; }
.rt-count-trainers { color: #2dce89; }
.rt-count-total { color: var(--primary-color, #f70880); }

.rt-count-value.rt-count-up {
    animation: rtCountUp 0.55s cubic-bezier(0.22, 1.4, 0.36, 1);
}

.rt-count-value.rt-count-down {
    animation: rtCountDown 0.55s ease;
}

.rt-count-label {
    font-size: 11px;
    color: #8898aa;
    text-transform: uppercase;
}

.rt-presence-feed {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 132px;
    overflow: hidden;
}

.rt-presence-feed--full {
    max-height: 280px;
    overflow-y: auto;
}

.rt-event-role-tag {
    display: inline-block;
    margin: 0 4px;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(94, 114, 228, 0.12);
    color: #5e72e4;
    font-size: 10px;
    font-weight: 700;
    text-transform: capitalize;
}

.rt-active-users-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.rt-active-users-table-wrap {
    overflow-x: auto;
}

.rt-active-users-table {
    width: 100%;
    border-collapse: collapse;
}

.rt-active-users-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #8898aa;
    padding: 8px 12px;
    border-bottom: 1px solid #eef2f7;
}

.rt-active-users-table td {
    padding: 12px;
    border-bottom: 1px solid #f4f5f7;
    font-size: 13px;
    color: #32325d;
    vertical-align: middle;
}

.rt-active-users-table tbody tr:last-child td {
    border-bottom: none;
}

.rt-active-users-table tbody tr {
    animation: rtEventIn 0.35s ease;
}

.rt-username-cell {
    font-weight: 600;
}

.rt-connected-cell {
    color: #525f7f;
    white-space: nowrap;
}

.rt-status-online {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #1aae6f;
    font-size: 12px;
    font-weight: 600;
}

.rt-role-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: capitalize;
    background: rgba(136, 152, 170, 0.14);
    color: #525f7f;
}

.rt-role-chip--student {
    background: rgba(94, 114, 228, 0.12);
    color: #5e72e4;
}

.rt-role-chip--trainer {
    background: rgba(45, 206, 137, 0.14);
    color: #1aae6f;
}

.rt-role-chip--admin {
    background: rgba(247, 8, 128, 0.12);
    color: #f70880;
}

.rt-active-users-empty-row td {
    text-align: center;
    color: #8898aa;
    font-style: italic;
    padding: 28px 12px;
}

.rt-presence-empty {
    font-size: 12px;
    color: #8898aa;
    font-style: italic;
}

.rt-presence-event {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    color: #32325d;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(50, 50, 93, 0.06);
    animation: rtEventIn 0.4s ease;
}

.rt-presence-event.is-join {
    border-color: rgba(45, 206, 137, 0.22);
}

.rt-presence-event.is-leave {
    border-color: rgba(251, 99, 64, 0.22);
}

.rt-presence-event .material-icons {
    font-size: 16px;
}

.rt-presence-event.is-join .material-icons { color: #2dce89; }
.rt-presence-event.is-leave .material-icons { color: #fb6340; }

.rt-presence-event .rt-event-role {
    font-weight: 600;
    text-transform: capitalize;
}

.rt-presence-event .rt-event-time {
    margin-left: auto;
    color: #8898aa;
    font-size: 11px;
    white-space: nowrap;
}

@keyframes rtLivePulse {
    0% { box-shadow: 0 0 0 0 rgba(45, 206, 137, 0.5); }
    70% { box-shadow: 0 0 0 8px rgba(45, 206, 137, 0); }
    100% { box-shadow: 0 0 0 0 rgba(45, 206, 137, 0); }
}

@keyframes rtIconPulse {
    0% { transform: scale(1); }
    40% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

@keyframes rtRipple {
    from { transform: scale(0.85); opacity: 0.7; }
    to { transform: scale(1.35); opacity: 0; }
}

@keyframes rtCountUp {
    0% { transform: scale(1); }
    35% { transform: scale(1.28); }
    100% { transform: scale(1); }
}

@keyframes rtCountDown {
    0% { transform: translateY(0); opacity: 1; }
    35% { transform: translateY(4px) scale(0.92); opacity: 0.65; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes rtEventIn {
    from { transform: translateY(-8px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 768px) {
    .rt-broadcast-counts {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rt-live-dot,
    .rt-broadcast-icon.rt-icon-pulse,
    .rt-count-value.rt-count-up,
    .rt-count-value.rt-count-down,
    .rt-presence-event {
        animation: none;
    }
}
