/* =========================================
   1. ANIMATIONS
   ========================================= */
@keyframes logoFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes formSlideIn {
    0% {
        opacity: 0;
        transform: translateX(100%);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   2. PAGE LAYOUTS & CONTAINERS
   ========================================= */
/* Split Layout (Login/Auth) */
.split-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
    background: var(--smg-bg-primary);
}

.logo-side {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--smg-space-8);
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.05) 0%, rgba(10, 10, 10, 1) 100%);
    border-right: 1px solid var(--smg-border-primary);
}

.form-side {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--smg-space-8);
}

.logo-section {
    opacity: 0;
    animation: logoFadeIn 1s ease-out forwards;
}

.form-section {
    opacity: 0;
    animation: formSlideIn 0.8s ease-out 1s forwards;
}

.smg-logo-container {
    text-align: center;
}

.smg-logo-img {
    max-width: 400px;
    width: 100%;
    height: auto;
}

/* Updates Page Layout */
.updates-page-wrapper {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 2rem;
    padding: 2rem;
    min-height: calc(100vh - 64px);
}

.desktop-filters {
    position: sticky;
    top: 2rem;
    height: fit-content;
}

.updates-content {
    max-width: 900px;
}

/* =========================================
   3. CALENDAR & TIMELINE GRID
   (High Contrast styling prioritized)
   ========================================= */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border: 1px solid #333; /* High contrast */
    background-color: #000; /* Pitch black */
}

.calendar-header-cell {
    background-color: #111;
    color: #FFF;
    padding: 1rem;
    text-align: center;
    font-weight: 700;
    font-size: 0.875rem;
    border-right: 1px solid #333;
    border-bottom: 1px solid #333;
    letter-spacing: 0.1em;
}

    .calendar-header-cell:last-child {
        border-right: none;
    }

.calendar-day-cell {
    min-height: 120px;
    background-color: #000;
    border-right: 1px solid #333;
    border-bottom: 1px solid #333;
    padding: 0.5rem;
    position: relative;
    transition: background-color 0.2s;
}

    .calendar-day-cell:nth-child(7n) {
        border-right: none;
    }

    .calendar-day-cell:hover {
        background-color: #0A0A0A;
    }

    .calendar-day-cell.dimmed {
        background-color: #050505;
        color: #444;
    }

        .calendar-day-cell.dimmed .day-number {
            color: #444;
        }

    .calendar-day-cell.active-day {
        background-color: rgba(22, 163, 74, 0.02);
    }

    .calendar-day-cell.today {
        background-color: #0F0F0F;
        box-shadow: inset 0 0 0 1px var(--smg-green-primary);
    }

.day-number {
    font-family: var(--smg-font-mono);
    font-size: 0.875rem;
    color: #FFF;
    margin-bottom: 0.5rem;
    display: block;
    text-align: right;
}

/* Calendar Content Elements */
.day-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    max-height: 80px;
}

.area-chip {
    background-color: var(--smg-green-primary);
    color: #FFF;
    padding: 2px 6px;
    font-size: 0.65rem;
    border-radius: 2px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    box-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.area-name {
    text-transform: uppercase;
}

/* Indicators (Kept from Timeline Styles) */
.day-indicators {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.indicator-success {
    background-color: var(--smg-success);
    box-shadow: 0 0 5px var(--smg-success);
}

.indicator-warning {
    background-color: var(--smg-warning);
    box-shadow: 0 0 5px var(--smg-warning);
}

.indicator-error {
    background-color: var(--smg-error);
    box-shadow: 0 0 5px var(--smg-error);
}

.indicator-info {
    background-color: var(--smg-info);
    box-shadow: 0 0 5px var(--smg-info);
}

.indicator-neutral {
    background-color: var(--smg-gray-400);
}

/* =========================================
   4. VERTICAL TIMELINE
   ========================================= */
.timeline-container {
    position: relative;
    padding-left: 20px;
    margin-top: 20px;
}

.timeline-item {
    display: flex;
    gap: 24px;
    margin-bottom: 32px;
    position: relative;
}

.timeline-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 20px;
}

.timeline-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--smg-black);
    z-index: 2;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

    .timeline-dot.indicator-success {
        background-color: var(--smg-success);
    }

    .timeline-dot.indicator-warning {
        background-color: var(--smg-warning);
    }

    .timeline-dot.indicator-error {
        background-color: var(--smg-error);
    }

    .timeline-dot.indicator-info {
        background-color: var(--smg-info);
    }

    .timeline-dot.indicator-neutral {
        background-color: var(--smg-gray-400);
    }

