﻿
/* ============================================================
   BUTTONS
   ============================================================ */

.mat-btn {
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    font-size: 0.9rem;
}

    .mat-btn svg {
        display: block;
    }

.mat-btn-primary {
    background: #0078d4;
    color: white;
}

.mat-btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.mat-btn-danger {
    background: #d83b01;
    color: white;
}

.mat-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


/* ============================================================
   LOADING SPINNER
   ============================================================ */

.mat-loading {
    display: inline-block;
}

.mat-loading-rect {
    animation: mat-loading-dance .8s linear infinite;
    opacity: 1;
}

.mat-loading-rect2 {
    animation-delay: -.65s;
}

.mat-loading-rect3 {
    animation-delay: -.5s;
}

@keyframes mat-loading-dance {
    93.75%, 100% {
        opacity: .2;
    }
}

/* ============================
   DROPDOWN
   ============================ */

.dropdown-container {
    position: relative;
}

.dropdown {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 1.8em;
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
    border-left: 1px solid #DDDDDD;
    border-right: 1px solid #DDDDDD;
    border-bottom: 1px solid #DDDDDD;
    background-color: white;
    min-width: 100px;
    width: min-content;
    padding: 0 10px;
    box-shadow: 0 2.8px 2.2px rgba(0, 0, 0, 0.034), 0 6.7px 5.3px rgba(0, 0, 0, 0.048), 0 12.5px 10px rgba(0, 0, 0, 0.06), 0 22.3px 17.9px rgba(0, 0, 0, 0.072), 0 41.8px 33.4px rgba(0, 0, 0, 0.086), 0 100px 80px rgba(0, 0, 0, 0.12);
    z-index: 9999;
    padding-top: 5px;
}

    .dropdown > * {
        width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        cursor: pointer;
    }

        .dropdown > * :hover {
            background-color: #E0E0E0;
        }


        /*debounced*/
.debounced-input-row {
    display:grid;
    grid-template-columns: 1fr min-content;
}

    .debounced-input-row input[type=text] {
        border: none;
        outline: none;
        background: transparent;
        font: inherit;
        width: 100%;
    }

/* ============================================================
   PAGE OPTIONS
   ============================================================ */
.mat-pageoptions-wrapper {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    /*gap:10px;*/
}

    .mat-pageoptions-wrapper ::deep > * {
        padding: 0 10px;
        white-space: nowrap;
    }

        .mat-pageoptions-wrapper ::deep > *:hover {
            background-color: #f0f0f0;
        }


        .mat-pageoptions-wrapper ::deep > *:first-child {
            padding: 0 10px 0 0;
            text-align: left;
        }

        .mat-pageoptions-wrapper ::deep > *:not(:first-child) {
            border-left: 1px solid black;
        }


/* ============================================================
   MODAL
   ============================================================ */

.mat-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.mat-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    z-index: 1001;
    display: flex;
    flex-direction: column;
}

.mat-modal-header,
.mat-modal-footer {
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.mat-modal-header {
    position: relative;
}

.mat-modal-title {
    margin: 0;
    font-size: 1.25rem;
}

.mat-modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    color: #333;
    margin-left: auto;
}

