/* Crimecast Report Cards - Instagram-Style Styling */

/* Card Preview Section */
#card-preview-section {
    background: #0d1117;
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1rem;
    border: 1px solid #30363d;
}

/* Simplified Navigation Arrows */
.carousel-nav-arrow {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: white;
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
    flex-shrink: 0;
}

.carousel-nav-arrow:hover:not(:disabled) {
    transform: scale(1.15);
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.5);
}

.carousel-nav-arrow:active:not(:disabled) {
    transform: scale(1.05);
}

.carousel-nav-arrow:disabled {
    background: #30363d;
    opacity: 0.3;
    cursor: not-allowed;
}

/* Floating Close Button - Top Right Corner */
.report-close-btn {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: rgba(220, 38, 38, 0.9);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
    z-index: 10001;
}

.report-close-btn:hover {
    background: rgba(220, 38, 38, 1);
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.6);
}

.report-close-btn:active {
    transform: scale(1.0) rotate(90deg);
}

/* Carousel Viewport - SIMPLIFIED */
.carousel-viewport {
    overflow-x: hidden;   /* Hide horizontal overflow - only show 1 card */
    overflow-y: visible;  /* Allow vertical overflow - tall cards not clipped */
    margin: 1rem auto;
    position: relative;
    width: 100%;
    max-width: 600px;
}

.carousel-track {
    display: flex;
    transition: transform 0.4s ease-out;
}

