/**
 * Discourse Notifications Widget Styles
 * Design system: Tailwind stone palette
 */

/* ============================================
   Container & Trigger Button
   ============================================ */
.ta-discourse-notifications-wrapper {
    position: relative;
    display: inline-block;
}

.ta-discourse-notifications-trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: transparent;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    color: #57534e; /* stone-600 */
    transition: all 0.3s ease;
}

.ta-discourse-notifications-trigger::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 0.75rem;
    background: rgba(120, 113, 108, 0.1); /* stone-500/10 */
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
    z-index: 0;
}

.ta-discourse-notifications-trigger:hover::before,
.ta-discourse-notifications-trigger[aria-expanded="true"]::before {
    width: 100%;
    height: 100%;
}

.ta-discourse-notifications-trigger:hover {
    color: #1c1917; /* stone-900 */
}

.dark .ta-discourse-notifications-trigger {
    color: #d6d3d1; /* stone-300 */
}

.dark .ta-discourse-notifications-trigger::before {
    background: rgba(255, 255, 255, 0.1);
}

.dark .ta-discourse-notifications-trigger:hover {
    color: #fafaf9; /* stone-50 */
}

.ta-discourse-notifications-icon {
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.ta-discourse-notifications-trigger:hover .ta-discourse-notifications-icon {
    transform: scale(1.1);
}

/* ============================================
   Badge
   ============================================ */
.ta-discourse-notifications-badge {
    position: absolute;
    top: -0.25rem;
    right: -0.25rem;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.375rem;
    background: #dc2626; /* red-600 */
    color: #ffffff;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.25rem;
    text-align: center;
    border-radius: 0.625rem;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    animation: badge-pulse 2s ease-in-out infinite;
    z-index: 2;
}

.dark .ta-discourse-notifications-badge {
    border-color: #1c1917; /* stone-900 */
}

@keyframes badge-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* ============================================
   Dropdown
   ============================================ */
.ta-discourse-notifications-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    width: 22rem;
    max-width: 90vw;
    background: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(28, 25, 23, 0.05); /* stone-900/5 */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    overflow: hidden;
}

.ta-discourse-notifications-dropdown--right {
    right: 0;
}

.ta-discourse-notifications-dropdown--left {
    left: 0;
}

.ta-discourse-notifications-dropdown[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dark .ta-discourse-notifications-dropdown {
    background: #1c1917; /* stone-900 */
    border-color: rgba(250, 250, 249, 0.1); /* stone-50/10 */
}

/* ============================================
   Dropdown Header
   ============================================ */
.ta-discourse-notifications-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(28, 25, 23, 0.05);
}

.dark .ta-discourse-notifications-header {
    border-bottom-color: rgba(250, 250, 249, 0.1);
}

.ta-discourse-notifications-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1c1917; /* stone-900 */
}

.dark .ta-discourse-notifications-header h3 {
    color: #fafaf9; /* stone-50 */
}

.ta-discourse-notifications-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    color: #78716c; /* stone-500 */
    cursor: pointer;
    transition: all 0.2s ease;
}

.ta-discourse-notifications-close:hover {
    background: rgba(120, 113, 108, 0.1);
    color: #1c1917;
}

.dark .ta-discourse-notifications-close {
    color: #a8a29e; /* stone-400 */
}

.dark .ta-discourse-notifications-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fafaf9;
}

/* ============================================
   Dropdown Content
   ============================================ */
.ta-discourse-notifications-content {
    max-height: 24rem;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom scrollbar */
.ta-discourse-notifications-content::-webkit-scrollbar {
    width: 0.5rem;
}

.ta-discourse-notifications-content::-webkit-scrollbar-track {
    background: transparent;
}

.ta-discourse-notifications-content::-webkit-scrollbar-thumb {
    background: rgba(120, 113, 108, 0.2);
    border-radius: 0.25rem;
}

.ta-discourse-notifications-content::-webkit-scrollbar-thumb:hover {
    background: rgba(120, 113, 108, 0.3);
}

/* ============================================
   Loading State
   ============================================ */
.ta-discourse-notifications-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    color: #78716c; /* stone-500 */
}

.ta-discourse-notifications-spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid rgba(120, 113, 108, 0.2);
    border-top-color: #78716c;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.ta-discourse-notifications-loading p {
    margin: 0;
    font-size: 0.875rem;
}