.mat-modal-footer {
    border-top: 1px solid #eee;
    border-bottom: none;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.mat-modal-body {
    padding: 1rem;
    overflow-y: auto;
    flex-grow: 1;
}




/* ============================================================
   PROPERTY GRID
   ============================================================ */

/* Contenidor principal */
.mat-propertygrid-container {
    --mat-propertygrid-label-width: 160px;
    color: #333;
    border: 1px solid #DDDDDD;
}

/* Fila del grid */
.mat-propertygrid-row {
    display: flex;
    align-items: center;
    min-height: 28px;
    padding: 2px 0;
    border-bottom: 1px solid #eee;
    transition: background 0.15s ease;
}

    .mat-propertygrid-row:hover {
        background: #f7f7f7;
    }

/* Columna esquerra (labels) */
.mat-propertygrid-label {
    width: var(--mat-propertygrid-label-width);
    padding: 4px 6px;
    font-weight: 500;
    color: #444;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Splitter discret i elegant */
.mat-propertygrid-splitter {
    width: 6px;
    cursor: col-resize;
    background: transparent;
    transition: background 0.15s ease;
    align-self: stretch;
}

    .mat-propertygrid-splitter:hover {
        background: #d0d0d0;
    }

/* Columna dreta (editors) */
.mat-propertygrid-editor {
    flex: 1;
    padding: 2px 0;
}


.buttons-bar {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 15px;
}

/* Base button style */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 1rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    color: white !important;
    transition: background-color 0.15s ease, opacity 0.15s ease;
}

    .btn ::deep * {
        color: white;
    }

/* Accept / Confirm / Save */
.btn-accept {
    background-color: #28A745;
}

    .btn-accept:hover {
        background-color: #218838;
    }

    .btn-accept:active {
        background-color: #1e7e34;
    }

/* Cancel / Neutral */
.btn-cancel {
    background-color: #6C757D;
}

    .btn-cancel:hover {
        background-color: #5a6268;
    }

    .btn-cancel:active {
        background-color: #545b62;
    }

/* Delete / Destructive */
.btn-delete {
    background-color: #DC3545;
}

    .btn-delete:hover {
        background-color: #c82333;
    }

    .btn-delete:active {
        background-color: #bd2130;
    }

/* Optional: disabled state */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


/* ============================
   PROPERTY GRID RESPONSIVE MODE
   ============================ */
@media (max-width: 600px) {
    /* Fila vertical */
    .mat-propertygrid-row {
        flex-direction: column;
        align-items: stretch;
        padding: 6px 0;
    }
    /* Label a dalt */
    .mat-propertygrid-label {
        width: 100% !important;
        padding: 4px 2px;
        font-weight: 600;
        border: none;
        background: transparent;
    }
    /* Splitter desapareix */
    .mat-propertygrid-splitter {
        display: none;
    }
    /* Editor ocupa tot l’ample */
    .mat-propertygrid-editor {
        width: 100%;
        padding-top: 2px;
    }
}

/* ============================
   PROPERTY GRID TEXT EDITOR
   ============================ */

.mat-propertygrid-editor input {
    border:none;
    outline:none;
    background:transparent;
    font:inherit;
    width:100%;
}

/* ============================
   PROPERTY GRID FILE UPLOAD EDITOR
   ============================ */

.mc-file-upload-preview {
    width: 200px;
    height: 200px;
    border: 2px dashed #ccc;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

    .mc-file-upload-preview img {
        max-width: 100%;
        max-height: 100%;
    }

.mc-file-upload-placeholder {
    color: #888;
    font-size: 0.9rem;
}

/* ============================
   PROPERTY GRID COMPLEX EDITOR
   ============================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal {
    background: white;
    width: 480px;
    max-width: 90vw;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    animation: modal-fade-in 0.18s ease-out;
    display: flex;
    flex-direction: column;
}

/* ============================
   PROPERTY GRID BOOL EDITOR
   ============================ */

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

    .toggle-switch input {
        opacity: 0;
        width: 0;
        height: 0;
    }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 24px;
}

    .slider:before {
        position: absolute;
        content: "";
        height: 18px;
        width: 18px;
        left: 3px;
        bottom: 3px;
        background-color: white;
        transition: .3s;
        border-radius: 50%;
    }

input:checked + .slider {
    background-color: #4caf50;
}

    input:checked + .slider:before {
        transform: translateX(22px);
    }



/* ============================
   CONTEXT MENU
   ============================ */

.context-menu-wrapper {
    position: relative;
    display: inline-block;
}

/* Swipe actions hidden by default */
.context-menu-swipe-actions {
    display: none;
}

/* Only show swipe actions on coarse pointer when triggered */
@media (pointer: coarse) {
    .context-menu-swipe-actions {
        display: block;
        background: #fff;
        border: 1px solid #ccc;
        padding: 0.5rem;
        margin-top: 0.25rem;
        box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    }
}

/* Desktop menu items only on fine pointer */
@media (pointer: fine) {
    .swipe-actions {
        display: none;
    }

    .context-menu-items {
        position: absolute;
        background: #fff;
        border: 1px solid #ccc;
        border-radius: 4px;
        padding: 4px 0;
        min-width: 180px;
        white-space: nowrap;
        z-index: 1000;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    }

    .menu-items-host a {
        display: block;
        padding: 6px 12px;
        text-decoration: none;
        color: #333;
    }

        .menu-items-host a:hover {
            background: #f2f2f2;
        }
}




@media (pointer: coarse) {

    .context-menu-items {
        display: none;
    }

    .swipe-container {
        position: relative;
        width: 100%;
        overflow: hidden;
        touch-action: pan-y;
        --dragX: 0px;
        --panelWidth: 0px;
    }

    /* CONTENT */
    .context-menu-content {
        position: relative;
        background: #fff;
        padding: 1rem;
        transform: translateX(var(--dragX));
        transition: transform 0.05s linear;
        z-index: 2;
    }

    /* PANELS */
    .swipe-actions {
        position: absolute;
        top: 0;
        bottom: 0;
        width: var(--panelWidth);
        display: flex;
        align-items: center;
        justify-content: center;
        color: #fff;
        font-weight: 600;
        padding: 0 1rem;
        overflow: hidden;
        z-index: 1;
        transition: width 0.05s linear;
        clip-path: inset(0 calc(100% - var(--panelWidth)) 0 0);
    }

        /* LEFT PANEL */
        .swipe-actions.left {
            left: 0;
            background: #d9534f;
        }

        /* RIGHT PANEL */
        .swipe-actions.right {
            right: 0;
            background: #0275d8;
        }
}



/* ============================
   ERROR BANNER
   ============================ */

.mat-errorbanner {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #f8d7da;
    color: #721c24;
    padding: 10px 15px;
    border-radius: 4px;
    border: 1px solid #f5c6cb;

    /* Optional: add a subtle animation */
    animation: fadeIn 0.3s ease-out;
    }

.icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}



