/*
======================================================
Professional Calendar Enhancement - Modern Design System
Version: 2.0
======================================================
*/

:root {
    --cal-gradient-primary: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    --cal-gradient-card: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    --cal-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --cal-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --cal-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --cal-shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.15);
    --cal-transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --cal-border-radius: 12px;
    --cal-border-radius-lg: 16px;
}

/*
======================================================
Enhanced Hero Section
======================================================
*/
.calendar-hero {
    background: var(--cal-gradient-primary);
    padding: 4rem 0 3rem 0;
    position: relative;
    overflow: hidden;
}

.calendar-hero::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(180deg, transparent, white);
    pointer-events: none;
}

/* Breadcrumb Navigation */
.breadcrumb-container {
    margin-bottom: 1.5rem;
}

.breadcrumb {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
}

.breadcrumb-item a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 500;
}

.breadcrumb-item a:hover {
    color: white;
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: '›';
    color: rgba(255, 255, 255, 0.6);
    margin-right: 0.5rem;
    font-size: 1.125rem;
}

.calendar-hero h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
    color: white;
}

.calendar-hero p {
    font-size: 1.125rem;
    opacity: 0.95;
    max-width: 700px;
    line-height: 1.7;
    color: white;
}

/*
======================================================
Enhanced Filter Section
======================================================
*/
.calendar-controls {
    padding: 2rem 0;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.calendar-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-select {
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 500;
    background-color: white;
    transition: all 0.2s ease;
    cursor: pointer;
    color: #1e293b;
}

.form-select:hover {
    border-color: #cbd5e1;
}

.form-select:focus {
    outline: none;
    border-color: #1e3a8a;
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.search-input-container {
    position: relative;
}

.search-input-container input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9375rem;
    color: #1e293b;
    transition: var(--cal-transition-smooth);
}

.search-input-container input:focus {
    outline: none;
    border-color: #1e3a8a;
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.search-input-container svg {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    pointer-events: none;
}

/*
======================================================
Enhanced Period Navigation
======================================================
*/
.calendar-navigation {
    background: white;
    border-radius: var(--cal-border-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--cal-shadow-md);
    margin-bottom: 2.5rem;
}

.period-navigation {
    margin-bottom: 2rem;
}

.period-nav-wrapper {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.period-nav {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.period-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 1.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 180px;
    flex: 1;
    position: relative;
    overflow: hidden;
}

.period-nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--cal-gradient-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.period-nav-btn:hover {
    border-color: #1e3a8a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.period-nav-btn.active {
    border-color: #1e3a8a;
    background: linear-gradient(145deg, #eff6ff 0%, white 100%);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.15);
}

.period-nav-btn.active::before {
    transform: scaleX(1);
}

.nav-label {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #475569;
}

.period-nav-btn.active .nav-label {
    color: #1e3a8a;
}

.nav-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 0.75rem;
    background: #e9ecef;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 700;
    color: #495057;
    transition: var(--cal-transition-smooth);
}

.period-nav-btn.active .nav-count {
    background: linear-gradient(135deg, #1e3a8a, #1e40af);
    color: white;
}

/*
======================================================
Enhanced Calendar Day Cards
======================================================
*/
.calendar-day {
    background: white;
    border-radius: var(--cal-border-radius-lg);
    box-shadow: var(--cal-shadow-sm);
    margin-bottom: 2rem;
    overflow: hidden;
    transition: var(--cal-transition-smooth);
}

.calendar-day:hover {
    box-shadow: var(--cal-shadow-md);
    transform: translateY(-2px);
}

.calendar-day-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 1.5rem 2rem;
    border-bottom: 2px solid #e9ecef;
}

.day-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #212529;
}

.day-name {
    color: #667eea;
}

.calendar-date {
    color: #6c757d;
    font-size: 1.125rem;
    font-weight: 600;
}

.day-summary {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: 0.875rem;
    color: #6c757d;
}

.earnings-count {
    font-weight: 700;
    color: #495057;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.earnings-count::before {
    content: '📊';
    font-size: 1rem;
}

.timing-count {
    padding: 0.25rem 0.75rem;
    background: white;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8125rem;
}

/*
======================================================
Enhanced Company Cards - COMPACT GRID LAYOUT
======================================================
*/
.calendar-companies {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.calendar-company {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 0;
    transition: var(--cal-transition-smooth);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: visible;
}

.calendar-company:hover {
    border-color: #667eea;
    box-shadow: var(--cal-shadow-md);
    transform: translateY(-4px);
}

/* Card Header with Time Icon */
.company-time-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #e9ecef;
}

.calendar-time {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0;  /* Hide the text */
    font-weight: 600;
    color: #495057;
}

.calendar-time::before {
    font-size: 1.5rem;
}

.calendar-time.pre-market::before {
    content: '🌅'; /* Sunrise for before market */
}

.calendar-time.after-market::before {
    content: '🌙'; /* Moon for after market */
}

.calendar-time.other-time::before {
    content: '🕐'; /* Clock for during market */
}

/* Add tooltip on hover to show full text */
.calendar-time.pre-market {
    position: relative;
}

.calendar-time.pre-market::after {
    content: 'Before Market';
    position: absolute;
    top: 100%;
    left: 0;
    background: #212529;
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
    margin-top: 0.25rem;
}

.calendar-time.pre-market:hover::after {
    opacity: 1;
}

.calendar-time.after-market {
    position: relative;
}

.calendar-time.after-market::after {
    content: 'After Market';
    position: absolute;
    top: 100%;
    left: 0;
    background: #212529;
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
    margin-top: 0.25rem;
}

.calendar-time.after-market:hover::after {
    opacity: 1;
}

/* Main Content Area */
.company-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.company-header {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
}

.calendar-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6c757d;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.company-ticker {
    font-size: 1.5rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 0.75rem;
    letter-spacing: 0.02em;
}

/* Simple Metadata Row */
.company-meta {
    display: flex;
    gap: 0.625rem;
    margin-bottom: 1rem;
}

.exchange-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: #667eea;
    background: #f0f3ff;
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
}

.sector-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
}

