/* Shared layout, missing utility fallbacks, and accessible modal/drawer polish.
   Supplements the precompiled Tailwind bundle (styles.css). */

/* Ensure sticky footer & full-viewport layout across all pages */
.min-h-screen {
    min-height: 100vh;
    min-height: 100dvh;
}

.flex-grow {
    flex-grow: 1;
}

.justify-end {
    justify-content: flex-end;
}

.p-1\.5 {
    padding: 0.375rem;
}

.pt-6 {
    padding-top: 1.5rem;
}

.tracking-wider {
    letter-spacing: 0.05em;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.bg-primary\/10 {
    background-color: hsl(var(--primary) / 0.1);
}

.bg-secondary\/50 {
    background-color: hsl(var(--secondary) / 0.5);
}

.border-primary\/20 {
    border-color: hsl(var(--primary) / 0.2);
}

.bg-red-500\/10 {
    background-color: rgb(239 68 68 / 0.1);
}

.text-red-600 {
    color: rgb(220 38 38);
}

.border-red-500\/20 {
    border-color: rgb(239 68 68 / 0.2);
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bg-background\/95 {
    background-color: hsl(var(--background) / 0.96);
}

.bg-black\/60 {
    background-color: rgb(0 0 0 / 0.6);
}

.backdrop-blur-sm {
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.hover\:bg-foreground\/5:hover {
    background-color: hsl(var(--foreground) / 0.05);
}

@media (min-width: 768px) {
    .md\:p-8 {
        padding: 2rem;
    }
}

/* Prevent header brand crowding on ultra-small screens (320px-374px) */
@media (max-width: 374px) {
    header .stretch-narrow {
        font-size: 0.65rem;
        letter-spacing: 0.12em;
    }
}

/* Lock background scroll when mobile drawer or modal is open */
body.modal-open {
    overflow: hidden;
}

/* Accessible focus rings */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid hsl(var(--primary));
    outline-offset: 2px;
}

/* High-contrast modal dialog styling (warm paper card + dark charcoal ink) */
.modal-card {
    position: relative;
    width: 100%;
    max-width: 32rem;
    border-radius: 1rem;
    border: 1px solid hsl(var(--card-foreground) / 0.18);
    background-color: hsl(var(--card));
    color: hsl(var(--card-foreground));
    padding: 1.5rem;
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.45);
}

@media (min-width: 768px) {
    .modal-card {
        padding: 2rem;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1rem;
    border-bottom: 1px solid hsl(var(--card-foreground) / 0.14);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: hsl(var(--card-foreground));
}

.modal-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    padding: 0.375rem;
    color: hsl(var(--card-foreground) / 0.7);
    background: transparent;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.modal-close-btn:hover {
    background-color: hsl(var(--card-foreground) / 0.08);
    color: hsl(var(--card-foreground));
}

.modal-body {
    margin-top: 1rem;
    font-size: 0.875rem;
    line-height: 1.625;
    color: hsl(var(--card-foreground) / 0.82);
}

.modal-actions {
    margin-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.75rem;
}

.modal-btn-secondary,
.modal-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    padding: 0.55rem 1.35rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.modal-btn-secondary {
    border: 1px solid hsl(var(--card-foreground) / 0.28);
    background-color: transparent;
    color: hsl(var(--card-foreground));
}

.modal-btn-secondary:hover {
    background-color: hsl(var(--card-foreground) / 0.08);
    border-color: hsl(var(--card-foreground) / 0.5);
}

.modal-btn-primary {
    border: 1px solid hsl(var(--card-foreground));
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.modal-btn-primary:hover {
    transform: translateY(-1px);
    background-color: hsl(var(--primary) / 0.9);
}

/* Global print reset for shared shell */
@media print {
    header,
    footer,
    #mobileDrawer,
    .modal-backdrop,
    .grain-overlay,
    .stage-frame,
    .no-print {
        display: none !important;
    }

    html,
    body,
    #root,
    main {
        background: #ffffff !important;
        color: #111111 !important;
        min-height: auto !important;
        height: auto !important;
        overflow: visible !important;
    }

    @page {
        size: A4;
        margin: 12mm 14mm;
    }
}
