/* 
  Master Table Component 
  Standardized table styles extracted from my-trade-fairs.html
*/

.master-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

.master-table th,
.master-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
    vertical-align: middle;
}

.master-table th {
    background: #eef2f7;
    font-weight: 800;
    color: #0f172a;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 3;
}

.master-table td {
    /* Inherits basic properties, adding specificity if needed */
    color: inherit;
}

/* Fair Name Text Style - Matches app.js .trade-fairs-name-text */
.master-table-name-text {
    font-weight: 600;
    font-size: 15px;
    color: #0b1426;
    text-decoration: none;
    display: block;
}

/* Override for budget-roi wrapper to match flat look */
.br-table-wrap {
    border-radius: 0 !important;
    box-shadow: none !important;
    border: none !important;
}

/* Utility Classes */
.text-right {
    text-align: right !important;
    white-space: nowrap;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* Status Variations (matching my-trade-fairs) */
.status-badge.is-upcoming {
    background: #e7eef9;
    border: 1px solid #d7e3f6;
    color: #0b3c5d;
    /* var(--accent) */
}

.status-badge.is-ongoing {
    background: #e0ecff;
    border: 1px solid #c7ddff;
    color: #0b3c5d;
    /* var(--accent) */
}

.status-badge.is-past {
    background: #eef1f7;
    border: 1px solid #daddf0;
    color: #475569;
    /* var(--muted) */
}

.status-badge.is-completed {
    background: #dcfce7;
    color: #166534;
}

.status-badge.is-neutral {
    background: #f1f5f9;
    color: #475569;
}

/* Generic Status Colors (for scores/ratings) */
.status-badge.is-green {
    background: #dcfce7;
    color: #166534;
}

.status-badge.is-yellow {
    background: #fef3c7;
    color: #b45309;
}

.status-badge.is-red {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.is-blue {
    background: #dbeafe;
    color: #1e40af;
}

.status-badge.is-purple {
    background: #f3e8ff;
    color: #6b21a8;
}

.status-badge.is-teal {
    background: #ccfbf1;
    color: #0f766e;
}

.status-badge.is-pink {
    background: #fce7f3;
    color: #9d174d;
}

.status-badge.is-gray {
    background: #f3f4f6;
    color: #374151;
}

.status-badge.is-orange {
    background: #ffedd5;
    color: #9a3412;
}

/* Action Icon Buttons */
.action-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.action-btn-icon:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}

/* Specific Action Color Hover States */
.action-btn-icon.edit:hover {
    background-color: rgba(37, 99, 235, 0.1);
    color: #2563eb;
}

.action-btn-icon.delete:hover {
    background-color: rgba(220, 38, 38, 0.1);
    color: #dc2626;
}

.action-btn-icon.complete:hover {
    background-color: rgba(22, 163, 74, 0.1);
    color: #16a34a;
}

.action-btn-icon svg {
    width: 16px;
    height: 16px;
    stroke-width: 2px;
}

.action-btn-icon.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Master Table Actions Refinement */
.master-table-actions-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

@media (min-width: 769px) {
    .master-table-actions-wrapper {
        justify-content: flex-end;
    }
}

/* Personnel Table Specific - Legacy support or specific overrides */
.personnel-actions-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

@media (min-width: 769px) {
    .personnel-actions-wrapper {
        justify-content: flex-end;
    }
}

/* Responsive Stacked Layout for Mobile */
@media (max-width: 768px) {

    .master-table,
    .master-table thead,
    .master-table tbody,
    .master-table th,
    .master-table td,
    .master-table tr {
        display: block;
    }

    .master-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .master-table tr {
        margin-bottom: 16px;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        background: #fff;
        padding: 8px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    }

    .master-table td {
        border: none;
        border-bottom: 1px solid #f1f5f9;
        position: relative;
        padding-left: 38% !important;
        text-align: right !important;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 8px;
        transition: background-color 0.2s;
    }

    .master-table td:last-child {
        border-bottom: none;
        background: #f8fafc;
        border-radius: 0 0 8px 8px;
        margin-top: 4px;
        justify-content: center !important;
        padding-left: 12px !important;
    }

    .master-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 12px;
        width: 32%;
        padding-right: 8px;
        white-space: nowrap;
        text-align: left;
        font-weight: 800;
        font-size: 10px;
        text-transform: uppercase;
        color: #64748b;
        letter-spacing: 0.05em;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Hide labels for Action cells on mobile to center the footer */
    .master-table td[data-label="Actions"]::before,
    .master-table td[data-label="Azioni"]::before {
        display: none;
    }

    .master-table td[data-label="Actions"],
    .master-table td[data-label="Azioni"] {
        padding-left: 12px !important;
        justify-content: center !important;
        background: #f8fafc;
        border-radius: 0 0 12px 12px;
        margin-top: 4px;
        border-top: 1px solid #f1f5f9;
        min-height: 52px;
    }

    .master-table-name-text {
        font-size: 15px;
        font-weight: 700;
        color: var(--primary-color, #2563eb);
    }

    .status-badge {
        margin-left: auto;
    }
}