.sector-badge::before {
    content: '•';
    margin-right: 0.375rem;
    color: #adb5bd;
}

/* Swing Indicator - Compact */
.swing-indicator {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    background: #fff3cd;
    color: #856404;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: auto;
}

.swing-indicator.high-swing {
    background: #ff6b6b;
    color: white;
}

/* Compact Estimates Section */
.calendar-estimates {
    display: flex;
    gap: 1.5rem;
    padding: 1rem 1.25rem;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.estimate-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.estimate-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.estimate-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: #212529;
}

/* Style for missing data (em dash) */
.estimate-value:contains('—') {
    color: #ced4da;
    font-weight: 400;
}

/* Action Footer */
.company-actions {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    background: white;
    border-top: 1px solid #e9ecef;
}

.btn-reminder,
.btn-details {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 40px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background: white;
    color: #495057;
    cursor: pointer;
    transition: var(--cal-transition-smooth);
    font-size: 0.875rem;
    font-weight: 500;
}

.btn-reminder:hover {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.btn-reminder.subscribed {
    background: #51cf66;
    border-color: #51cf66;
    color: white;
}

.btn-details:hover {
    background: #f8f9fa;
    border-color: #667eea;
    color: #667eea;
}

/*
======================================================
Enhanced Empty State
======================================================
*/
.calendar-empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: var(--cal-border-radius-lg);
    box-shadow: var(--cal-shadow-sm);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.6;
}

.calendar-empty-state h4 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #495057;
    margin-bottom: 0.75rem;
}

.calendar-empty-state p {
    font-size: 1rem;
    color: #6c757d;
    max-width: 500px;
    margin: 0 auto;
}

/*
======================================================
Enhanced Tools Section
======================================================
*/
.calendar-tools {
    padding: 4rem 0;
    background: linear-gradient(180deg, white 0%, #f8f9fa 100%);
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.tool-card {
    background: white;
    border-radius: var(--cal-border-radius-lg);
    padding: 2rem;
    box-shadow: var(--cal-shadow-sm);
    transition: var(--cal-transition-smooth);
    text-align: center;
}

.tool-card:hover {
    box-shadow: var(--cal-shadow-hover);
    transform: translateY(-8px);
}

.tool-icon {
    font-size: 3rem;
    margin-bottom: 1.25rem;
}

.tool-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 0.75rem;
}

.tool-card p {
    color: #6c757d;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.tool-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: var(--cal-transition-smooth);
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(30, 64, 175, 0.3);
}

.btn-outline {
    background: white;
    border: 2px solid #e2e8f0;
    color: #475569;
}

.btn-outline:hover {
    border-color: #1e3a8a;
    color: #1e3a8a;
    background: #eff6ff;
}

/*
======================================================
Responsive Design - OPTIMIZED FOR GRID
======================================================
*/
@media (max-width: 1200px) {
    .calendar-companies {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .calendar-hero {
        padding: 3rem 0 2rem 0;
    }

    .calendar-hero h1 {
        font-size: 2rem;
    }

    .calendar-filters {
        grid-template-columns: 1fr;
    }

    .period-nav {
        grid-template-columns: 1fr;
    }

    .calendar-day-header {
        padding: 1.25rem 1.5rem;
    }

    .day-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .calendar-companies {
        padding: 1rem;
        grid-template-columns: 1fr;
    }

    .calendar-company {
        padding: 1rem;
    }

    .company-meta {
        flex-wrap: wrap;
    }

    .calendar-estimates {
        flex-direction: column;
        gap: 0.5rem;
    }

    .tools-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .calendar-hero h1 {
        font-size: 1.75rem;
    }

    .calendar-hero p {
        font-size: 1rem;
    }

    .calendar-day-header {
        padding: 1rem;
    }

    .calendar-companies {
        padding: 0.75rem;
    }

    .calendar-company {
        padding: 0.875rem;
    }

    .company-actions {
        gap: 0.375rem;
    }

    .btn-reminder,
    .btn-details {
        width: 36px;
        height: 36px;
    }
}

/* Large screens - 4 columns */
@media (min-width: 1400px) {
    .calendar-companies {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Extra large screens - 5 columns */
@media (min-width: 1800px) {
    .calendar-companies {
        grid-template-columns: repeat(5, 1fr);
    }
}

/*
======================================================
Animation Utilities
======================================================
*/
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.calendar-company {
    animation: fadeInUp 0.4s ease-out backwards;
}

.calendar-company:nth-child(1) { animation-delay: 0.05s; }
.calendar-company:nth-child(2) { animation-delay: 0.1s; }
.calendar-company:nth-child(3) { animation-delay: 0.15s; }
.calendar-company:nth-child(4) { animation-delay: 0.2s; }
.calendar-company:nth-child(5) { animation-delay: 0.25s; }

/*
======================================================
Loading States
======================================================
*/
.calendar-company.loading {
    pointer-events: none;
    opacity: 0.6;
}

.calendar-company.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
