/* Today View Specific Styles */
/* Responsive grid/list views with smooth transitions */

/* ===== TODAY VIEW PAGE STYLES ===== */

.today-view-page {
    min-height: 100vh;
    background-color: #f9fafb !important;
}

/* Ensure activity items always have white background with thin gray border */

/* Override any problematic defaults */
.today-view-page * {
    background-color: inherit;
}

/* Fix any blue background issues */
.spinner {
    border-top-color: #3b82f6 !important;
    border-color: #e5e7eb !important;
}

/* View Toggle Buttons */
.view-toggle {
    border-radius: 0.5rem;
    background-color: #f3f4f6;
    padding: 0.25rem;
}

.view-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 0.375rem;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    color: #6b7280;
}

.view-btn:hover {
    color: #374151;
}

.view-btn.active {
    background-color: white;
    color: #111827;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* Activity Feed Container */
.activity-feed-container {
    position: relative;
}

/* Activity Feed - Responsive Auto-Fill Grid Layout */
/* Cards automatically flow into columns based on available width */
/* Mobile-first: single column, expands to multiple columns on wider screens */

.activity-feed {
    display: grid;
    gap: 1rem;
    /* Auto-fill columns with minimum 320px width, max 1fr */
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

/* On very small screens, force single column */
@media (max-width: 359px) {
    .activity-feed {
        grid-template-columns: 1fr;
    }
}

/* Activity Card Styles */
.activity-item {
    transition: all 0.2s ease;
    border-radius: 0.5rem;
    background-color: white;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    /* Ensure consistent card heights in grid */
    display: flex;
    flex-direction: column;
    min-height: 140px;
}

.activity-item:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* Card content fills available space */
.activity-item > .flex-1,
.activity-item > .activity-content {
    flex: 1;
}

/* Footer stays at bottom */
.activity-item > .border-t:last-child,
.activity-item > .flex:last-child {
    margin-top: auto;
}

/* Activity Icons */
.activity-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    background-color: #f9fafb;
    flex-shrink: 0;
}

/* Loading States */
.spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Load More Button */
.load-more-btn {
    transition: all 0.2s ease;
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    border: 1px solid #d1d5db;
    background-color: white;
    color: #374151;
}

.load-more-btn:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.load-more-btn:active {
    transform: translateY(0);
}

/* New Activity Notification */
#newActivityNotification {
    max-width: 300px;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    background-color: #3b82f6;
    color: white;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
}

