/**
 * CW Rooms - Dedicated Styles
 * Styles specific to CW Rooms feature
 */

/* ============================================================================
   MODAL SYSTEM
   ============================================================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: #1f2937;
    border: 1px solid #374151;
    border-radius: 0.5rem;
    padding: 2rem;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

.modal-close {
    cursor: pointer;
    transition: color 0.2s;
}

/* ============================================================================
   ROOM CARDS
   ============================================================================ */
.room-card {
    background-color: #1f2937;
    border: 2px solid #374151;
    border-radius: 0.5rem;
    padding: 1.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.room-card:hover {
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.2);
}

.room-card.full {
    opacity: 0.6;
    cursor: not-allowed;
}

.room-card.full:hover {
    transform: none;
    border-color: #374151;
}

.room-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.room-badge.beginner {
    background-color: #065f46;
    color: #a7f3d0;
}

.room-badge.intermediate {
    background-color: #1e40af;
    color: #93c5fd;
}

.room-badge.advanced {
    background-color: #7c2d12;
    color: #fca5a5;
}

.room-badge.public {
    background-color: #1e3a8a;
    color: #93c5fd;
}

.room-badge.private {
    background-color: #581c87;
    color: #d8b4fe;
}

/* Delete button in room cards */
.delete-room-btn {
    background-color: #7f1d1d;
    color: #fca5a5;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s;
    border: 1px solid #991b1b;
}

.delete-room-btn:hover {
    background-color: #991b1b;
    color: #fff;
    border-color: #b91c1c;
}

/* ============================================================================
   FILTER BUTTONS
   ============================================================================ */
.filter-btn {
    background-color: #374151;
    color: #9ca3af;
    padding: 0.5rem 1.5rem;
    border-radius: 0.375rem;
    font-weight: 600;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.filter-btn:hover {
    background-color: #4b5563;
    color: #fff;
}

.filter-btn.active {
    background-color: #3b82f6;
    color: #fff;
    border-color: #60a5fa;
}

/* Orange styling for My Rooms button */
.filter-btn[data-filter="my"] {
    background-color: #c2410c;
    color: #fed7aa;
    border-color: #9a3412;
}

.filter-btn[data-filter="my"].active {
    background-color: #ea580c;
    color: #fff;
    border-color: #f97316;
}

.filter-btn[data-filter="my"]:hover:not(.active) {
    background-color: #ea580c;
    color: #fff;
}

/* ============================================================================
   PARTICIPANTS LIST
   ============================================================================ */
.participant-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    background-color: #374151;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.participant-item.active {
    background-color: #1e40af;
    border: 1px solid #3b82f6;
}

.participant-item .status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #10b981;
}

.participant-item.transmitting .status-indicator {
    background-color: #ef4444;
    animation: pulse 1s infinite;
}

/* ============================================================================
   CW FEED
   ============================================================================ */
.cw-feed-entry {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #374151;
}

.cw-feed-entry:last-child {
    border-bottom: none;
}

.cw-feed-entry .sender {
    font-size: 0.75rem;
    color: #60a5fa;
    margin-bottom: 0.25rem;
}

.cw-feed-entry .content {
    color: #d1d5db;
    font-size: 1.125rem;
    letter-spacing: 0.05em;
}

.cw-feed-entry .cw-feed-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.5rem;
}

.cw-feed-entry .timestamp {
    font-size: 0.75rem;
    color: #6b7280;
}

.cw-feed-entry .replay-btn {
    background-color: transparent;
    border: 1px solid #4b5563;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cw-feed-entry .replay-btn:hover:not(:disabled) {
    background-color: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
    transform: scale(1.05);
}

.cw-feed-entry .replay-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.cw-feed-entry .replay-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cw-feed-entry .replay-btn.playing {
    background-color: #ef4444;
    border-color: #ef4444;
    color: #fff;
    animation: pulse 1s infinite;
}

.cw-feed-entry .replay-btn svg {
    width: 16px;
    height: 16px;
}

/* ============================================================================
   PTT BUTTON STATES
   ============================================================================ */
#ptt-button {
    transition: all 0.2s;
    position: relative;
}

#ptt-button:active:not(:disabled) {
    transform: scale(0.95);
}

#ptt-button.active {
    background-color: #dc2626;
    animation: pulse-red 1s infinite;
}

@keyframes pulse-red {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(220, 38, 38, 0);
    }
}

/* ============================================================================
   KEYLINE BANNER
   ============================================================================ */
#keyline-banner.held {
    border-color: #dc2626;
    background-color: #7f1d1d;
}

#keyline-banner.busy {
    border-color: #f59e0b;
    background-color: #78350f;
}

/* ============================================================================
   CHAT MESSAGES
   ============================================================================ */
.chat-message {
    padding: 0.5rem;
    border-radius: 0.375rem;
    background-color: #1f2937;
    font-size: 0.875rem;
}

.chat-message .sender {
    color: #60a5fa;
    font-weight: 600;
}

.chat-message .text {
    color: #d1d5db;
    margin-top: 0.25rem;
}

.chat-message .timestamp {
    color: #6b7280;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* ============================================================================
   HARDWARE STATUS
   ============================================================================ */
#hardware-status.connected {
    color: #10b981;
    font-weight: 600;
}

#hardware-status.error {
    color: #ef4444;
}

/* ============================================================================
   TOAST NOTIFICATIONS
   ============================================================================ */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #1f2937;
    border: 2px solid #3b82f6;
    border-radius: 0.5rem;
    padding: 1.5rem 2rem;
    min-width: 300px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.toast.hidden {
    display: none;
}

.toast.success {
    border-color: #10b981;
}

.toast.error {
    border-color: #ef4444;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -40%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* ============================================================================
   TOGGLE CHECKBOX (Custom Styling)
   ============================================================================ */
.toggle-checkbox {
    appearance: none;
    width: 2.5rem;
    height: 1.25rem;
    background-color: #4b5563;
    border-radius: 9999px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s;
}

.toggle-checkbox:checked {
    background-color: #3b82f6;
}

.toggle-checkbox::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1rem;
    height: 1rem;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-checkbox:checked::after {
    transform: translateX(1.25rem);
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */
@media (max-width: 768px) {
    .modal-content {
        padding: 1rem;
        max-width: 95%;
    }

    .room-card {
        padding: 1rem;
    }

    #ptt-button {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */
.text-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scrollbar-thin {
    scrollbar-width: thin;
    scrollbar-color: #4b5563 #1f2937;
}

.scrollbar-thin::-webkit-scrollbar {
    width: 8px;
}

.scrollbar-thin::-webkit-scrollbar-track {
    background: #1f2937;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
    background-color: #4b5563;
    border-radius: 4px;
}