/* ============================================================
   Montega Companies – Modal Styles
   File: /wp-content/themes/montega/assets/css/companies-modal.css
   ============================================================ */

/* --- Company list buttons ----------------------------------- */
.companies-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px 24px;
}

@media (max-width: 900px) {
    .companies-list { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
    .companies-list { grid-template-columns: 1fr; }
}

.company {
    display: flex;
    align-items: center;
}

.company-btn {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    background: none;
    border: none;
    padding: 4px 0;
    cursor: pointer;
    text-align: left;
    line-height: 1.4;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
}

.company-btn:hover .company-name,
.company-btn:focus .company-name {
    color: var(--e-global-color-primary, #00b4b4);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.company-btn:focus {
    outline: 2px solid var(--e-global-color-primary, #00b4b4);
    outline-offset: 2px;
    border-radius: 2px;
}

.company-name {
    font-weight: 500;
    transition: color 0.15s ease;
}

/* Numbers hidden in list view – numbers still in data-disclosure attr for modal */
.company-disclosure-hint {
    display: none;
}

/* --- Modal overlay ------------------------------------------ */
.montega-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.montega-modal-overlay.is-visible {
    opacity: 1;
    pointer-events: all;
}

.montega-modal-overlay[hidden] {
    display: none !important;
}

/* --- Modal dialog ------------------------------------------- */
.montega-modal-dialog {
    background: var(--e-global-color-13a8ce1, #0e1c22);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 10px;
    width: 100%;
    max-width: 960px;       /* wider to prevent title wrapping */
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.22s ease;
    overflow: hidden;
}

.montega-modal-overlay.is-visible .montega-modal-dialog {
    transform: translateY(0);
}

/* --- Modal header ------------------------------------------- */
.montega-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.montega-modal-company-name {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--e-global-color-primary, #00b4b4);
    line-height: 1.3;
}

.montega-modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    color: inherit;
    opacity: 0.5;
    padding: 0 4px;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.montega-modal-close:hover { opacity: 1; }

/* --- Modal body --------------------------------------------- */
.montega-modal-body {
    overflow-y: auto;
    padding: 24px 28px 28px;
    flex: 1 1 auto;
    position: relative;
}

/* --- Loading spinner --------------------------------------- */
.montega-modal-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 32px 0;
    opacity: 0.7;
    font-size: 0.9rem;
}

.mm-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: var(--e-global-color-primary, #00b4b4);
    border-radius: 50%;
    animation: mm-spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes mm-spin { to { transform: rotate(360deg); } }

/* --- Section titles ----------------------------------------- */
.mm-section {
    margin-bottom: 28px;
}
.mm-section:last-child { margin-bottom: 0; }

.mm-section-title {
    font-size: 0.80rem;
    font-weight: 700;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    opacity: 0.55;
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;        /* prevent title overflow on narrow viewports */
}

/* --- Disclosure -------------------------------------------- */
.mm-disclosure-numbers {
    font-weight: 500;
    margin: 0 0 12px;
}
.mm-nums {
    color: var(--e-global-color-primary, #00b4b4);
    font-weight: 400;
    margin-left: 4px;
}

.mm-definition-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mm-definition-item {
    display: flex;
    gap: 10px;
    font-size: 0.86rem;
    line-height: 1.55;
    opacity: 0.85;
}

.mm-def-num {
    color: var(--e-global-color-primary, #00b4b4);
    font-weight: 600;
    flex-shrink: 0;
    min-width: 18px;
}

/* --- Total numbers ----------------------------------------- */
.mm-total-badge,
.mm-months-badge {
    background: rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 2px 10px;
    font-weight: 500;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: none;
    opacity: 1;
}

.mm-totals-grid {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.mm-total-card {
    flex: 1 1 100px;
    border-radius: 8px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-align: center;
    /* Neutral, uniform base – same for all cards */
    background: rgba(255, 255, 255, 0.06);
    color: inherit;
}

.mm-total-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.55;
}

.mm-total-count {
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1.1;
}

.mm-total-pct {
    font-size: 0.80rem;
    opacity: 0.55;
}

/* Subtle left-border accent per sentiment – same neutral background */
.mm-buy  { border-left: 3px solid rgba(255,255,255,0.25); }
.mm-hold { border-left: 3px solid rgba(255,255,255,0.25); }
.mm-sell { border-left: 3px solid rgba(255,255,255,0.25); }
.mm-na   { border-left: 3px solid rgba(255,255,255,0.15); opacity: 0.7; }

/* --- Price history table ----------------------------------- */
.mm-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.08);
}

.mm-price-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.mm-price-table th,
.mm-price-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    white-space: nowrap;
}

.mm-price-table thead th {
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.50;
    font-weight: 600;
    background: rgba(255,255,255,0.03);
}

.mm-price-table tbody tr:last-child td {
    border-bottom: none;
}

.mm-price-table tbody tr:hover {
    background: rgba(255,255,255,0.03);
}

/* Recommendation pill – neutral base with subtle text differentiation */
.mm-rec {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    background: rgba(255,255,255,0.08);
    color: inherit;
}

/* Slightly differentiated text colours within the same neutral scheme */
.mm-rec--kaufen    { color: rgba(255,255,255,0.90); }
.mm-rec--halten    { color: rgba(255,255,255,0.65); }
.mm-rec--verkaufen { color: rgba(255,255,255,0.55); }

/* Empty state */
.mm-empty {
    font-size: 0.875rem;
    opacity: 0.55;
    font-style: italic;
    margin: 0;
}

/* --- Responsive modal ------------------------------------- */
@media (max-width: 600px) {
    .montega-modal-header,
    .montega-modal-body { padding-left: 18px; padding-right: 18px; }

    .mm-price-table thead { display: none; }
    .mm-price-table tbody tr {
        display: block;
        padding: 10px 0;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    .mm-price-table td {
        display: flex;
        justify-content: space-between;
        white-space: normal;
        border-bottom: none;
        padding: 4px 0;
        font-size: 0.82rem;
    }
    .mm-price-table td::before {
        content: attr(data-label);
        font-weight: 600;
        opacity: 0.5;
        margin-right: 8px;
        flex-shrink: 0;
    }
    .mm-table-wrap { border: none; }
}