.carousel-slide {
    flex: 0 0 100%;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* Report Card Container - Base Dimensions */
.report-card-container {
    position: relative;
    transform-origin: top left;
}

.report-card-container[data-ratio="square"] {
    width: 1080px;
    height: 1080px;
    aspect-ratio: 1 / 1;
}

.report-card-container[data-ratio="portrait"] {
    width: 1080px;
    height: 1920px;
    aspect-ratio: 9 / 16;
}

/* Card wrapper controls the space, scaled card sits inside */
.card-wrapper {
    display: block;
    margin: 0 auto;
    overflow: visible;
}

.card-wrapper[data-ratio="square"] {
    width: 432px;  /* 1080 * 0.4 */
    /* Height auto - grows to match container's layout height (1080px) */
}

.card-wrapper[data-ratio="portrait"] {
    width: 432px;  /* 1080 * 0.4 */
    /* Height auto - grows to match container's layout height (1920px) */
}

/* Card scaling in carousel - uses zoom for proportional layout sizing */
.carousel-slide .report-card-container {
    zoom: 0.4;
    transform-origin: top left;
}

/* Report Card Base Styling */
.report-card {
    width: 100%;
    min-height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #ffffff;
    padding: 60px;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: visible;
}

/* Square cards: Fixed height to prevent overflow */
.report-card-container[data-ratio="square"] .report-card {
    height: 100%;
}

/* Card 4 & Forecast cards: Dynamic height to fit content */
.card-4,
.forecast-card {
    height: auto !important;  /* Override square fixed height */
}

.card-wrapper[data-ratio="square"]:has(.card-4) .report-card-container,
.card-wrapper[data-ratio="square"]:has(.forecast-card) .report-card-container {
    height: auto;  /* Container grows with content */
}

/* Card Header */
.card-header {
    text-align: center;
    margin-bottom: 40px;
}

.card-title {
    font-size: 72px;
    font-weight: 900;
    margin: 0 0 20px 0;
    color: #0ea5e9;
    letter-spacing: 4px;
    text-shadow: 0 4px 16px rgba(14, 165, 233, 0.5);
}

.card-subtitle {
    font-size: 36px;
    color: #8b949e;
    margin: 0;
    font-weight: 500;
    letter-spacing: 2px;
}

/* Card Body */
.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Card Footer - Hidden in admin preview, visible in exports */
.card-footer {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding-top: 30px;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
    margin-top: 40px;
}

.card-branding {
    font-size: 24px;
    color: #8b949e;
    font-weight: 600;
}

.card-page {
    font-size: 24px;
    color: #0ea5e9;
    font-weight: 700;
}

/* Card 1: Metrics Grid */
.metrics-grid {
    position: relative;
    height: 100%;
    display: block;
}

.card-1 .metric-box {
    background: rgba(255, 255, 255, 0.05);
    border: 5px solid;
    border-radius: 24px;
    padding: 50px 30px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    height: 47%;
    width: 47%;
    position: absolute;
    overflow: hidden;
    box-sizing: border-box;
}

.card-1 .metric-box:nth-child(1) {
    top: 0;
    left: 0;
}

.card-1 .metric-box:nth-child(2) {
    top: 0;
    right: 0;
}

.card-1 .metric-box:nth-child(3) {
    bottom: 0;
    left: 0;
}

.card-1 .metric-box:nth-child(4) {
    bottom: 0;
    right: 0;
}

.metric-icon {
    font-size: 120px;
    width: 120px;
    height: 120px;
    margin: 0;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.metric-icon img {
    width: 100%;
    height: 100%;
    display: block;
}

.metric-value {
    font-size: 100px;
    font-weight: 900;
    margin: 0;
    line-height: 1;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    max-width: 100%;
    white-space: nowrap;
}

/* Busiest Day (2nd metric box) - Smaller font to fit long day names like "Wednesday" */
.card-1 .metric-box:nth-child(2) .metric-value {
    font-size: 70px;  /* Reduced from 100px to fit "Wednesday" */
}

.metric-sublabel {
    font-size: 32px;
    color: #c9d1d9;
    margin: 0;
    font-weight: 600;
    flex-shrink: 1;
}

.metric-label {
    font-size: 32px;
    color: #8b949e;
    margin: 0;
    font-weight: 600;
    letter-spacing: 1px;
    flex-shrink: 1;
}

/* Card 2 & 3: Event/Neighborhood Lists */
.report-card .event-section,
.report-card .neighborhood-section {
    margin-bottom: 60px;
}

.report-card .event-section:last-child,
.report-card .neighborhood-section:last-child {
    margin-bottom: 0;
}

.report-card .section-title {
    display: flex;
    align-items: center;
    gap: 24px;
    font-size: 52px;
    font-weight: 900;
    color: #c9d1d9;
    margin-bottom: 35px;
    padding-bottom: 24px;
    border-bottom: 4px solid rgba(255, 255, 255, 0.15);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.report-card .section-icon {
    font-size: 80px;
    width: 80px;
    height: 80px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.report-card .section-icon img {
    width: 100%;
    height: 100%;
    display: block;
}

.report-card .event-list,
.report-card .neighborhood-list {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    padding: 35px;
    border: 2px solid rgba(255, 255, 255, 0.05);
}

.report-card .event-item,
.report-card .neighborhood-item {
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 32px 24px;
    border-bottom: 3px solid rgba(255, 255, 255, 0.08);
    transition: background 0.3s, transform 0.2s;
}

.report-card .event-item:hover,
.report-card .neighborhood-item:hover {
    background: rgba(255, 255, 255, 0.03);
    transform: translateX(8px);
}

.report-card .event-item:last-child,
.report-card .neighborhood-item:last-child {
    border-bottom: none;
}

.report-card .event-rank,
.report-card .neighborhood-rank {
    font-size: 56px;
    font-weight: 900;
    color: #0ea5e9;
    min-width: 90px;
    width: 90px;
    text-align: center;
    text-shadow: 0 2px 8px rgba(14, 165, 233, 0.5);
    flex-shrink: 0;
}

.report-card .event-details,
.report-card .neighborhood-details {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.report-card .event-type,
.report-card .neighborhood-name {
    font-size: 48px;
    font-weight: 800;
    color: #c9d1d9;
    margin-bottom: 10px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.2;
}

.report-card .event-percentage,
.report-card .neighborhood-percentage {
    font-size: 30px;
    color: #8b949e;
    font-weight: 500;
}

.report-card .event-count,
.report-card .neighborhood-count {
    font-size: 80px;
    font-weight: 900;
    color: #0ea5e9;
    min-width: 180px;
    width: 180px;
    text-align: right;
    text-shadow: 0 4px 12px rgba(14, 165, 233, 0.5);
    flex-shrink: 0;
}

.report-card .rare-count {
    color: #a371f7;
    text-shadow: 0 4px 12px rgba(163, 113, 247, 0.5);
}

.report-card .quiet-count {
    color: #10b981;
    text-shadow: 0 4px 12px rgba(16, 185, 129, 0.5);
}

.report-card .no-data {
    text-align: center;
    color: #8b949e;
    font-size: 36px;
    padding: 50px;
    font-style: italic;
}

/* Card 4: Activity Patterns */
.report-card .pattern-section {
    margin-bottom: 60px;
}

.report-card .pattern-section:last-child {
    margin-bottom: 0;
}

/* 24-Hour Chart */
.report-card .hourly-chart {
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    gap: 10px;
    margin: 35px 0;
    height: 350px;
    align-items: end;
}

.report-card .hour-bar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.report-card .hour-bar {
    width: 100%;
    min-height: 25px;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10px;
    transition: all 0.3s;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.report-card .hour-bar:hover {
    transform: translateY(-4px);
    filter: brightness(1.2);
}

.report-card .hour-value {
    font-size: 28px;
    font-weight: 900;
    color: white;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

.report-card .hour-label {
    font-size: 20px;
    color: #8b949e;
    margin-top: 10px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    height: 90px;
    font-weight: 600;
}

/* Daily Chart */
.report-card .daily-chart {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin: 35px 0;
}

.report-card .day-bar-row {
    display: flex;
    align-items: center;
    gap: 24px;
}

.report-card .day-label {
    font-size: 44px;
    font-weight: 900;
    color: #c9d1d9;
    min-width: 130px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.report-card .day-bar-track {
    flex: 1;
    height: 80px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.report-card .day-bar {
    height: 100%;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 28px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 100px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.report-card .day-value {
    font-size: 52px;
    font-weight: 900;
    color: white;
    text-shadow: 0 3px 8px rgba(0, 0, 0, 0.7);
}

.report-card .chart-insight {
    text-align: center;
    font-size: 38px;
    color: #8b949e;
    margin: 24px 0 0 0;
    font-style: italic;
    font-weight: 500;
}

/* Responsive adjustments for portrait cards */
.report-card-container[data-ratio="portrait"] .card-body {
    justify-content: flex-start;
}

/* Animation for card entrance */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.carousel-slide {
    animation: slideIn 0.4s ease-out;
}

/* Print styles for export */
@media print {
    .report-card-container {
        transform: scale(1) !important;
        page-break-after: always;
    }
}
