/* Common UI Elements */

/* Flags */
.flag-icon {
    width: 24px;
    height: 16px;
    border-radius: 2px;
    object-fit: cover;
    border: 1px solid var(--bs-border-color);
}

.flag-icon-sm {
    width: 20px;
    height: 14px;
    border-radius: 2px;
}

/* Status Badges */
.status-badge {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    font-weight: normal !important;
    border-radius: 50rem !important;
}

/* User Avatars */
.avatar-circle-sm {
    width: 35px;
    height: 35px;
    font-size: 0.8rem;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.avatar-circle-md {
    width: 40px;
    height: 40px;
    font-size: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

/* Form Styles */
.form-header {
    background-color: var(--header-bg);
    color: var(--text-on-dark);
    padding: 0.5rem;
    border: 0;
}

.form-header-title {
    margin: 0;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 1rem;
}

/* Device List (Product Create) */
.device-row {
    position: relative;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.25rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

/* Visual Fields List (Template Form) */
.field-row {
    border-bottom: 1px solid var(--bs-border-color);
}

/* Product List Placeholders */
.selection-placeholder {
    width: 40px;
    height: 15px;
    border: 2px solid var(--brand-black);
}

.product-image-placeholder {
    width: 100px;
    height: 100px;
}

/* Readonly form controls (Template Form) */
.form-control:read-only {
    background-color: var(--content-bg);
    opacity: 1;
}

/* Cursor utilities */
.cursor-not-allowed {
    cursor: not-allowed;
}
.cursor-pointer {
    cursor: pointer;
}

/* Scrollable tabs — hide scrollbar cross-browser */
.scrollable-tabs-container {
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE/Edge */
}

.scrollable-tabs-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* Tab adjustment to prevent wrapping inside scrollable container */
.scrollable-tabs-container .nav {
    flex-wrap: nowrap;
}

/* Back Button (Professional Style) */
.btn-back-miellec {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 6px;
    color: var(--bs-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    white-space: nowrap;
}

.btn-back-miellec i {
    transition: transform 0.2s ease;
    line-height: 0;
    font-size: 1.1rem;
}

.btn-back-miellec span {
    font-size: 0.95rem;
}

.btn-back-miellec:hover {
    background-color: var(--brand-bg-light);
    color: var(--bs-body-color);
    text-decoration: none;
}

.btn-back-miellec:hover i {
    transform: translateX(-4px);
}

.btn-back-miellec:focus {
    outline: 2px solid var(--primary-accent);
    outline-offset: 2px;
}

/* Contextual Ghost Buttons */
.border-dashed {
    border-style: dashed !important;
    border-width: 2px !important;
    opacity: 0.7;
    transition: all 0.2s ease;
}

.border-dashed:hover {
    opacity: 1;
    background-color: var(--brand-bg-light) !important;
    color: var(--bs-secondary) !important;
    border-color: var(--bs-secondary) !important;
}

/* Responsive Utilities missing in Bootstrap 5 */
@media (min-width: 768px) {
    .w-md-auto {
        width: auto !important;
    }
}
/* Professional Form Section Headers */
.section-header {
    color: var(--bs-secondary);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--bs-border-color);
    padding-bottom: 0.5rem;
    margin-top: 1rem;
    margin-bottom: 1.0rem;
    display: block;
    width: 100%;
    text-align: left; /* Wymuś wyrównanie do lewej w kartach auth */
}

/* Multi-column Grid for Forms */
@media (min-width: 768px) {
    .form-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0 1.5rem;
        align-items: start;
    }

    .form-grid .section-header,
    .form-grid .full-width-field {
        grid-column: 1 / -1;
    }

    /* Wide card for registration */
    .auth-card-wide {
        max-width: 850px !important;
    }
}

/* Wymuszenie tła Brand Booka Miellec Care dla tabel BootStrap */
.table-dark {
    --bs-table-bg: var(--bs-dark);
    --bs-table-color: var(--bs-body-bg);
}
/* Product Detail Responsiveness */
.detail-row {
    border-bottom: 1px solid var(--bs-border-color);
    padding: 0.65rem 0;
    display: flex;
    align-items: flex-start;
    transition: background-color 0.2s ease;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--bs-secondary);
    font-size: 0.9rem;
    min-width: 140px;
    width: 35%;
    flex-shrink: 0;
    padding-right: 1rem;
}

.detail-value {
    font-weight: 700;
    color: var(--bs-body-color);
    flex-grow: 1;
    word-break: break-all;
    font-size: 0.95rem;
}

/* Specific adjustments for badges in detail rows */
.detail-row .badge {
    font-weight: 500;
}

@media (max-width: 575.98px) {
    .detail-row {
        flex-direction: column;
        padding: 0.5rem 0;
    }

    .detail-label {
        width: 100%;
        min-width: unset;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.02em;
        margin-bottom: 0.15rem;
        opacity: 0.8;
    }

    .detail-value {
        width: 100%;
        font-size: 0.875rem;
    }

    /* Contact Cards (Seller/Installer) shrinking */
    .contact-card .fs-5 {
        font-size: 1rem !important;
    }
    .contact-card .card-body {
        padding: 1rem !important;
    }
    .contact-card .text-muted {
        font-size: 0.85rem !important;
    }
    .contact-card .badge {
        font-size: 0.7rem !important;
        padding: 0.4rem 0.6rem !important;
    }
}

@media (max-width: 767.98px) {
    #product-detail-container h1 {
        font-size: 1.25rem !important;
    }
}

