/* ==========================================================================
   Janus2 HTML Factory Styles
   Dedicated CSS for UI components generated by html-factory.js
   ========================================================================== */

/* --------------------------------------------------------------------------
   General / Form Fields
   -------------------------------------------------------------------------- */
.mc-row {
    margin-bottom: 15px;
}

.input-group {
    display: flex;
    align-items: center;
}

.input-group-text {
    padding: 8px 12px;
    background: var(--bg-lighter);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: 16px 0 0 16px;
    color: var(--text-muted);
}

.input-group input {
    border-radius: 0 16px 16px 0 !important;
}

/* Switch / Checkbox */
.switch-wrapper {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 10px;
}

/* --------------------------------------------------------------------------
   Property Specs Grid
   -------------------------------------------------------------------------- */
.property-specs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    padding: 15px;
    background: var(--bg-dark);
    border-radius: 16px;
    border: 1px solid var(--border);
}

.property-specs-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.property-specs-label-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.property-specs-icon {
    color: var(--text-muted);
    font-size: 10px;
}

.property-specs-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.property-specs-input {
    padding: 8px 12px;
    font-size: 13px;
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--text-main);
}

/* Custom Switch for Property Specs */
.property-specs-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    margin-top: 4px;
}

.property-specs-switch .switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    transition: .4s;
    border-radius: 20px;
}

.property-specs-switch .switch-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 1px;
    bottom: 1px;
    transition: .4s;
    border-radius: 50%;
}

.property-specs-switch input:checked + .switch-slider {
    background-color: var(--accent);
}

.property-specs-switch input:checked + .switch-slider:before {
    transform: translateX(16px);
}

/* --------------------------------------------------------------------------
   Search Select / Tags / Multi-Select
   -------------------------------------------------------------------------- */
.search-select-wrapper {
    position: relative;
}

.search-select-display {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-main);
}

.search-select-display.multi-select-box {
    min-height: 42px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    cursor: text;
}

.search-select-display.alert {
    border-color: var(--danger);
}

.search-select-input {
    border: none;
    background: transparent;
    outline: none;
    flex: 1 1 160px;
    min-width: 160px;
    padding: 0;
    color: var(--text-main);
}

.search-select-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin-top: 4px;
}

.search-select-option {
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-main);
}

.search-select-option:hover {
    background: var(--bg-hover);
}

.search-select-preview {
    margin-top: 8px;
    font-size: 0.9em;
    color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Contact List
   -------------------------------------------------------------------------- */
.contact-list-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.contact-list-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.contact-list-items:empty{
    display:none;
}

.contact-list-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.contact-type-select {
    width: 120px;
    padding: 8px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--bg-lighter);
    color: var(--text-main);
}

.contact-value-input {
    flex: 1;
    padding: 8px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--bg-lighter);
    color: var(--text-main);
}

/* --------------------------------------------------------------------------
   Pills Select
   -------------------------------------------------------------------------- */
.pills-select-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-pill {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-lighter);
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-pill:hover {
    background: transparent;
    border-color: var(--accent);
    color: var(--accent);
}
.btn-pill:hover .pill-dot{
    background-color: var(--accent) !important;
}
.pill-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.btn-pill.active {
    font-weight: 600;
    /* border-color, background-color, color are set inline dynamically */
}

/* --------------------------------------------------------------------------
   Chips
   -------------------------------------------------------------------------- */
.ui-sample-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--bg-lighter);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-main);
}

.ui-sample-chip-close {
    cursor: pointer;
    margin-left: 4px;
}

.ui-sample-chip-close:hover {
    color: var(--danger);
}

/* --------------------------------------------------------------------------
   Module View
   -------------------------------------------------------------------------- */
.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.empty-state {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
    background: var(--bg-lighter);
    border-radius: 8px;
}

/* --------------------------------------------------------------------------
   Modals
   -------------------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgb(0 0 0 / 40%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    will-change: blur;
}

.modal {
    background: radial-gradient(circle,  var(--bg-tertiary) 0%, var(--bg-dark) 100%);
    border: 1px solid var(--border);
    border-radius: 8px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
}

.modal-body {
    padding: 20px;
    padding-top: 10px;
    overflow: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* --------------------------------------------------------------------------
   Spinners
   -------------------------------------------------------------------------- */
.spinner {
    display: inline-block;
}

.spinner-small { font-size: 14px; }
.spinner-medium { font-size: 24px; }
.spinner-large { font-size: 36px; }

/* --------------------------------------------------------------------------
   Detail View / Reference Cards
   -------------------------------------------------------------------------- */
.detail-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 10px;
}

.detail-item {
    background: radial-gradient(circle, var(--bg-panel) 0%, var(--bg-tertiary) 100%);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.detail-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.detail-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 14px;
    color: var(--text-main);
    word-break: break-word;
}

/* Reference Card (used in tables and details) */
.ref-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: fit-content;
    max-width: 100%;
    text-decoration-color: var(--accent-dim-2);
}

.ref-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
}

.ref-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ref-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ref-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Loading state for ref */
.loading-ref {
    opacity: 0.6;
    font-style: italic;
    font-size: 0.9em;
}