/* ============================================
   Topic Items
   ============================================ */
.ta-discourse-notifications-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ta-discourse-notification-item {
    position: relative;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid rgba(28, 25, 23, 0.05);
    transition: background 0.2s ease;
}

.ta-discourse-notification-item:last-child {
    border-bottom: none;
}

.ta-discourse-notification-item:hover {
    background: rgba(120, 113, 108, 0.05);
}

.dark .ta-discourse-notification-item {
    border-bottom-color: rgba(250, 250, 249, 0.05);
}

.dark .ta-discourse-notification-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.ta-discourse-notification-item--new::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #dc2626; /* red-600 */
}

.ta-discourse-notification-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.ta-discourse-notification-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #1c1917; /* stone-900 */
    margin: 0 0 0.375rem 0;
    line-height: 1.4;
}

.dark .ta-discourse-notification-title {
    color: #fafaf9; /* stone-50 */
}

.ta-discourse-notification-link:hover .ta-discourse-notification-title {
    color: #57534e; /* stone-700 */
}

.dark .ta-discourse-notification-link:hover .ta-discourse-notification-title {
    color: #d6d3d1; /* stone-300 */
}

.ta-discourse-notification-excerpt {
    font-size: 0.8125rem;
    color: #78716c; /* stone-500 */
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
}

.dark .ta-discourse-notification-excerpt {
    color: #a8a29e; /* stone-400 */
}

.ta-discourse-notification-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.75rem;
    color: #78716c; /* stone-500 */
}

.dark .ta-discourse-notification-meta {
    color: #a8a29e; /* stone-400 */
}

.ta-discourse-notification-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.ta-discourse-notification-category {
    padding: 0.125rem 0.5rem;
    background: rgba(120, 113, 108, 0.1);
    border-radius: 0.25rem;
    font-weight: 500;
}

.dark .ta-discourse-notification-category {
    background: rgba(168, 162, 158, 0.15);
}

/* ============================================
   Empty State
   ============================================ */
.ta-discourse-notifications-empty {
    padding: 3rem 2rem;
    text-align: center;
    color: #78716c; /* stone-500 */
}

.ta-discourse-notifications-empty p {
    margin: 0;
    font-size: 0.9375rem;
}

/* ============================================
   Footer
   ============================================ */
.ta-discourse-notifications-footer {
    padding: 0.875rem 1.25rem;
    border-top: 1px solid rgba(28, 25, 23, 0.05);
}

.dark .ta-discourse-notifications-footer {
    border-top-color: rgba(250, 250, 249, 0.1);
}

.ta-discourse-notifications-view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.625rem 1rem;
    background: transparent;
    color: #57534e; /* stone-700 */
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.ta-discourse-notifications-view-all:hover {
    background: rgba(120, 113, 108, 0.1);
    color: #1c1917;
}

.dark .ta-discourse-notifications-view-all {
    color: #d6d3d1; /* stone-300 */
}

.dark .ta-discourse-notifications-view-all:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fafaf9;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 767px) {
    .ta-discourse-notifications-dropdown {
        width: calc(100vw - 2rem);
        max-width: 20rem;
    }

    .ta-discourse-notifications-dropdown--right {
        right: -1rem;
    }

    .ta-discourse-notifications-dropdown--left {
        left: -1rem;
    }
}

/* ============================================
   Accessibility
   ============================================ */
.ta-discourse-notifications-trigger:focus {
    outline: 2px solid #78716c;
    outline-offset: 2px;
}

.dark .ta-discourse-notifications-trigger:focus {
    outline-color: #a8a29e;
}

/* ============================================
   Animations
   ============================================ */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ta-discourse-notification-item {
    animation: slideIn 0.2s ease-out backwards;
}

.ta-discourse-notification-item:nth-child(1) { animation-delay: 0.05s; }
.ta-discourse-notification-item:nth-child(2) { animation-delay: 0.1s; }
.ta-discourse-notification-item:nth-child(3) { animation-delay: 0.15s; }
.ta-discourse-notification-item:nth-child(4) { animation-delay: 0.2s; }
.ta-discourse-notification-item:nth-child(5) { animation-delay: 0.25s; }