/* Activity Stats Bar */
.activity-feed-container .bg-white:first-child {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

/* Smooth View Transitions */
.activity-feed {
    transition: all 0.3s ease;
    opacity: 1;
}

.activity-feed.transitioning {
    opacity: 0.7;
    transform: scale(0.98);
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .today-view-page {
        padding: 0 1rem;
    }

    /* Single column on mobile with slightly smaller gap */
    .activity-feed {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    /* Cards maintain rounded corners and full styling on mobile */
    .activity-item {
        border-radius: 0.75rem;
        min-height: 120px;
    }
}

/* Touch-friendly interactions */
@media (max-width: 1024px) {
    .activity-item {
        min-height: 60px;
        padding: 1rem;
    }

    .view-btn {
        min-height: 44px;
        padding: 0.5rem 1rem;
    }

    .load-more-btn {
        min-height: 44px;
        padding: 0.75rem 2rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .activity-item {
        border: 2px solid #374151;
    }

    .activity-item:hover {
        border-color: #111827;
    }

    .view-btn.active {
        border: 2px solid #111827;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .activity-item,
    .view-btn,
    .load-more-btn,
    .activity-feed,
    #newActivityNotification {
        transition: none;
    }

    .spinner {
        animation: none;
        border-top-color: #3b82f6;
    }

    .activity-item:hover {
        transform: none;
    }
}

/* Dark mode support - DISABLED for clean white interface */
/* Commenting out dark mode to ensure clean white background always */
/*
@media (prefers-color-scheme: dark) {
    .today-view-page {
        background-color: #111827;
    }

    .activity-item {
        background-color: #1f2937;
        border-color: #374151;
    }
}
*/

/* Print styles */
@media print {
    .today-view-page {
        background: white;
    }

    .load-more-btn,
    #newActivityNotification {
        display: none;
    }

    .activity-feed {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .activity-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* Custom scrollbar for activity feed */
.activity-feed-container {
    scrollbar-width: thin;
    scrollbar-color: #d1d5db #f3f4f6;
}

.activity-feed-container::-webkit-scrollbar {
    width: 6px;
}

.activity-feed-container::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 3px;
}

.activity-feed-container::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.activity-feed-container::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Focus styles for accessibility */
.view-btn:focus,
.load-more-btn:focus,
.activity-item:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Animation for new activities */
@keyframes slideInFromTop {
    0% {
        transform: translateY(-20px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.activity-item.new-activity {
    animation: slideInFromTop 0.5s ease-out;
}

/* Card hover effects - subtle lift on desktop */
@media (min-width: 769px) {
    .activity-item:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px -5px rgba(0, 0, 0, 0.12);
    }
}

/* Loading skeleton animation */
@keyframes shimmer {
    0% {
        background-position: -468px 0;
    }
    100% {
        background-position: 468px 0;
    }
}

.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 400% 100%;
    animation: shimmer 1.2s ease-in-out infinite;
    border-radius: 4px;
}

/* Empty state improvements */
#emptyState {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Status indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-indicator.success {
    background-color: #dcfce7;
    color: #166534;
}

.status-indicator.warning {
    background-color: #fef3c7;
    color: #92400e;
}

.status-indicator.error {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-indicator.info {
    background-color: #dbeafe;
    color: #1e40af;
}

/* ===== ACTIVITY IMAGE CARDS ===== */
/* iOS-style image cards matching the app implementation */

.activity-item {
    background: white !important;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb !important;
    transition: all 0.2s ease;
    overflow: hidden; /* Ensure content stays within card */
}

.activity-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

/* Activity item footer with border */
.activity-item .border-t {
    border-top: 1px solid #f3f4f6 !important;
}

/* Image container base styles - ENSURE CONTAINMENT */
.image-container {
    margin-top: 0;
    margin-bottom: 0;
    width: 100%;
    overflow: hidden; /* Prevent overflow */
    max-width: 100%; /* Stay within card boundaries */
}

/* Activity content section with proper spacing */
.activity-content {
    width: 100%;
    overflow: hidden; /* Prevent overflow */
}

.activity-content .image-container {
    margin: 0; /* Remove extra margins */
}

/* Single image layout - INCREASED SIZE */
.image-single {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.single-image {
    width: 100px; /* Increased from 80px */
    height: 100px; /* Increased from 80px */
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.image-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.item-title {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.2;
}

.item-sku, .item-quantity {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

/* Two image layout - INCREASED SIZE */
.image-grid-2 {
    display: flex;
    gap: 10px;
    margin-bottom: 0;
    width: 100%;
    overflow-x: auto; /* Allow horizontal scroll if needed */
    overflow-y: hidden;
}

.image-grid-2 img {
    width: 80px; /* Increased from 60px */
    height: 80px; /* Increased from 60px */
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

/* Three image layout - INCREASED SIZE */
.image-grid-3 {
    display: flex;
    gap: 8px;
    margin-bottom: 0;
    width: 100%;
    overflow-x: auto; /* Allow horizontal scroll if needed */
    overflow-y: hidden;
}

.image-grid-3 img {
    width: 70px; /* Increased from 50px */
    height: 70px; /* Increased from 50px */
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

/* Four+ image layout - INCREASED SIZE */
.image-grid-4 {
    display: flex;
    gap: 8px;
    margin-bottom: 0;
    align-items: center;
    width: 100%;
    overflow-x: auto; /* Allow horizontal scroll if needed */
    overflow-y: hidden;
}

.image-grid-4 img {
    width: 70px; /* Increased from 45px */
    height: 70px; /* Increased from 45px */
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.more-indicator {
    width: 70px; /* Increased from 45px */
    height: 70px; /* Increased from 45px */
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px; /* Increased from 12px */
    font-weight: 600;
    color: #374151;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

/* Item names for grid layouts */
.item-names {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.3;
    font-weight: 500;
}

/* Custom scrollbar for image grids */
.image-grid-2::-webkit-scrollbar,
.image-grid-3::-webkit-scrollbar,
.image-grid-4::-webkit-scrollbar {
    height: 4px;
}

.image-grid-2::-webkit-scrollbar-track,
.image-grid-3::-webkit-scrollbar-track,
.image-grid-4::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 2px;
}

.image-grid-2::-webkit-scrollbar-thumb,
.image-grid-3::-webkit-scrollbar-thumb,
.image-grid-4::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

.image-grid-2::-webkit-scrollbar-thumb:hover,
.image-grid-3::-webkit-scrollbar-thumb:hover,
.image-grid-4::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Image loading states */
.image-container img {
    transition: opacity 0.2s ease;
}

.image-container img[src=""] {
    opacity: 0;
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    .activity-item {
        border-radius: 12px;
        padding: 14px;
    }

    .single-image {
        width: 80px; /* Increased from 60px */
        height: 80px; /* Increased from 60px */
        border-radius: 10px;
    }

    .image-grid-2 img {
        width: 70px; /* Increased from 50px */
        height: 70px; /* Increased from 50px */
    }

    .image-grid-3 img {
        width: 60px; /* Increased from 40px */
        height: 60px; /* Increased from 40px */
    }

    .image-grid-4 img,
    .more-indicator {
        width: 60px; /* Increased from 35px */
        height: 60px; /* Increased from 35px */
    }

    .item-title {
        font-size: 13px;
    }

    .item-sku, .item-quantity, .item-names {
        font-size: 11px;
    }

    /* Ensure scrollable images on mobile */
    .image-grid-2,
    .image-grid-3,
    .image-grid-4 {
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
}

/* Dark mode support for images - DISABLED for clean white interface */
/*
@media (prefers-color-scheme: dark) {
    // All dark mode styles removed to ensure clean white background
}
*/

/* ===== INVOICE TIMELINE STYLES ===== */
.invoice-timeline {
    position: relative;
    padding-left: 4px;
}

.invoice-timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 4px;
    bottom: 4px;
    width: 1px;
    background: #e5e7eb;
}