/**
 * Widgets CSS
 * Styles for custom AlphaStreet widgets
 *
 * @package AlphaStreet_News
 * @version 2.2.0
 */

/* ==========================================================================
   BASE WIDGET STYLES
   ========================================================================== */

.widget {
    margin-bottom: var(--as-space-5);
    padding: var(--as-space-4);
    background: var(--as-bg-card);
    border: 1px solid var(--as-border);
    border-radius: var(--as-radius-lg);
}

.widget:last-child {
    margin-bottom: 0;
}

.widget-title {
    display: flex;
    align-items: center;
    gap: var(--as-space-2);
    font-size: var(--as-text-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--as-text-primary);
    margin: 0 0 var(--as-space-4);
    padding-bottom: var(--as-space-3);
    border-bottom: 1px solid var(--as-border);
}

.widget-title svg {
    color: var(--as-primary);
    flex-shrink: 0;
}

.widget-empty {
    font-size: var(--as-text-sm);
    color: var(--as-text-tertiary);
    text-align: center;
    padding: var(--as-space-4);
    margin: 0;
}

.widget-view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--as-space-2);
    margin-top: var(--as-space-4);
    padding-top: var(--as-space-3);
    border-top: 1px solid var(--as-border);
    font-size: var(--as-text-sm);
    font-weight: 600;
    color: var(--as-primary);
    text-decoration: none;
    transition: color var(--as-transition-fast);
}

.widget-view-all:hover {
    color: var(--as-primary-hover);
}

/* ==========================================================================
   TRENDING TICKERS WIDGET
   ========================================================================== */

.widget-trending-tickers {
    padding: 0;
    overflow: hidden;
}

.widget-trending-tickers .widget-title {
    margin: 0;
    padding: var(--as-space-4);
    border-bottom: 1px solid var(--as-border);
    border-radius: var(--as-radius-lg) var(--as-radius-lg) 0 0;
}

.trending-tickers-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ticker-item {
    border-bottom: 1px solid var(--as-border-light);
}

.ticker-item:last-child {
    border-bottom: none;
}

.ticker-link {
    display: flex;
    align-items: center;
    gap: var(--as-space-3);
    padding: var(--as-space-3) var(--as-space-4);
    text-decoration: none;
    transition: background var(--as-transition-fast);
}

.ticker-link:hover {
    background: var(--as-bg-tertiary);
}

.ticker-rank {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--as-bg-tertiary);
    border-radius: var(--as-radius-full);
    font-size: var(--as-text-xs);
    font-weight: 700;
    color: var(--as-text-tertiary);
}

.ticker-item:nth-child(1) .ticker-rank {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #fff;
}

.ticker-item:nth-child(2) .ticker-rank {
    background: linear-gradient(135deg, #94a3b8, #64748b);
    color: #fff;
}

.ticker-item:nth-child(3) .ticker-rank {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: #fff;
}

.ticker-info {
    flex: 1;
    min-width: 0;
}

.ticker-symbol {
    display: block;
    font-size: var(--as-text-sm);
    font-weight: 700;
    font-family: var(--as-font-mono);
    color: var(--as-primary);
}

.ticker-company {
    display: block;
    font-size: var(--as-text-xs);
    color: var(--as-text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ticker-count {
    font-size: var(--as-text-xs);
    color: var(--as-text-muted);
    white-space: nowrap;
}

.widget-trending-tickers .widget-view-all {
    margin: 0;
    padding: var(--as-space-3) var(--as-space-4);
    border-top: 1px solid var(--as-border);
    border-radius: 0 0 var(--as-radius-lg) var(--as-radius-lg);
}

/* ==========================================================================
   UPCOMING EARNINGS WIDGET
   ========================================================================== */

.widget-upcoming-earnings {
    padding: 0;
    overflow: hidden;
}

.widget-upcoming-earnings .widget-title {
    margin: 0;
    padding: var(--as-space-4);
    border-bottom: 1px solid var(--as-border);
    border-radius: var(--as-radius-lg) var(--as-radius-lg) 0 0;
}

.upcoming-earnings-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.earnings-item {
    display: flex;
    align-items: center;
    gap: var(--as-space-3);
    padding: var(--as-space-3) var(--as-space-4);
    border-bottom: 1px solid var(--as-border-light);
    transition: background var(--as-transition-fast);
}

.earnings-item:last-child {
    border-bottom: none;
}

.earnings-item:hover {
    background: var(--as-bg-tertiary);
}

.earnings-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--as-bg-tertiary);
    border-radius: var(--as-radius-md);
    flex-shrink: 0;
}

.earnings-month {
    font-size: var(--as-text-xs);
    font-weight: 600;
    text-transform: uppercase;
    color: var(--as-primary);
    line-height: 1;
}

.earnings-day {
    font-size: var(--as-text-lg);
    font-weight: 700;
    color: var(--as-text-primary);
    line-height: 1.2;
}

.earnings-info {
    flex: 1;
    min-width: 0;
}

.earnings-company {
    display: block;
    font-size: var(--as-text-sm);
    font-weight: 600;
    color: var(--as-text-primary);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: var(--as-space-1);
}

.earnings-company:hover {
    color: var(--as-primary);
}

.earnings-meta {
    display: flex;
    align-items: center;
    gap: var(--as-space-2);
    font-size: var(--as-text-xs);
}

.earnings-ticker {
    font-weight: 600;
    font-family: var(--as-font-mono);
    color: var(--as-text-secondary);
}

.earnings-time {
    color: var(--as-text-tertiary);
}

.earnings-time::before {
    content: '•';
    margin-right: var(--as-space-2);
}

.widget-upcoming-earnings .widget-view-all {
    margin: 0;
    padding: var(--as-space-3) var(--as-space-4);
    border-top: 1px solid var(--as-border);
    border-radius: 0 0 var(--as-radius-lg) var(--as-radius-lg);
}

/* ==========================================================================
   NEWSLETTER WIDGET
   ========================================================================== */

.widget-newsletter {
    background: linear-gradient(135deg, var(--as-bg-card) 0%, var(--as-bg-tertiary) 100%);
}

.newsletter-widget-inner {
    text-align: center;
}

/* Featured Style */
.newsletter-widget-inner.style-featured {
    padding: var(--as-space-2) 0;
}

.newsletter-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin: 0 auto var(--as-space-4);
    background: var(--as-primary-light);
    border-radius: var(--as-radius-full);
    color: var(--as-primary);
}

