@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

* {
    font-family: "poppins" !important;
}

.content-area{
    min-height: calc(100vh - 120px);
}


.send-invoice-dialog-content {
    min-width: 32rem !important;
}

.user-menu-container .mud-menu-item-text {
    display: flex !important;
    align-items: center !important;
}


.signup-here-button:hover {
    background-color: var(--mud-palette-primary) !important;
    color: white !important;
}

.signup-here-button:hover .mud-button-label {
    color: white !important;
}

.auth-card {
    border-radius: 16px;
    margin-top: 2.5rem;
}


.mud-button-filled.mud-button-filled-primary.si-close-btn {
    background: var(--mud-palette-background) !important;
    color: var(--mud-palette-primary) !important;
}

.mud-button-filled.mud-button-filled-primary.si-close-btn:hover {
    color: var(--mud-palette-background) !important;
    background: var(--mud-palette-primary) !important;
}

.feature-coming-soon{
    width: 60%;
    margin-bottom: 0.5rem;

}

.header-wrapper{
    height: 140px;
}
/* Mobile-specific font sizing for better mobile UX */
@media (max-width: 768px) {
    /* Reduce base font sizes on mobile - keep readable */
    body {
        font-size: 18px !important;
        line-height: 1.4 !important;
    }

    .header-wrapper{
        height: 105px;
    }

    .feature-coming-soon{
        width: 100%;
    }

    .items-table .mud-table-cell{
        padding-left: 0 !important;
        margin: 0 !important;
    }

    .auth-card {
        margin-top: 5rem;
    }

    .auth-card .mud-alert-message {
        margin-left: -2rem;
        word-break: break-word;
    }

    .items-table .mud-table-cell .d-flex{
        width: 100%
    }

    .content-area {
        min-height: calc(100vh - 80px);
        margin-top: -1rem;
    }
    
    /* Auth Dialog Mobile Styles */
    .auth-dialog-container {
        padding: 1rem !important;
    }
    
    .auth-dialog-container .mud-dialog-content {
        padding: 1rem !important;
    }
    
    .auth-dialog-container .mud-text-field {
        margin-bottom: 1rem !important;
    }
    
    .auth-dialog-container .mud-button.d-sm-none {
        margin-bottom: 0.5rem !important;
    }
    
    .auth-dialog-container .mud-card {
        margin-bottom: 1rem !important;
    }
    
    /* Reduce MudBlazor component font sizes on mobile - keep readable */
    .mud-typography-h1 {
        font-size: 1.875rem !important;
        line-height: 1.3 !important;
    }
    
    .mud-typography-h2 {
        font-size: 1.625rem !important;
        line-height: 1.3 !important;
    }
    
    .mud-typography-h3 {
        font-size: 1.375rem !important;
        line-height: 1.3 !important;
    }
    
    .mud-typography-h4 {
        font-size: 1.25rem !important;
        line-height: 1.3 !important;
    }
    
    .mud-typography-h5 {
        font-size: 1.125rem !important;
        line-height: 1.3 !important;
    }
    
    .mud-typography-h6 {
        font-size: 1rem !important;
        line-height: 1.3 !important;
    }
    
    .mud-typography-body1 {
        font-size: 1.125rem !important;
        line-height: 1.4 !important;
    }
    
    .mud-typography-body2 {
        font-size: 1rem !important;
        line-height: 1.4 !important;
    }
    
    .mud-typography-subtitle1 {
        font-size: 1.125rem !important;
        line-height: 1.3 !important;
    }
    
    .mud-typography-subtitle2 {
        font-size: 1rem !important;
        line-height: 1.3 !important;
    }
    
    /* Reduce button font sizes on mobile - keep readable */
    .mud-button {
        font-size: 1rem !important;
    }
    
    /* Reduce input field font sizes on mobile - keep readable */
    .mud-text-field .mud-input-root .mud-input-slot .mud-input,
    .mud-text-field .mud-input-root .mud-input-slot .mud-input-label,
    .mud-text-field .mud-input-root .mud-input-slot .mud-input-helper-text {
        font-size: 1rem !important;
    }
    
    /* Reduce table font sizes on mobile */
    .mud-table .mud-table-head .mud-th,
    .mud-table .mud-table-body .mud-td {
        font-size: 1rem !important;
    }
    
    /* Reduce navigation tab font sizes on mobile */
    .navigation-container .mud-button {
        font-size: 1rem !important;
        padding: 0.5rem 1rem !important;
    }
    
    /* Reduce mobile drawer font sizes */
    .mud-drawer .mud-nav-link {
        font-size: 0.8rem !important;
    }
    
    /* Reduce template card text sizes */
    .template-card .mud-text {
        font-size: 1rem !important;
    }
    
    /* Mobile form sizing - make forms more compact while keeping readable */
    .mud-text-field {
        margin-bottom: 0.75rem !important;
    }
    
    .mud-text-field .mud-input-root {
        min-height: 44px !important;
        max-height: 44px !important;
    }
    
    .mud-text-field .mud-input-root .mud-input-slot .mud-input {
        padding: 0.625rem 0.875rem !important;
        min-height: 44px !important;
        max-height: 44px !important;
        font-size: 1rem !important;
    }
    
    .mud-text-field .mud-input-root .mud-input-slot .mud-input-label {
        font-size: 1rem !important;
        transform: translateY(-0.5rem) !important;
    }
    
    .mud-text-field .mud-input-root .mud-input-slot .mud-input-label.mud-floating {
        transform: translateY(-1.25rem) scale(0.8) !important;
    }
    
    /* Reduce textarea heights on mobile - make more compact */
    .mud-input-control .mud-input-root .mud-input-slot .mud-input {
        min-height: 60px !important;
        max-height: 80px !important;
        padding: 0.625rem 0.875rem !important;
        font-size: 1rem !important;
    }
    
    /* Reduce button heights on mobile - keep touch-friendly */
    .mud-button {
        height: 40px !important;
        min-height: 40px !important;
        padding: 0.375rem 0.875rem !important;
        font-size: 1rem !important;
    }
    
    .mud-button.mud-button-size-large {
        height: 44px !important;
        min-height: 44px !important;
        padding: 0.5rem 1rem !important;
    }
    
    /* Reduce form spacing on mobile - make more compact */
    .mb-4 {
        margin-bottom: 1.25rem !important;
    }
    
    .mb-3 {
        margin-bottom: 1rem !important;
    }
    
    .mb-2 {
        margin-bottom: 0.75rem !important;
    }
    
    .mb-1 {
        margin-bottom: 0.5rem !important;
    }
    
    /* Reduce upload area heights on mobile - make more compact */
    .upload-area {
        height: 70px !important;
        min-height: 70px !important;
    }
    
    /* Reduce template card heights on mobile - make more compact */
    .template-card {
        height: 3.5rem !important;
        min-height: 3.5rem !important;
        min-width: 5.5rem !important;
    }
    
    /* Reduce form section spacing - make more compact */
    .mud-stack > div {
        margin-bottom: 1rem !important;
    }
    
    /* Reduce numeric field heights on mobile */
    .mud-numeric-field .mud-input-root {
        min-height: 44px !important;
        max-height: 44px !important;
    }
    
    .mud-numeric-field .mud-input-root .mud-input-slot .mud-input {
        padding: 0.625rem 0.875rem !important;
        min-height: 44px !important;
        max-height: 44px !important;
        font-size: 1rem !important;
    }
    
    /* Reduce select field heights on mobile */
    .mud-select .mud-input-root {
        min-height: 44px !important;
        max-height: 44px !important;
    }
    
    .mud-select .mud-input-root .mud-input-slot .mud-input {
        padding: 0.625rem 0.875rem !important;
        min-height: 44px !important;
        max-height: 44px !important;
        font-size: 1rem !important;
    }
    
    /* Reduce date picker heights on mobile */
    .mud-date-picker .mud-input-root {
        min-height: 44px !important;
        max-height: 44px !important;
    }
    
    .mud-date-picker .mud-input-root .mud-input-slot .mud-input {
        padding: 0.625rem 0.875rem !important;
        min-height: 44px !important;
        max-height: 44px !important;
        font-size: 1rem !important;
    }
    
    /* Reduce form group spacing */
    .mud-form-field {
        margin-bottom: 1rem !important;
    }
    
    /* Reduce input adornment sizes */
    .mud-input-adornment {
        height: 44px !important;
        min-height: 44px !important;
    }
    
    .mud-input-adornment .mud-icon-button {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important;
    }
    
    /* Make form sections more compact */
    .mud-paper.pa-6 {
        padding: 1.5rem !important;
    }
    
    /* Reduce spacing between form elements */
    .mud-stack {
        gap: 0.75rem !important;
    }
    
    /* Make form headings more compact */
    .mud-typography-h6.mb-2 {
        margin-bottom: 0.5rem !important;
    }
    
    /* Reduce spacing in form rows */
    .d-flex.gap-4 {
        gap: 1rem !important;
    }
    
    /* Make currency selector more compact */
    .mud-select .mud-input-root .mud-input-slot .mud-input {
        padding: 0.5rem 0.75rem !important;
    }
    
    /* Make quantity spinner more compact */
    .mud-numeric-field .mud-input-root .mud-input-slot .mud-input {
        padding: 0.5rem 0.75rem !important;
    }

    /*mud inputs*/

    .mud-input *, .mud-input-label {
        font-size: 0.7rem !important;
    }

    .mud-input {
        max-height: 3rem !important;
    }

        .mud-input:has(textarea) {
            max-height: 6rem !important;
            padding-top: 0.8rem;
        }

    .mud-input-numeric-spin {
        display: none !important;
    }

    .mud-input-root {
        margin: auto !important;    
    }

    .mud-table-cell:before {
        visibility: hidden;
        width: 0.2rem
    }

    .send-invoice-dialog-content {
        padding-left: 0 !important;
        padding-right: 0 !important;
        min-width: 17rem !important;
    }

    .total-section{
        position: relative !important;
        width: 100%;
    }

    /* Floating manage button mobile positioning */
    .floating-manage-button {
        bottom: 115px !important;
    }

}