.timeline-line {
    width: 2px;
    flex-grow: 1;
    background: linear-gradient(to bottom, var(--smg-border-secondary) 50%, transparent 100%);
    margin-top: 4px;
}

.timeline-item:not(:last-child) .timeline-line {
    background: var(--smg-border-secondary);
}

.timeline-content {
    flex: 1;
}

.timeline-date {
    font-family: var(--smg-font-family);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--smg-white);
}

    .timeline-date::before {
        content: '';
        display: block;
        width: 8px;
        height: 2px;
        background-color: var(--smg-green-primary);
    }

.timeline-card {
    transition: transform 0.2s, border-color 0.2s;
    border-left: 3px solid transparent;
    background-color: rgba(255, 255, 255, 0.05);
}

    .timeline-card:hover {
        transform: translateX(4px);
        border-color: var(--smg-green-primary);
        border-left-color: var(--smg-green-primary);
    }

/* =========================================
   5. COMPONENTS & CARDS
   ========================================= */
/* Toggle Buttons */
.toggle-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--smg-gray-300);
    padding: 8px 12px;
    font-family: var(--smg-font-family);
    font-size: var(--smg-text-xs);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .toggle-btn:hover {
        color: var(--smg-white);
        background: rgba(255, 255, 255, 0.05);
    }

    .toggle-btn.active {
        background: var(--smg-green-primary);
        color: var(--smg-white);
        box-shadow: 0 0 10px rgba(22, 163, 74, 0.3);
    }

/* Area Cards */
.area-card {
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

    .area-card:hover {
        transform: translateY(-2px);
        border-color: var(--smg-green-primary);
        box-shadow: 0 0 15px rgba(22, 163, 74, 0.15);
    }

/* Update Cards */
.update-card {
    transition: all 0.2s ease;
    border-left: 2px solid var(--smg-border-secondary);
}

    .update-card:hover {
        transform: translateX(5px);
        border-left-color: var(--smg-green-primary);
        box-shadow: var(--smg-shadow-md);
    }

.update-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .update-icon.smg-text-success {
        background: rgba(22, 163, 74, 0.1);
    }

    .update-icon.smg-text-warning {
        background: rgba(234, 179, 8, 0.1);
    }

    .update-icon.smg-text-error {
        background: rgba(220, 38, 38, 0.1);
    }

    .update-icon.smg-text-muted {
        background: rgba(115, 115, 115, 0.1);
    }

/* Location Tags */
.location-tag {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid var(--smg-border-secondary);
    font-size: 0.75rem;
    color: var(--smg-gray-300);
    letter-spacing: 0.05em;
}

.location-icon {
    font-size: 14px;
    margin-right: 6px;
    color: var(--smg-green-primary);
}

.location-separator {
    margin: 0 6px;
    color: var(--smg-gray-500);
}

.area-highlight {
    color: var(--smg-white);
    font-weight: 700;
}

.smg-inline-icon {
    margin-bottom: -2px;
    margin-right: 2px;
}

/* =========================================
   6. ATTACHMENTS & LIGHTBOX
   ========================================= */
.attachment-thumb {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    border-radius: 4px;
    border: 1px solid var(--smg-border-secondary);
    cursor: pointer;
    background: var(--smg-bg-tertiary);
}

    .attachment-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.3s ease;
    }

.attachment-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.attachment-thumb:hover img {
    transform: scale(1.05);
}

.attachment-thumb:hover .attachment-overlay {
    opacity: 1;
}

.image-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: bold;
    border-radius: 2px;
    z-index: 5;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-before {
    background: var(--smg-warning);
    color: var(--smg-black);
}

