/* ============================================
   ANNOUNCEMENT PANEL STYLES
   ============================================ */

/* Tab Toggle Button - Bottom Left */
.announcement-tab {
    position: fixed;
    bottom: 20px;
    left: 0;
    background: var(--secondary-blue, #4A90E2);
    color: white;
    border: none;
    border-radius: 0 8px 8px 0;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    z-index: 999;
    transition: all 0.3s ease;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}

.announcement-tab.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-100%);
}

.announcement-tab:hover {
    background: var(--primary-lime, #C8E6C9);
    color: #333;
    transform: translateX(3px);
}

.announcement-tab.has-new {
    animation: pulse 2s infinite;
}

.announcement-tab .notification-dot {
    width: 10px;
    height: 10px;
    background: #ff4444;
    border-radius: 50%;
    animation: blink 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(5px); }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Panel Container */
.announcement-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: 450px;
    max-height: 600px;
    background: white;
    border-radius: 0 12px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    z-index: 998;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.announcement-panel.open {
    transform: translateY(0);
}

/* Panel Header */
.announcement-panel-header {
    background: var(--secondary-blue, #4A90E2);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 0 12px 0 0;
}

.announcement-panel-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.close-panel {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

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

/* Panel Content */
.announcement-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Individual Announcement Card */
.announcement-card {
    background: #f9f9f9;
    border-left: 4px solid var(--secondary-blue, #4A90E2);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    animation: slideIn 0.3s ease;
}

.announcement-card.pinned {
    border-left-color: var(--primary-lime, #C8E6C9);
    background: #f0f8f0;
}

.announcement-card.pinned::before {
    content: "📌 Pinned";
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-green, #4CAF50);
    margin-bottom: 8px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.announcement-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.announcement-message {
    font-size: 14px;
    line-height: 1.6;
    color: #555;
    margin-bottom: 12px;
}

/* Poll Section */
.poll-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #ddd;
}

.poll-question {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.poll-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.poll-option {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
}

.poll-option:hover:not(:disabled) {
    border-color: var(--secondary-blue, #4A90E2);
    background: #f0f8ff;
    transform: translateX(3px);
}

.poll-option:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.poll-option.selected {
    background: var(--secondary-blue, #4A90E2);
    color: white;
    border-color: var(--secondary-blue, #4A90E2);
}

/* Vote Results */
.vote-results {
    margin-top: 12px;
}

.vote-result-item {
    margin-bottom: 12px;
}

.vote-result-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 4px;
    color: #555;
}

.vote-result-bar {
    height: 24px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.vote-result-fill {
    height: 100%;
    background: var(--secondary-blue, #4A90E2);
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    color: white;
    font-size: 12px;
    font-weight: 600;
}

.vote-result-fill.winning {
    background: var(--accent-green, #4CAF50);
}

.vote-total {
    margin-top: 8px;
    font-size: 12px;
    color: #888;
    text-align: right;
}

/* Empty State */
.no-announcements {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.no-announcements svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* Loading State */
.loading-announcements {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--secondary-blue, #4A90E2);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .announcement-panel {
        max-width: 100%;
        max-height: 70vh;
        border-radius: 12px 12px 0 0;
    }

    .announcement-panel-header {
        border-radius: 12px 12px 0 0;
    }

    .announcement-tab {
        bottom: 80px; /* Above mobile footer/nav */
        font-size: 14px;
        padding: 10px 14px;
    }

    .announcement-card {
        padding: 14px;
    }

    .announcement-title {
        font-size: 15px;
    }

    .announcement-message {
        font-size: 13px;
    }

    .poll-option {
        padding: 10px 14px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .announcement-panel {
        max-height: 80vh;
    }

    .announcement-panel-content {
        padding: 16px;
    }

    .announcement-tab {
        bottom: 70px;
        font-size: 13px;
        padding: 8px 12px;
    }
}

/* Ensure panel doesn't cover footer on desktop */
@media (min-width: 769px) {
    .announcement-panel {
        bottom: -20px; /* Fully hide below viewport when closed */
    }

    .announcement-tab {
        bottom: 20px; /* Position above bottom edge */
    }
}

/* Accessibility */
.announcement-tab:focus,
.close-panel:focus,
.poll-option:focus {
    outline: 3px solid var(--primary-lime, #C8E6C9);
    outline-offset: 2px;
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .announcement-panel {
        background: #2a2a2a;
        color: #f0f0f0;
    }

    .announcement-card {
        background: #333;
        color: #f0f0f0;
    }

    .announcement-title,
    .poll-question {
        color: #f0f0f0;
    }

    .announcement-message,
    .vote-result-label {
        color: #ccc;
    }

    .poll-option {
        background: #2a2a2a;
        border-color: #555;
        color: #f0f0f0;
    }

    .poll-option:hover:not(:disabled) {
        background: #3a3a3a;
    }

    .vote-result-bar {
        background: #444;
    }
}
