/* public/assets/ui-buttons.css - Shared Button Component & Layout Styles */

/* 1. Base Shared Button Component (Mobile First: standard min-height 48px, compact min-height 44px) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    min-height: 48px;
    padding: 12px 18px;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    background-color: var(--primary, #2563eb);
    color: #ffffff;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
}

.btn:hover {
    background-color: var(--primary-hover, #1d4ed8);
    color: #ffffff;
    text-decoration: none;
}

.btn:focus-visible {
    outline: 2px solid var(--primary, #2563eb);
    outline-offset: 2px;
}

.btn:disabled,
.btn.is-disabled {
    opacity: 0.6;
    cursor: not-allowed !important;
    pointer-events: none;
}

/* 2. Color Variants */
.btn-primary {
    background-color: var(--primary, #2563eb);
    color: #ffffff;
    border-color: transparent;
}

.btn-primary:hover {
    background-color: var(--primary-hover, #1d4ed8);
}

.btn-secondary {
    background-color: var(--card-bg, #ffffff);
    color: var(--text, #1f2937);
    border-color: var(--border, #d1d5db);
}

.btn-secondary:hover {
    background-color: var(--table-header-bg, #f3f4f6);
    color: var(--text, #1f2937);
}

.btn-danger {
    background-color: var(--danger, #ef4444);
    color: #ffffff;
    border-color: transparent;
}

.btn-danger:hover {
    background-color: #dc2626;
    color: #ffffff;
}

/* 3. Size Variants */
/* Standard (default on mobile: min-height 48px) */
.btn-standard {
    min-height: 48px;
    padding: 12px 18px;
    font-size: 1rem;
}

/* Compact: space-dense areas (mobile min-height 44px) */
.btn-compact {
    min-height: 44px;
    padding: 8px 14px;
    font-size: 0.875rem;
    border-radius: 6px;
}

/* Icon variant: for icon-only action areas (mobile min 48x48px) */
.btn-icon {
    min-height: 48px;
    min-width: 48px;
    padding: 0;
    justify-content: center;
    border-radius: 6px;
}

/* Desktop PC Overrides (min-width: 1024px) */
@media (min-width: 1024px) {
    .btn,
    .btn-standard {
        min-height: 44px;
        padding: 10px 16px;
        font-size: 0.9375rem;
    }

    .btn-compact {
        min-height: 40px;
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    .btn-icon {
        min-height: 44px;
        min-width: 44px;
    }
}

/* 4. Parent Layout Helper Components (Separation of Button Component & Parent Layout) */
.btn-row,
.button-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-row-end,
.button-row-end {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
}

.btn-row-end > .btn,
.btn-row-end > form,
.button-row-end > .btn,
.button-row-end > form {
    width: calc((100% - 16px) / 2);
    min-width: 0;
    box-sizing: border-box;
}

.btn-row-end > form > *,
.button-row-end > form > * {
    width: 100%;
}

@media (max-width: 480px) {
    .btn-row-end > .btn,
    .btn-row-end > form,
    .button-row-end > .btn,
    .button-row-end > form {
        width: calc((100% - 12px) / 2);
    }
}

.btn-row-split {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: nowrap;
    width: 100%;
    box-sizing: border-box;
}

.btn-group-normal {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex: 1 1 0%;
    min-width: 0;
    justify-content: flex-end;
}

.btn-group-danger {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex: 1 1 0%;
    min-width: 0;
    margin-left: 0;
    justify-content: flex-start;
}

.btn-group-normal > *,
.btn-group-danger > * {
    width: 100%;
    min-width: 0;
}

.btn-group-normal form,
.btn-group-danger form {
    width: 100%;
    min-width: 0;
    display: flex;
    margin: 0;
    padding: 0;
}

.btn-group-normal form > *,
.btn-group-danger form > * {
    width: 100%;
    min-width: 0;
}

@media (max-width: 480px) {
    .btn-row-split {
        gap: 12px;
    }
}

/* Card & Form Footer Action Row Compact Layout in Mobile Landscape */
@media (orientation: landscape) and (max-height: 600px) {
    .card-action-buttons,
    .form-footer-actions {
        justify-content: flex-start !important;
        gap: 10px !important;
    }

    .card-action-buttons > .btn-group-normal,
    .card-action-buttons > .btn-group-danger,
    .card-action-buttons > .btn,
    .card-action-buttons > form,
    .form-footer-actions > .btn-group-normal,
    .form-footer-actions > .btn-group-danger,
    .form-footer-actions > .btn,
    .form-footer-actions > form {
        flex: 0 0 auto !important;
        width: 180px !important;
        max-width: 45% !important;
        min-width: 0 !important;
    }
}

.btn-grid-2,
.button-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
}

.btn-stack,
.button-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.btn-grow,
.button-grow {
    flex: 1 1 0%;
    min-width: 0;
}

.btn-full,
.button-full {
    width: 100%;
    display: flex;
}