.badge-after {
    background: var(--smg-success);
    color: var(--smg-white);
}

.badge-neutral {
    background: rgba(0, 0, 0, 0.6);
    color: var(--smg-white);
    border: 1px solid var(--smg-border-primary);
}

/* Lightbox */
.lightbox-container {
    background: var(--smg-bg-secondary);
    border: 1px solid var(--smg-green-primary);
    padding: 20px;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.lightbox-image-wrapper {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

/* =========================================
   7. DIALOGS & MOBILE DRAWERS
   ========================================= */
.update-dialog-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--smg-space-4);
    animation: fadeIn 0.3s ease;
}

.update-dialog-content {
    background: var(--smg-bg-secondary);
    border: 1px solid var(--smg-border-primary);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
    position: relative;
}

/* Mobile Filter Drawer */
.mobile-filter-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
}

.mobile-filter-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    height: 100vh;
    background: var(--smg-bg-secondary);
    border-left: 1px solid var(--smg-border-primary);
    z-index: 1001;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}

    .mobile-filter-drawer.open {
        transform: translateX(0);
    }

/* Mobile FAB */
.mobile-filter-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--smg-green-primary);
    border: 2px solid var(--smg-green-light);
    color: var(--smg-white);
    box-shadow: 0 4px 20px rgba(22, 163, 74, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: all 0.3s ease;
}

    .mobile-filter-fab:hover {
        transform: scale(1.1);
        box-shadow: 0 6px 30px rgba(22, 163, 74, 0.6);
    }

    .mobile-filter-fab:active {
        transform: scale(0.95);
    }

/* =========================================
   8. MEDIA QUERIES (CONSOLIDATED)
   ========================================= */

/* Hide FAB on Desktop */
@media (min-width: 769px) {
    .mobile-filter-fab {
        display: none !important;
    }
}

/* Tablet / Logo Screen Adjustments */
@media (max-width: 1023px) {
    .split-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .logo-side {
        padding: var(--smg-space-6) var(--smg-space-4);
        border-right: none;
        border-bottom: 1px solid var(--smg-border-primary);
    }

    .smg-logo-img {
        max-width: 300px;
    }

    .form-side {
        padding: var(--smg-space-6) var(--smg-space-4);
    }
}

/* Mobile (Phablet/Phone) - Main Breakpoint */
@media (max-width: 768px) {
    /* Calendar Mobile */
    .calendar-day-cell {
        min-height: 80px; /* Merged: used high-contrast preference */
        padding: 0.25rem;
    }

    .day-number {
        font-size: 0.75rem;
        margin-bottom: 2px;
    }

    .area-chip {
        font-size: 0.55rem;
        padding: 1px 4px;
    }

    .calendar-header-cell {
        padding: 0.5rem 0.25rem;
        font-size: 0.65rem;
    }

    .indicator-dot {
        width: 6px;
        height: 6px;
        margin: 1px;
    }

    /* Month Navigation */
    .smg-month-nav {
        justify-content: space-between;
        width: 100%;
    }

    .month-label {
        font-size: 1rem !important;
        min-width: auto !important;
    }

    /* Timeline Mobile */
    .timeline-item {
        gap: 12px;
    }

    .timeline-content {
        width: 100%;
    }

    /* Page Layout Mobile */
    .updates-page-wrapper {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    .smg-grid-cols-2-mobile {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Specific Utility Mobile Overrides */
    /*.smg-flex.smg-justify-center {
        padding: 380px 20px 20px 20px !important;
        flex-direction: column;
        justify-content: flex-start;
    }*/

    .smg-grid-cols-3 {
        grid-template-columns: 1fr;
    }

    /* Dialog Mobile */
    .update-dialog-content {
        max-width: 95%;
        max-height: 95vh;
    }
}

/* Small Mobile */
@media (max-width: 639px) {
    .logo-side {
        padding: var(--smg-space-4) var(--smg-space-3);
    }

    .smg-logo-img {
        max-width: 250px;
    }

    .form-side {
        padding: var(--smg-space-4) var(--smg-space-3);
    }
}