/* Extra small mobile devices */
@media (max-width: 480px) {
    body {
        font-size: 12px !important;
        line-height: 1.3 !important;
    }
    
    .mud-typography-h1 {
        font-size: 1.25rem !important;
    }
    
    .mud-typography-h2 {
        font-size: 1.125rem !important;
    }
    
    .mud-typography-h3 {
        font-size: 1rem !important;
    }
    
    .mud-typography-h4 {
        font-size: 0.875rem !important;
    }
    
    .mud-typography-h5 {
        font-size: 0.75rem !important;
    }
    
    .mud-typography-h6 {
        font-size: 0.625rem !important;
    }
    
    .mud-typography-body1 {
        font-size: 0.75rem !important;
    }
    
    .mud-typography-body2 {
        font-size: 0.625rem !important;
    }
    
    .mud-button {
        font-size: 0.625rem !important;
    }
    
    .mud-text-field .mud-input-root .mud-input-slot .mud-input,
    .mud-text-field .mud-input-root .mud-input-slot .mud-input-label,
    .mud-text-field .mud-input-root .mud-input-slot .mud-input-helper-text {
        font-size: 0.625rem !important;
    }
    
    /* Extra small mobile form sizing */
    .mud-text-field .mud-input-root {
        min-height: 36px !important;
        max-height: 36px !important;
    }
    
    .mud-text-field .mud-input-root .mud-input-slot .mud-input {
        padding: 0.375rem 0.5rem !important;
        min-height: 36px !important;
        max-height: 36px !important;
        font-size: 0.625rem !important;
    }
    
    .mud-text-field .mud-input-root .mud-input-slot .mud-input-label {
        font-size: 0.625rem !important;
        transform: translateY(-0.375rem) !important;
    }
    
    .mud-text-field .mud-input-root .mud-input-slot .mud-input-label.mud-floating {
        transform: translateY(-1.125rem) scale(0.7) !important;
    }
    
    /* Reduce textarea heights even more on very small screens */
    .mud-input-control .mud-input-root .mud-input-slot .mud-input {
        min-height: 60px !important;
        max-height: 80px !important;
        padding: 0.375rem 0.5rem !important;
        font-size: 0.625rem !important;
    }
    
    /* Reduce button heights on very small screens */
    .mud-button {
        height: 32px !important;
        min-height: 32px !important;
        padding: 0.25rem 0.5rem !important;
        font-size: 0.625rem !important;
    }
    
    .mud-button.mud-button-size-large {
        height: 36px !important;
        min-height: 36px !important;
        padding: 0.25rem 0.75rem !important;
    }
    
    /* Reduce form spacing even more on very small screens */
    .mb-4 {
        margin-bottom: 0.75rem !important;
    }
    
    .mb-3 {
        margin-bottom: 0.5rem !important;
    }
    
    .mb-2 {
        margin-bottom: 0.375rem !important;
    }
    
    .mb-1 {
        margin-bottom: 0.25rem !important;
    }
    
    /* Reduce upload area heights on very small screens */
    .upload-area {
        height: 60px !important;
        min-height: 60px !important;
    }
    
    /* Reduce template card heights on very small screens */
    .template-card {
        height: 3rem !important;
        min-height: 3rem !important;
        min-width: 5rem !important;
    }
    
    /* Reduce form section spacing on very small screens */
    .mud-stack > div {
        margin-bottom: 0.5rem !important;
    }
    
    /* Reduce numeric field heights on very small screens */
    .mud-numeric-field .mud-input-root {
        min-height: 36px !important;
        max-height: 36px !important;
    }
    
    .mud-numeric-field .mud-input-root .mud-input-slot .mud-input {
        padding: 0.375rem 0.5rem !important;
        min-height: 36px !important;
        max-height: 36px !important;
        font-size: 0.625rem !important;
    }
    
    /* Reduce select field heights on very small screens */
    .mud-select .mud-input-root {
        min-height: 36px !important;
        max-height: 36px !important;
    }
    
    .mud-select .mud-input-root .mud-input-slot .mud-input {
        padding: 0.375rem 0.5rem !important;
        min-height: 36px !important;
        max-height: 36px !important;
        font-size: 0.625rem !important;
    }
    
    /* Reduce date picker heights on very small screens */
    .mud-date-picker .mud-input-root {
        min-height: 36px !important;
        max-height: 36px !important;
    }
    
    .mud-date-picker .mud-input-root .mud-input-slot .mud-input {
        padding: 0.375rem 0.5rem !important;
        min-height: 36px !important;
        max-height: 36px !important;
        font-size: 0.625rem !important;
    }
    
    /* Reduce form group spacing on very small screens */
    .mud-form-field {
        margin-bottom: 0.5rem !important;
    }
    
    /* Reduce input adornment sizes on very small screens */
    .mud-input-adornment {
        height: 36px !important;
        min-height: 36px !important;
    }
    
    .mud-input-adornment .mud-icon-button {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        min-height: 28px !important;
    }

    .templates-dialog .mud-paper {
        width: 70%;
        padding: 0;
        margin: 0;
        margin-left: -1rem;
    }

    .mud-dialog.send-invoice-dialog {
        zoom: 0.8;
    }
}

