/* =========================================
   1. GLOBALA REGLER & BAKGRUND
   ========================================= */
html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-image: linear-gradient(180deg, #722F37 0%, #6B8E23 170%);
    min-height: 100dvh;
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: cover;
    margin: 0;
    padding: 0;
}

* {
    color: black;
}

.page, main, .content-area {
    background: transparent !important;
}

/* =========================================
   2. SAFE AREA FÖR MOBIL (MAUI)
   ========================================= */
.status-bar-safe-area {
    display: none;
}

@supports (-webkit-touch-callout: none) {
    .status-bar-safe-area {
        display: flex;
        position: sticky;
        top: 0;
        height: env(safe-area-inset-top);
        background-color: #f7f7f7;
        width: 100%;
        z-index: 1;
    }

    .flex-column, .navbar-brand {
        padding-left: env(safe-area-inset-left);
    }
}

/* =========================================
   3. TYPOGRAFI & HJÄLPKLASSER
   ========================================= */
.text-muted {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.5rem;
}

.keep-together {
    white-space: nowrap;
    display: inline-block;
    color: peachpuff;
}

/* Scrollbars */
.scroll-container {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    margin-top: 10px;
    min-height: 0;
}

    .scroll-container::-webkit-scrollbar {
        width: 6px;
    }

    .scroll-container::-webkit-scrollbar-thumb {
        background: rgba(0,0,0,0.2);
        border-radius: 10px;
    }

/* =========================================
   4. KORT (CARDS) & SUMMERING
   ========================================= */
.card {
    background: linear-gradient(180deg, #b8b8b8 0%, #722F37 170%);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border: none;
    display: flex;
    flex-direction: column;
}

    .card * {
        color: black;
    }

.card-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 2rem;
}

.card-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-top: -2rem;
}

.inventory-summary-card {
    display: flex;
    justify-content: space-between;
    padding: 15px 20px;
    border-radius: 8px;
    background-color: #2c3e50;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.1);
    margin-top: 10px;
}

    .inventory-summary-card * {
        color: peachpuff;
    }

    .inventory-summary-card .summary-item {
        display: flex;
        flex-direction: column;
    }

    

/* =========================================
   5. KATALOG ACTIONS & DEBUG VY
   ========================================= */
.catalog-actions-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

    .catalog-actions-top .btn.scan {
        margin: 0;
        flex-grow: 1;
    }

