@import url('app.css');
html {
    scroll-behavior: auto !important;
}


html, body {
    font-family: 'Roboto','Helvetica','Arial','sans-serif';
}



h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#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: 1000;
}

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

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4w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UgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}


/* colcade - simplified */

/* Inner masonry grid for memory cards - CSS columns */
.inner-masonry-grid {
    column-count: 2;
    column-gap: 4px;
    column-fill: balance;
}

/* iOS Safari: remove column-fill balance which breaks rendering */
@supports (-webkit-touch-callout: none) {
    .inner-masonry-grid {
        column-fill: auto;
    }

    .inner-masonry-item {
        display: inline-block;
        width: 100%;
    }
}

/* Hide the empty column divs */
.inner-masonry-col {
    display: none;
}

.inner-masonry-item {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    margin-bottom: 4px;
    border-radius: 4px;
    overflow: hidden;
}

.inner-masonry-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

/* Legacy support for memory-media-grid */
.memory-media-grid {
    display: flex;
    gap: 8px;
    margin-bottom: 0;
}

.memory-media-grid .memory-media-item {
    width: 100%;
    min-height: 100px;
}

/* Ensure text content doesn't overlap with media */
.memory-card-content {
    clear: both;
    margin-top: 8px;
}

.memory-card-footer {
    clear: both;
    margin-top: 8px;
}

/* Grid Styles - 3 columns */
.grid-stack {
    overflow: hidden;
    width: 100%;
}

.grid-stack-item {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden;
}

.grid-stack-item-content {
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Drag handle styles */
.drag-handle {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    padding: 4px;
    cursor: move;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    width: 32px;
    height: 32px;
}

.grid-stack-item:hover .drag-handle {
    opacity: 1;
}

.drag-handle:hover {
    background-color: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.delete-button-container {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.grid-stack-item:hover .delete-button-container {
    opacity: 1;
}

.delete-button {
    background-color: rgba(255, 255, 255, 0.9) !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    padding: 4px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    width: 32px !important;
    height: 32px !important;
}

    .delete-button:hover {
        background-color: rgba(255, 255, 255, 1) !important;
        transform: scale(1.1);
    }

.memory-masonry-image {
    width: 100% !important;
    object-fit: cover !important;
    display: block !important;
    min-height: 200px !important;
    max-height: 400px !important;
}

/* Force MudImage to respect height attribute in masonry context */
.memory-media-item .mud-image.memory-masonry-image {
    height: inherit !important;
}

/* Single media (images and videos) should have their own min/max height constraints */
.mud-image.single-image {
    min-height: 250px !important;
    max-height: 600px !important;
}

/* Mobile-specific adjustments - smaller gutters for tighter fit */
@media (max-width: 768px) {
    .grid-stack {
        --gs-gutter: 2px;
    }
}

@media (max-width: 480px) {
    .grid-stack {
        --gs-gutter: 1px;
    }
}

.leaflet-control-attribution {
    display: none !important;
}

.image-preview {
    width: 300px;
    height: 300px;
    object-fit: cover;
    border-radius: 50%;
    class: shadow-lg;
}

.image-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

/* Dark mode memory card border fix */
.grid-item {
    border-color: var(--mud-palette-lines-default, #e0e0e0) !important;
}

/* Quill editor - text and icon colors for theme compatibility */
.ql-editor {
    color: var(--mud-palette-text-primary) !important;
}

.ql-snow .ql-stroke {
    stroke: var(--mud-palette-text-primary) !important;
}

.ql-snow .ql-fill {
    fill: var(--mud-palette-text-primary) !important;
}

.ql-snow .ql-picker,
.ql-snow .ql-picker-label {
    color: var(--mud-palette-text-primary) !important;
}

.ql-editor.ql-blank::before {
    color: var(--mud-palette-text-secondary) !important;
}

/* Quill picker dropdown options - dark mode fix */
.ql-snow .ql-picker-options {
    background-color: var(--mud-palette-surface) !important;
    border-color: var(--mud-palette-lines-default) !important;
}

.ql-snow .ql-picker-item {
    color: var(--mud-palette-text-primary) !important;
}

.ql-snow .ql-picker-item::before {
    color: var(--mud-palette-text-primary) !important;
}

.ql-snow .ql-picker-item:hover {
    color: var(--mud-palette-primary) !important;
}

.ql-snow .ql-picker-item:hover::before {
    color: var(--mud-palette-primary) !important;
}

/* Quill toolbar - mobile adjustments */
@media (max-width: 600px) {
    .ql-toolbar.ql-snow .ql-picker.ql-header {
        width: 105px !important;
    }
}

/* Gallery Grid - masonry style */
.gallery-grid {
    columns: 3;
    column-gap: 12px;
}

.gallery-grid > * {
    break-inside: avoid;
    margin-bottom: 12px;
}

.gallery-item-wrapper {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-item-wrapper:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.gallery-item-wrapper img {
    display: block;
    width: 100%;
    height: auto;
}

.gallery-item-wrapper .edit-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 8px;
    display: flex;
    justify-content: space-between;
    opacity: 0;
    transition: opacity 0.2s ease;
    background: linear-gradient(to bottom, rgba(0,0,0,0.4) 0%, transparent 100%);
}

.gallery-item-wrapper:hover .edit-overlay {
    opacity: 1;
}

@media (max-width: 900px) {
    .gallery-grid {
        columns: 2;
        column-gap: 10px;
    }
    .gallery-grid > * {
        margin-bottom: 10px;
    }
}

@media (max-width: 500px) {
    .gallery-grid {
        columns: 2;
        column-gap: 8px;
    }
    .gallery-grid > * {
        margin-bottom: 8px;
    }
    .gallery-item-wrapper {
        border-radius: 8px;
    }
}

/* Media Grid with Colcade - same approach as Memories */
.media-colcade-grid {
    display: flex;
    gap: 12px;
}

.media-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.media-grid-item {
    width: 100%;
    box-sizing: border-box;
}

.media-grid-item.fade-in {
    opacity: 0;
    animation: fadeIn 0.3s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@media (max-width: 900px) {
    .media-col:nth-child(3) {
        display: none;
    }
}

@media (max-width: 500px) {
    .media-col:nth-child(2),
    .media-col:nth-child(3) {
        display: none;
    }
}

/* Memorial color button utility */
.memorial-btn {
    background-color: var(--memorial-color) !important;
    color: white !important;
}

.memorial-btn:hover {
    filter: brightness(0.9);
}