:root {
    --yp-appbar-height: 64px;
}

html, body {
    font-family: "Cairo", "Segoe UI", sans-serif;
    font-size: 0.875rem;
    margin: 0;
    background: #f4f7f8;
    direction: rtl;
    text-align: right;
    overflow-x: hidden;
}

h1:focus {
    outline: none;
}

.yp-layout {
    min-height: 100vh;
}

.yp-main-content {
    /* Keep page content below the fixed AppBar */
    padding-top: calc(var(--yp-appbar-height) + 1rem) !important;
    padding-inline: 1rem 1rem;
    padding-bottom: 1.5rem;
    min-width: 0;
}

.yp-page {
    max-width: 1400px;
    margin-inline: auto;
    width: 100%;
    min-width: 0;
}

.yp-appbar-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(62vw, 28rem);
}

.yp-specialty-chip {
    flex-shrink: 0;
}

.yp-drawer .mud-nav-link {
    justify-content: flex-start;
    text-align: right;
}

.yp-drawer-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: var(--yp-appbar-height);
}

.yp-page-header {
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.yp-page-header-compact {
    gap: 0.35rem;
    margin-bottom: 0.65rem;
}

.yp-page-header-text {
    min-width: 0;
    flex: 1 1 220px;
}

.yp-page-title {
    margin-bottom: 0 !important;
    line-height: 1.25 !important;
}

.yp-page-subtitle {
    margin-top: 0.15rem !important;
    margin-bottom: 0 !important;
}

.yp-page-header .mud-button-root,
.yp-toolbar-actions .mud-button-root {
    white-space: normal;
}

.yp-table-wrap,
.yp-records-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

.yp-records-table {
    width: max-content;
    min-width: 100%;
}

.yp-th-nowrap,
.yp-records-table .mud-table-head .mud-table-cell,
.yp-records-table thead .mud-table-cell {
    text-align: right !important;
    white-space: nowrap !important;
    word-break: keep-all !important;
}

.mud-table {
    width: 100%;
}

.mud-table th,
.mud-table td {
    text-align: right !important;
    vertical-align: middle;
}

.mud-table .mud-table-cell {
    white-space: normal;
    word-break: break-word;
}

.mud-input-label,
.mud-input-slot,
.mud-select,
.mud-picker {
    text-align: right;
}

.mud-input-outlined .mud-input-outlined-border {
    border-color: #c9d6db;
}

.mud-input:focus-within .mud-input-outlined-border,
.mud-input-outlined.mud-input-focused .mud-input-outlined-border {
    border-color: var(--mud-palette-primary) !important;
}

.media-card {
    min-width: 0;
    height: 100%;
    overflow: hidden;
    background: #fff;
}

.media-card-inner {
    height: 100%;
}

.media-card-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #0f172a;
    overflow: hidden;
}

.media-delete-btn {
    position: absolute !important;
    top: 0.55rem;
    inset-inline-start: 0.55rem;
    z-index: 2;
    width: 2.1rem !important;
    height: 2.1rem !important;
    min-width: 2.1rem !important;
    padding: 0 !important;
    border-radius: 999px !important;
    background: rgba(255, 255, 255, 0.94) !important;
    color: #b42318 !important;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.22);
    border: 1px solid rgba(180, 35, 24, 0.18);
}

.media-delete-btn:hover {
    background: #fff1f0 !important;
    color: #912018 !important;
}

.media-delete-btn .mud-icon-root {
    font-size: 1.1rem !important;
}

.media-card-preview-link {
    display: block;
    width: 100%;
    height: 100%;
}

.media-card-preview img,
.media-card-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-card-lab {
    height: 100%;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    text-align: center;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

.media-card-meta {
    min-width: 0;
}

.media-type-chip {
    max-width: 100%;
}

.media-capture-block {
    background: #edf5f7;
    border: 1px solid #d5e5ea;
    border-radius: 8px;
    padding: 0.55rem 0.7rem;
}

.media-capture-date {
    font-weight: 700 !important;
    color: #0f4c5c;
    letter-spacing: 0.02em;
}

.media-card-description {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.upload-row {
    border: 1px dashed var(--mud-palette-lines-default);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: .75rem;
    background: #fff;
    min-width: 0;
}

.upload-row input[type="file"] {
    max-width: 100%;
}

.mud-paper {
    max-width: 100%;
}

@media (max-width: 600px) {
    .yp-main-content {
        padding-top: calc(var(--yp-appbar-height) + 0.75rem) !important;
        padding-inline: 0.75rem;
    }

    .yp-appbar-title {
        font-size: 0.95rem !important;
        max-width: 42vw;
    }

    .yp-page-header,
    .yp-page-header-compact {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.35rem !important;
        margin-bottom: 0.5rem !important;
    }

    .yp-page-header-text {
        flex: 0 0 auto;
        margin-bottom: 0;
    }

    .yp-page-title {
        font-size: 1.15rem !important;
    }

    .yp-page-subtitle {
        font-size: 0.8rem !important;
        margin-top: 0.1rem !important;
    }

    .yp-toolbar-actions {
        width: 100%;
        margin-top: 0.15rem;
        gap: 0.35rem;
    }

    .yp-toolbar-actions .mud-button-root {
        width: 100%;
        justify-content: center;
    }

    .yp-records-table-wrap {
        margin-inline: -0.25rem;
        padding-bottom: 0.25rem;
    }
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1300;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    left: 0.75rem;
    right: auto;
    top: 0.5rem;
}