/* --- System Notifications --- */
.system-notification-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.35rem 1.2rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.95rem;
    background-color: transparent;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    text-decoration: none;
}

.system-notification-badge .notif-icon {
    font-size: 1.35rem;
    display: inline-block;
}

.system-notification-badge.type-info {
    border: 2px solid var(--bs-primary);
    color: var(--bs-primary);
}

.system-notification-badge.type-info:hover {
    background-color: var(--brand-blue-transparent);
}

.system-notification-badge.type-alert {
    border: 2px solid var(--bs-danger);
    color: var(--bs-danger);
}

.system-notification-badge.type-alert:hover {
    background-color: var(--brand-danger-transparent);
}

.system-notification-badge.type-alert .notif-icon {
    animation: alert-pulse 1.5s infinite;
}

@keyframes alert-pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; color: var(--brand-danger); }
    100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 575.98px) {
    .system-notification-badge {
        padding: 0.25rem 0.75rem;
        font-size: 0.8rem;
        gap: 0.4rem;
    }
    .system-notification-badge .notif-icon {
        font-size: 1.1rem;
    }
}

/* Search Input rounding when button is hidden on mobile */
@media (max-width: 767.98px) {
    .rounded-mobile-end {
        border-top-right-radius: 0.375rem !important;
        border-bottom-right-radius: 0.375rem !important;
    }
}

/* Wide Offcanvas (Stats, Tables, etc.) */
.offcanvas-wide {
    width: 500px;
    max-width: 90vw;
}

@media (max-width: 767.98px) {
    .offcanvas-wide {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* Kompaktowa wyszukiwarka na mobile */
@media (max-width: 767.98px) {
    .search-compact-mobile {
        margin-bottom: 0.5rem !important;
    }
    .search-compact-mobile .input-group {
        min-height: 38px !important;
    }
    .search-compact-mobile .input-group-text {
        padding-top: 0.35rem !important;
        padding-bottom: 0.35rem !important;
        background-color: var(--brand-white) !important;
    }
    .search-compact-mobile input.form-control,
    .search-compact-mobile input[type="search"],
    .search-compact-mobile input[type="text"] {
        padding-top: 0.35rem !important;
        padding-bottom: 0.35rem !important;
        font-size: 0.9rem !important;
        height: auto !important;
    }
    .search-compact-mobile .btn {
        font-size: 0.85rem !important;
        padding: 0.35rem 0.75rem !important;
    }
}

/* Stylizacja przycisku czyszczenia (x) dla input[type="search"] */
input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    height: 1.25rem;
    width: 1.25rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%233F51B5'%3E%3Cpath d='M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 1rem;
    cursor: pointer;
    margin-right: 5px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

input[type="search"]::-webkit-search-cancel-button:hover {
    opacity: 1;
}

/* Responsywne rozmiary czcionek w podglądzie szablonu dla kart podstawowych danych */
@media (max-width: 767.98px) {
    .detail-card-title {
        font-size: 0.7rem !important;
    }
    .detail-card-value {
        font-size: 1rem !important;
    }
}