.btn-debug {
    margin: 0;
    background: white;
    border: 1px solid #ccc;
    padding: 0 12px;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* Debug Containers */
.ocr-debug-container {
    background: #f8f9fa;
    border: 1px dashed #ccc;
    border-radius: 4px;
}

    .ocr-debug-container code {
        color: #d63384;
        font-size: 0.85rem;
        white-space: pre-wrap;
    }

.nfc-debug-container {
    background: #eef9ff;
    border: 1px solid #4A90E2;
    border-radius: 4px;
    color: #2c3e50;
}

    .nfc-debug-container small {
        font-weight: bold;
        color: #4A90E2;
    }

    .nfc-debug-container div {
        font-family: monospace;
        font-size: 0.9rem;
    }

/* =========================================
   6. FILTER BAR & SÖKNING
   ========================================= */
.filter-wrapper {
    margin: 10px 0 15px 0;
    width: 100%;
}

.filter-scroll-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.filter-pill {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #ccc;
    background: white;
    font-size: 0.85rem;
    flex: 1 1 auto;
    min-width: 130px;
    cursor: pointer;
}

.btn-clear-filters {
    border-radius: 8px;
    background: white;
    border: none;
    color: #dc3545;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    flex: 0 0 auto;
    padding: 8px;
}

.search-container {
    position: relative;
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ccc;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 2000;
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 150px;
    overflow-y: auto;
}

    .search-dropdown li {
        padding: 10px;
        border-bottom: 1px solid #eee;
        cursor: pointer;
    }

        .search-dropdown li:hover {
            background: #f8f9fa;
            color: #722F37;
        }

/* =========================================
   7. FORMULÄR & INPUTS
   ========================================= */
.form-group {
    text-align: left;
    margin-bottom: 1.25rem;
}

    .form-group label {
        display: block;
        font-size: 0.85rem;
        font-weight: 600;
        margin-bottom: 0.4rem;
        text-transform: uppercase;
    }

.form-control {
    width: 100%;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid #ddd;
    box-sizing: border-box;
    color: black;
}

.nfc-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.readonly-input {
    background-color: #f0f0f0 !important;
    cursor: not-allowed;
}

/* =========================================
   8. KNAPPAR
   ========================================= */
button {
    justify-content: center;
    text-align: center;
}

.btn {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-radius: 8px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s, filter 0.2s;
    height: 3.5dvh;
    font-size: 1rem;
    margin: 0.3rem 0 0.3rem 0;
}

    .btn:active {
        transform: scale(0.98);
    }

.btn-primary, .btn-secondary {
    width: 100%;
    padding: 0.85rem;
    margin-top: 1rem;
    height: auto;
}

.btn-primary {
    background-color: #28a745;
    color: white;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn.delete {
    background-color: #dc3545;
    color: peachpuff;
    width: 7dvw;
}

.btns {
    display: grid;
    justify-content: flex-end;
    padding: 0;
    margin-top: -2rem;
}

/* =========================================
   9. MODALS (POPUP-FÖNSTER)
   ========================================= */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-card {
    background: linear-gradient(180deg, #b8b8b8 0%, #722F37 170%);
    border-radius: 14px;
    width: min(480px, 92vw);
    max-height: 90dvh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}

    .modal-card * {
        color: black;
    }

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.modal-subtitle {
    font-size: 0.85rem;
    margin: 0.2rem 0 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    line-height: 1;
    transition: background 0.15s;
}

    .modal-close:hover {
        background: rgba(0, 0, 0, 0.06);
    }

.modal-body {
    padding: 1.25rem 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.modal-card-small {
    max-width: 400px;
}

    .modal-card-small .modal-body {
        display: block;
        grid-column: 1/3;
    }

.modal-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.modal-row--full {
    grid-column: 1 / -1;
}

.modal-row label {
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.modal-row input, .modal-row textarea {
    padding: 0.55rem 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    font-size: 0.95rem;
    background: #f9f9f9;
    transition: border-color 0.15s;
    width: 100%;
    box-sizing: border-box;
}

    .modal-row input:focus, .modal-row textarea:focus {
        outline: none;
        border-color: #8b2635;
    }

.inv-rfid.modal-row textarea {
    resize: vertical;
    min-height: 80px;
}

/* =========================================
   10. LOGIN & AUTHENTICATION
   ========================================= */
.login-container {
    max-width: 420px;
    margin: 8dvh auto;
    text-align: center;
    padding: 0 20px;
}

    .login-container h1 {
        color: peachpuff;
        font-weight: 700;
        text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    }

    .login-container p {
        color: peachpuff;
    }

#login-heading .logo-inline {
    display: inline-block;
    vertical-align: middle;
    padding: 2px;
    border-radius: 3px;
    height: 1.5em;
    margin-top: -0.1em;
    margin-right: -0.3em;
}

.link-container {
    margin-top: 2rem;
}

    .link-container a {
        text-decoration: none;
        font-weight: 700;
        font-size: 0.95rem;
    }

/* =========================================
   11. BLAZOR FELHANTERING
   ========================================= */
.blazor-error-ui {
    color: black;
}

/* =========================================
   12. MOBILANPASSNING (Responsive)
   ========================================= */
@media (max-width: 768px) {
    .modal-card {
        width: 90% !important;
        height: auto !important;
        max-height: 90dvh !important;
        border-radius: 24px !important;
        margin: auto;
    }

    .modal-body {
        overflow-y: auto;
    }
}
