/* Mobile Responsive Styles for HOA Web Application */

/* Page Heading Responsive Margin - Apply to all h4 page headings */
.page-heading-mobile,
h4.mud-typography.mud-typography-h4.mud-typography-gutterbottom {
    margin-top: 3.5rem !important; /* mt-14 for mobile */
}

@media (min-width: 600px) {
    .page-heading-mobile,
    h4.mud-typography.mud-typography-h4.mud-typography-gutterbottom {
        margin-top: 1rem !important; /* mt-4 for larger screens */
    }
}

/* Day Name Abbreviations for Staff Schedule */
.full-day {
    display: none;
}

.short-day {
    display: block;
}

@media (min-width: 960px) {
    .full-day {
        display: block;
    }

    .short-day {
        display: none;
    }
}

/* Tax Documents Button Heights */
.mud-button-root .full-day,
.mud-button-root .short-day {
    line-height: 1.2;
}

.mud-button-root .full-day {
    display: block;
}

.mud-button-root .short-day {
    display: none;
}

@media (min-width: 960px) {
    .mud-button-root .full-day {
        display: block;
    }

    .mud-button-root .short-day {
        display: none;
    }
}

@media (max-width: 959px) {
    .mud-button-root .full-day {
        display: none;
    }

    .mud-button-root .short-day {
        display: block;
    }
}

/* Announcement Card Responsive Styles */
@media (max-width: 600px) {
    /* Fix announcement card headers */
    .announcement-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }

    .announcement-header > * {
        width: 100% !important;
    }

    /* Fix metadata section */
    .announcement-meta {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 4px !important;
    }

    /* Adjust icon sizes */
    .mud-icon-root {
        font-size: 1.25rem !important;
    }

    /* Fix card spacing */
    .mud-card-header {
        padding: 12px !important;
    }

    .mud-card-content {
        padding: 12px !important;
    }

    .mud-card-actions {
        padding: 8px 12px !important;
    }

    /* Typography adjustments */
    .mud-typography-h6 {
        font-size: 1rem !important;
        line-height: 1.3 !important;
    }

    .mud-typography-caption {
        font-size: 0.7rem !important;
    }

    /* Chip sizing */
    .mud-chip-small {
        height: 20px !important;
        font-size: 0.7rem !important;
    }
}

/* ========================================
   Table Toolbar Responsive Styles
   ======================================== */

/* Toolbar grid responsive */
.toolbar-grid {
    width: 100%;
    margin: 0 !important;
}

/* Fix MudTable toolbar to allow proper grid layout */
.mud-table-toolbar {
    display: block !important;
    padding: 16px !important;
    overflow: visible !important;
}

/* Mobile: Reduce toolbar padding */
@media (max-width: 600px) {
    .mud-table-toolbar {
        padding: 8px !important;
    }
}

/* Ensure toolbar items don't overflow */
.toolbar-grid .mud-grid-item {
    padding: 4px !important;
}

/* Make toolbar inputs full width within their grid cells */
.toolbar-grid .mud-input-control,
.toolbar-grid .mud-select {
    width: 100% !important;
}

/* Fix MudGrid items to prevent overlapping */
.mud-grid {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
}

.mud-grid-item {
    box-sizing: border-box;
}

/* Ensure all inputs and selects respect their container width */
.mud-input,
.mud-input-control,
.mud-select,
.mud-input-slot {
    max-width: 100%;
    box-sizing: border-box;
}

/* ========================================
   User Management Action Buttons
   ======================================== */

.user-mgmt-actions {
    width: 100%;
    display: flex !important;
}

/* Desktop: Show buttons in row, right-aligned */
@media (min-width: 960px) {
    .user-mgmt-actions {
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .action-btn-group {
        display: flex !important;
        flex-direction: row !important;
        gap: 8px;
    }

    .action-btn-secondary {
        min-width: 140px;
    }
}

/* Mobile: Stack everything vertically, centered */
@media (max-width: 959px) {
    .user-mgmt-actions {
        flex-direction: column !important;
        align-items: center !important;
        gap: 12px !important;
    }

    .user-mgmt-actions > h6,
    .user-mgmt-actions > .mud-typography-h6 {
        width: 100%;
        text-align: center;
    }

    .action-btn-group {
        width: 100%;
        display: flex !important;
        flex-direction: column !important;
        gap: 8px;
    }

    .action-btn-primary,
    .action-btn-secondary,
    .action-btn-group .mud-button-root,
    .action-btn-group .mud-file-upload,
    .action-btn-group .mud-file-upload .mud-button-root {
        width: 100% !important;
        max-width: 100% !important;
        min-width: auto !important;
    }

    /* Ensure button text wraps properly on small screens */
    .action-btn-group .mud-button-root {
        white-space: normal !important;
        height: auto !important;
        min-height: 36px !important;
        padding: 8px 16px !important;
    }

    /* Fix for MudFileUpload wrapper */
    .action-btn-group > .mud-file-upload {
        width: 100% !important;
    }
}

/* ========================================
   Table Action Buttons Alignment
   ======================================== */

/* Align all action buttons to the right in table cells */
.mud-table-cell[data-label="Actions"],
.mud-table td:last-child {
    text-align: right !important;
}

.mud-table-cell[data-label="Actions"] > div,
.mud-table td:last-child > div {
    display: flex !important;
    justify-content: flex-end !important;
    gap: 4px !important;
}

/* ========================================
   Validation Messages
   ======================================== */

.validation-message {
    color: #f44336;
    font-size: 0.75rem;
    margin-top: 4px;
    display: block;
}

/* ========================================
   Mobile Specific Overrides
   ======================================== */

@media (max-width: 600px) {
    /* Reduce container padding on mobile */
    .mud-container {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    /* Reduce card padding on mobile */
    .mud-card-content {
        padding: 8px !important;
    }

    /* Hide less important table columns on mobile */
    .mud-table-cell:nth-child(4),
    .mud-table-cell:nth-child(5) {
        display: none;
    }

    /* Smaller typography on mobile */
    .mud-typography-h4 {
        font-size: 1.5rem !important;
    }

    .mud-typography-h5 {
        font-size: 1.25rem !important;
    }

    /* Reduce icon size on mobile */
    .mud-icon-size-large {
        font-size: 2rem !important;
    }
}