.newsletter-title {
    font-size: var(--as-text-lg);
    font-weight: 700;
    color: var(--as-text-primary);
    margin: 0 0 var(--as-space-2);
}

.newsletter-description {
    font-size: var(--as-text-sm);
    color: var(--as-text-secondary);
    line-height: 1.5;
    margin: 0 0 var(--as-space-4);
}

.newsletter-form-inner {
    display: flex;
    flex-direction: column;
    gap: var(--as-space-2);
}

.newsletter-input {
    width: 100%;
    padding: var(--as-space-3);
    background: var(--as-bg-primary);
    border: 1px solid var(--as-border);
    border-radius: var(--as-radius-md);
    font-size: var(--as-text-sm);
    color: var(--as-text-primary);
    text-align: center;
    transition: border-color var(--as-transition-fast);
}

.newsletter-input:focus {
    outline: none;
    border-color: var(--as-primary);
}

.newsletter-input::placeholder {
    color: var(--as-text-tertiary);
}

.newsletter-submit {
    width: 100%;
    padding: var(--as-space-3);
    background: var(--as-primary);
    border: none;
    border-radius: var(--as-radius-md);
    font-size: var(--as-text-sm);
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: background var(--as-transition-fast);
}

.newsletter-submit:hover {
    background: var(--as-primary-hover);
}

.newsletter-privacy {
    font-size: var(--as-text-xs);
    color: var(--as-text-muted);
    margin: var(--as-space-3) 0 0;
}

/* Compact Style */
.newsletter-widget-inner.style-compact .newsletter-title {
    font-size: var(--as-text-base);
}

.newsletter-widget-inner.style-compact .newsletter-description {
    display: none;
}

.newsletter-widget-inner.style-compact .newsletter-form-inner {
    flex-direction: row;
}

.newsletter-widget-inner.style-compact .newsletter-input {
    flex: 1;
    text-align: left;
}

.newsletter-widget-inner.style-compact .newsletter-submit {
    width: auto;
    padding: var(--as-space-3) var(--as-space-4);
}

/* ==========================================================================
   AD WIDGET
   ========================================================================== */

.widget-ad {
    padding: 0;
    background: transparent;
    border: none;
    text-align: center;
}

.ad-widget-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ad-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--as-text-muted);
    margin-bottom: var(--as-space-2);
}

.ad-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--as-bg-tertiary);
    border: 1px dashed var(--as-border);
    border-radius: var(--as-radius-md);
    overflow: hidden;
    max-width: 100%;
}

.ad-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: var(--as-space-4);
}

.ad-placeholder-size {
    font-size: var(--as-text-lg);
    font-weight: 700;
    font-family: var(--as-font-mono);
    color: var(--as-text-tertiary);
}

.ad-placeholder-name {
    font-size: var(--as-text-xs);
    color: var(--as-text-muted);
    margin-top: var(--as-space-1);
}

/* Responsive Ad Slots */
@media (max-width: 768px) {
    .ad-slot-728x90 {
        width: 320px !important;
        height: 50px !important;
    }

    .ad-slot-300x600 {
        width: 300px !important;
        height: 250px !important;
    }
}

/* ==========================================================================
   SIDEBAR LAYOUTS
   ========================================================================== */

.sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--as-space-5);
}

/* Sticky Sidebar */
.sidebar-sticky {
    position: sticky;
    top: 100px;
}

/* ==========================================================================
   LIGHT MODE ADJUSTMENTS
   ========================================================================== */

body.light-mode .widget {
    background: #ffffff;
    border-color: #e2e8f0;
}

body.light-mode .widget-trending-tickers .widget-title,
body.light-mode .widget-upcoming-earnings .widget-title {
    background: #f8fafc;
}

body.light-mode .ticker-link:hover,
body.light-mode .earnings-item:hover {
    background: #f1f5f9;
}

body.light-mode .ticker-rank {
    background: #e2e8f0;
}

body.light-mode .earnings-date {
    background: #f1f5f9;
}

body.light-mode .widget-newsletter {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

body.light-mode .newsletter-input {
    background: #f8fafc;
    border-color: #e2e8f0;
}

body.light-mode .ad-slot {
    background: #f8fafc;
    border-color: #e2e8f0;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 1024px) {
    .sidebar {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--as-space-4);
    }

    .widget-ad {
        grid-column: span 2;
    }
}

@media (max-width: 640px) {
    .sidebar {
        grid-template-columns: 1fr;
    }

    .widget-ad {
        grid-column: span 1;
    }
}