/* Document Type Pills Styles */
.document-type-pills-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 600px;
}

/* Table Document Type Pills */
.document-type-pill-table {
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.document-type-pill-table:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15) !important;
}


/* Responsive dialog width */
.mud-dialog-container {
    max-width: 70vw !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

@media (max-width: 768px) {
    .mud-dialog-container {
        max-width: 90vw !important;
    }

    .mud-dialog{
        margin-left: 10% !important;
    }
}

.templates-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
    padding: 1.5rem;
}

@media (min-width: 768px) {
    .templates-grid-container {
        grid-template-columns: repeat(4, 1fr);
        max-width: 1200px;
        margin: 0 auto;
    }

}

.template-grid-card {
    display: flex;
    flex-direction: column;
    min-height: 180px;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.template-grid-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

.template-card-footer {
    padding: 0.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.5rem;
}

.template-name {
    font-weight: 500;
    text-align: center;
    word-break: break-word;
    line-height: 1.2;
}

/* Show More Templates Button */
.show-more-templates-button {
    transition: all 0.3s ease;
}

.show-more-templates-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Show More Templates Button */
.show-more-card {
    border: 2px dashed var(--mud-palette-primary) !important;
    background-color: rgba(var(--mud-palette-primary-rgb, 25, 118, 210), 0.05) !important;
}

.show-more-card:hover {
    background-color: rgba(var(--mud-palette-primary-rgb, 25, 118, 210), 0.1) !important;
    transform: scale(1.02);
    border-color: var(--mud-palette-primary-hover) !important;
}

.document-type-pills-row {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-start;
}

.document-type-pill {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-align: center;
    min-width: 80px;
    user-select: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.document-type-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.document-type-pill.selected {
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Mobile Document Type Pills */
.document-type-pills-container-mobile {
    width: 100%;
}

.document-type-pill-mobile {
    padding: 0.75rem 1rem;
    border-radius: 16px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-align: center;
    user-select: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.document-type-pill-mobile:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.document-type-pill-mobile.selected {
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Status Checkbox Styling */
.status-checkbox {
    margin: 0;
}

.status-checkbox .mud-checkbox {
    margin: 0;
}

.status-checkbox .mud-checkbox .mud-checkbox-input {
    margin: 0;
}

.status-checkbox .mud-checkbox .mud-checkbox-label {
    margin-left: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Make checkboxes look more like radio buttons */
.status-checkbox .mud-checkbox .mud-checkbox-input .mud-checkbox-input-root {
    border-radius: 50%;
}

.status-checkbox .mud-checkbox .mud-checkbox-input .mud-checkbox-input-root:checked {
    background-color: var(--mud-palette-primary);
    border-color: var(--mud-palette-primary);
}

/* Responsive adjustments for pills */
@media (max-width: 768px) {
    .document-type-pills-container {
        min-width: auto;
        width: 100%;
    }

    
    .document-type-pills-row {
        justify-content: space-between;
    }
    
    .document-type-pill {
        flex: 1;
        min-width: 0;
        padding: 0.5rem 0.25rem;
        font-size: 0.65rem;
    }
}

/* ===== SOCIAL SIGN-IN BUTTONS STYLING ===== */
/* Social Sign-In Buttons */
.social-signin-container {
    text-align: center;
    margin: 20px 0;
}

.divider-container {
    position: relative;
    display: flex;
    align-items: center;
    margin: 20px 0;
}

.divider-container .mud-divider {
    flex: 1;
}

.divider-text {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 0 16px;
    color: #666;
    font-size: 14px;
    white-space: nowrap;
}

.social-signin-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.provider-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 48px;
}

.provider-button:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: #d0d0d0;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.provider-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Provider button styles removed - using default MudBlazor styles */

.provider-icon {
    width: 20px;
    height: 20px;
    color: #666;
}

.provider-text {
    font-weight: 500;
}

.social-signin-footer {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

.social-signin-footer a {
    color: #4285F4;
    text-decoration: none;
}

.social-signin-footer a:hover {
    text-decoration: underline;
}

.total-section {
    background: var(--mud-palette-background);
    position: fixed;
    bottom: 0;
    width: 58%;
    height: 4rem;
    z-index: 50;
}

/* Responsive Design */
@media (max-width: 480px) {
    .provider-button {
        padding: 10px 14px;
        font-size: 13px;
        min-height: 44px;
    }
    
    .provider-icon {
        width: 18px;
        height: 18px;
    }

    .templates-grid-container{
        overflow-x: hidden;
    }
}

/* App Version Display */
.app-version-display {
    position: fixed;
    bottom: 8px;
    right: 12px;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 4px 8px;
    border-radius: 4px;
    backdrop-filter: blur(4px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    pointer-events: none;
}

.mud-dialog{
    margin-left: 30%;
}

@media (max-width: 1200px) {
    .navigation-container {
        zoom: 0.7 !important;
        margin-top: 2rem !important;
        height: 110px;
    }

    .navigation-container > div{
        margin-top: 1rem;
    }

    .mud-dialog.send-invoice-dialog {
        zoom: 0.8;
    }

}

@media (max-width: 1600px) {
    .document-type-pills-container {
        zoom: 0.8;
    }

    .right-panel-header {
        zoom: 0.8;
    }

}

/* ===== TEMPLATES PAGE STYLES ===== */
.templates-page {
    min-height: 100vh;
}

.hero-image-section {
    width: 100%;
    text-align: center;
}

.hero-image {
    width: 100%;
    max-width: 800px;
    height: 300px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: var(--mud-elevation-4);
}

.mud-icon-button.templates-preview-button {
    background-color: var(--mud-palette-primary) !important;
    color: var(--mud-palette-primary-hover) !important;
    border-radius: 0 50% 50% 0 !important;
    width: 32px;
    height: 40px;
    min-width: 32px;
    min-height: 40px;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.12);
    border: 1px solid var(--mud-palette-primary);
    margin: 0;
    padding: 0;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mud-icon-button.templates-preview-button:hover {
    background-color: var(--mud-palette-primary) !important;
    border-color: var(--mud-palette-primary-hover) !important;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

@media (max-width: 768px) {
    .templates-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .templates-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}
/* Tune once for your design */
:root {
    --tpl-card-h: 28rem; /* total card height */
    --tpl-preview-h: 20rem; /* image area height (keep consistent) */
    --tpl-footer-h: calc(var(--tpl-card-h) - var(--tpl-preview-h)); /* footer height */
}

/* Make the card a vertical layout with fixed sections */
.template-card {
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    height: var(--tpl-card-h);
    width: 100% !important;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-direction: column;
}

/* Fix preview image area so footer always starts at same Y */
.template-preview-image {
    width: 100%;
    height: var(--tpl-preview-h);
    object-fit: cover;
    display: block;
}

/* Footer is a fixed-height flex column (no absolute children) */
.template-card-footer {
    height: var(--tpl-footer-h);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.25rem;
    margin-top: -1rem;
    background: linear-gradient(135deg, var(--mud-palette-surface) 0%, rgba(var(--mud-palette-primary-rgb), 0.02) 100%);
    border-top: 1px solid rgba(var(--mud-palette-primary-rgb), 0.1);
    position: relative;
    overflow: hidden;
}

    /* Decorative line stays */
    .template-card-footer::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 2px;
        background: linear-gradient(90deg, var(--mud-palette-primary), var(--mud-palette-secondary));
        opacity: .6;
    }

/* Header stays compact */
.template-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: .5rem;
    gap: .5rem;
}

.template-name {
    font-weight: 600 !important;
    color: var(--mud-palette-text-primary);
    margin: 0;
    line-height: 1.3;
}

/* Reserve exactly two lines of height for description */
.template-description {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
    min-height: calc(2 * 1.35em); /* forces consistent height */
    margin-top: .25rem;
}

/* Actions sit at the bottom consistently */
.template-actions {
    margin-top: auto; /* push to bottom of footer */
    display: flex;
    justify-content: center;
    gap: .5rem;
    /* no absolute positioning */
}

.template-action-btn {
    flex: 1;
    font-weight: 500;
    text-transform: none;
    border-radius: 6px;
    transition: all .2s ease;
}

.use-template-btn {
    width: 100%;
    max-width: 220px;
    margin: 0 auto;
}

.template-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(var(--mud-palette-primary-rgb), .3);
}



/* Dark theme adjustments */
[data-theme="dark"] .template-card-footer {
    background: linear-gradient(135deg, var(--mud-palette-surface) 0%, rgba(var(--mud-palette-primary-rgb), 0.05) 100%);
    border-top-color: rgba(var(--mud-palette-primary-rgb), 0.2);
}

[data-theme="dark"] .feature-icon {
    opacity: 0.9;
}

[data-theme="dark"] .feature-text {
    color: var(--mud-palette-text-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .template-card-footer {
        padding: 1rem;
        justify-content: flex-start;
        gap: 0;
        height: fit-content;
    }
    
    .template-header {
        align-items: flex-start;
        gap: 0.5rem;
        margin-bottom: 0;
        align-items: center;
    }
    
    .template-features {
        gap: 0.5rem;
        margin-top: -0.5rem;
    }
    
    .template-feature-item {
        justify-content: flex-start;
    }
    
    .template-actions {
        position: absolute;
        bottom: 0.2rem;
        left: 50%;
        transform: translateX(-50%);
        width: 10rem;
        justify-content: center;
    }
    
    .use-template-btn {
        width: 100%;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .template-name {
        font-size: 0.875rem;
    }
    
    .feature-text {
        font-size: 0.6875rem;
    }
}

.template-preview-image {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    object-fit: fill;
    height: 350px !important;
    border-radius: 8px 8px 0 0;
    transition: opacity 0.3s ease;
}

.template-card:hover .template-preview-image,
.template-card:hover .template-preview-loading {
    opacity: 0.7;
}

.template-preview-loading {
    height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--mud-palette-surface);
    border-radius: 8px 8px 0 0;
    flex-direction: column;
    gap: 8px;
    transition: opacity 0.3s ease;
}

@media (max-width: 768px) {
    .template-preview-image,
    .template-preview-loading {
        height: 250px !important;
    }
    
    .template-card {
        height: 100% !important;
    }
}

/* Templates Slider Styles */
.templates-fixed-icon {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 0 24px 24px 0;
    background-color: var(--mud-palette-primary);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1001;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--mud-palette-primary-darken);
    border-left: none;
}

.templates-fixed-icon:hover {
    background-color: var(--mud-palette-primary-darken);
    transform: translateY(-50%) scale(1.05);
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.2);
    left: 2px;
}

.templates-icon {
    font-size: 24px;
    transition: transform 0.3s ease;
}

.templates-icon.rotated {
    transform: rotate(180deg);
}

.templates-slider-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1010;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.templates-slider-overlay.active {
    opacity: 1;
    visibility: visible;
}

.templates-slider {
    position: fixed;
    top: 0;
    left: -90%;
    width: 90%;
    height: 100vh;
    background-color: white;
    z-index: 1011;
    transition: left 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.templates-slider.active {
    left: 0;
}

.templates-slider-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    background-color: #f8fafc;
    flex-shrink: 0;
}

.templates-slider-close-btn {
    background-color: #d4d4d8 !important;
    border-radius: 50% !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 700 !important;
}

.templates-slider-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Mobile adjustments for templates slider */
@media (max-width: 768px) {
    .templates-slider {
        width: 100%;
        left: -100%;
    }

    .templates-slider-content div:first-child{
        padding: 0.2rem !important;
    }

    .templates-fixed-icon {
        width: 40px;
        height: 40px;
        left: 0;
        border-radius: 0 20px 20px 0;
    }
    
    .templates-fixed-icon:hover {
        left: 1px;
    }
    
    .templates-icon {
        font-size: 20px;
    }
}


