/* ===== RESERVATION CARDS - LAYOUT UNIFICADO v8 ===== */

/* ===== VARIAVEL DE LARGURA GLOBAL ===== */
:root {
    --layout-w: 80%;
}

/* ===== GRID DE CARDS ===== */
.reservations-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin: 0 auto;
    width: var(--layout-w);
    box-sizing: border-box;
}

/* ===== CARD COMPACTO ===== */
.reservation-card {
    background: white;
    border-radius: 1px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s;
    border-left: 4px solid #28a745;
    height: 100px;
    display: flex;
    align-items: center;
    padding: 0;
    overflow: visible;
    position: relative;
    box-sizing: border-box;
    margin: 0;
}

.reservation-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.reservation-card.cancelled {
    border-left-color: #dc3545;
    background-color: #ffe5e5;
}

.reservation-card.pending {
    border-left-color: #ff9800;
}

.reservation-card.confirmed {
    border-left-color: #28a745;
}

/* ===== CARD ESTRUTURA ===== */
.card-content {
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 0.5rem 1rem;
    gap: 0.6rem;
    box-sizing: border-box;
    overflow: hidden;
}

/* ===== ID ===== */
.card-id-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 45px;
    gap: 0.35rem;
    flex-shrink: 0;
}

.card-id-number {
    font-size: clamp(0.65rem, 1.5vw, 0.85rem);
    font-weight: 700;
    color: #333;
}

.card-id-label {
    font-size: clamp(0.5rem, 1vw, 0.6rem);
    color: #999;
}

.card-history-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 0;
    font-size: clamp(0.75rem, 1.5vw, 0.9rem);
    transition: color 0.2s;
}
.card-history-btn:hover { color: #333; }

/* ===== MAIN INFO (NOME + TEL) ===== */
.card-main {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.card-name {
    font-weight: 600;
    font-size: clamp(0.72rem, 1.8vw, 0.95rem);
    color: #212529;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    max-width: 100%;
}

.card-name.truncated {
    max-width: 130px;
}

.card-phone {
    font-size: clamp(0.65rem, 1.4vw, 0.8rem);
    color: #007bff;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-phone:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* ===== CENTER: PAX + HORA + MESA ===== */
.card-center {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-shrink: 0;
    justify-content: center;
}

.card-stat {
    text-align: center;
    cursor: pointer;
    transition: background 0.2s;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50px;
}
.card-stat:hover { background: #f0f0f0; }

.card-stat-value {
    font-weight: 700;
    font-size: clamp(0.8rem, 2vw, 1.2rem);
    color: #ff9500;
    display: block;
    line-height: 1;
}

.card-stat-label {
    font-size: clamp(0.5rem, 1vw, 0.65rem);
    color: #999;
    display: block;
    line-height: 1;
}

.card-time {
    text-align: center;
    padding: 0.25rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50px;
}

.card-time-value {
    font-weight: 600;
    font-size: clamp(0.7rem, 1.6vw, 0.95rem);
    color: #333;
    display: block;
    line-height: 1;
}

.card-time-label {
    font-size: clamp(0.5rem, 1vw, 0.65rem);
    color: #999;
    display: block;
    line-height: 1;
}

.card-mesa-box {
    text-align: center;
    padding: 0.25rem;
    min-width: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50px;
}

.card-mesa-value {
    font-weight: 600;
    font-size: clamp(0.7rem, 1.5vw, 0.9rem);
    color: #666;
    display: block;
    line-height: 1;
}

.card-mesa-label {
    font-size: clamp(0.5rem, 1vw, 0.65rem);
    color: #999;
    display: block;
    line-height: 1;
}

/* ===== OBS COM SCROLL ===== */
.card-obs,
.card-obs-empty {
    width: 200px;
    height: 56px;
    padding: 0.4rem;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 2px solid #007bff;
    font-size: clamp(0.5rem, 1vw, 0.55rem);
    color: #666;
    line-height: 1.3;
    flex-shrink: 0;
    box-sizing: border-box;
}

.card-obs {
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid #007bff;
}

.card-obs::-webkit-scrollbar { width: 4px; }
.card-obs::-webkit-scrollbar-track { background: #e9ecef; }
.card-obs::-webkit-scrollbar-thumb { background: #007bff; border-radius: 2px; }

.card-obs-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: clamp(0.6rem, 1.2vw, 0.75rem);
    color: #999;
}

/* ===== STATUS BOLINHA ===== */
.card-status-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.card-status-dot.pending { background: #ff9800; }
.card-status-dot.confirmed { background: #28a745; }
.card-status-dot.cancelled { background: #dc3545; }
.card-status-dot:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ===== MENU 3 PONTOS ===== */
.card-menu {
    display: flex;
    align-items: center;
    position: relative;
    flex-shrink: 0;
    margin-left: auto;
}

.btn-menu-ios {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 0.5rem;
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    transition: color 0.2s;
    line-height: 1;
}
.btn-menu-ios:hover { color: #333; }

.menu-dropdown {
    position: fixed;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 180px;
    overflow: hidden;
    display: none;
}
.menu-dropdown.show {
    display: block !important;
    animation: slideDown 0.25s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-size: clamp(0.78rem, 1.5vw, 0.9rem);
    color: #333;
    transition: background 0.2s;
    border-bottom: 1px solid #f0f0f0;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:hover { background: #f9f9f9; }
.menu-item.danger { color: #dc3545; }
.menu-item i { font-size: 1rem; width: 20px; text-align: center; }

/* ===== FILTER BAR - LARGURA UNIFICADA ===== */
.filter-bar-horizontal {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    flex-wrap: nowrap;
    margin: 1rem auto;
    width: var(--layout-w);
    box-sizing: border-box;
    overflow-x: auto;
    font-size: clamp(0.75rem, 1.5vw, 0.9rem);
}

.filter-item-date,
.filter-item-search {
    flex: 1;
    min-width: 100px;
}

.filter-item-date input,
.filter-item-search input {
    font-size: clamp(0.78rem, 1.5vw, 0.9rem);
    padding: 0.4rem;
}

.filter-item-checkbox {
    white-space: nowrap;
    font-size: clamp(0.75rem, 1.5vw, 0.9rem);
}
.filter-item-checkbox label {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.period-icons {
    display: flex;
    gap: 0.3rem;
    flex-shrink: 0;
}

.btn-period {
    background: #fff;
    border: 1px solid #dee2e6;
    padding: 0.35rem 0.45rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    font-size: clamp(0.7rem, 1.4vw, 0.85rem);
    flex-shrink: 0;
}
.btn-period:hover { border-color: #007bff; }
.btn-period.active {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

/* ===== MODAL EDITAR (legado - mantido para compatibilidade) ===== */

.filter-actions {
    display: flex;
    gap: 0.3rem;
    flex-shrink: 0;
}
.filter-actions .btn {
    padding: 0.35rem 0.55rem;
    font-size: clamp(0.7rem, 1.3vw, 0.8rem);
    flex-shrink: 0;
}

/* ===== TOTALS - LARGURA UNIFICADA ===== */
.totais-info {
    display: flex;
    padding: 0.75rem 1rem;
    background: #fff;
    border-radius: 0px;
    border-left: 4px solid #007bff;
    flex-wrap: wrap;
    margin: 0 auto 1rem;
    width: var(--layout-w);
    font-size: clamp(0.78rem, 1.5vw, 0.9rem);
    box-sizing: border-box;
}
.totais-info span { font-weight: 600;
margin-left: 15px;
align-items: center;
text-align: center;
font-size: 1rem; }

/* ===== RESPONSIVE - TABLET (<=968px) ===== */
@media (max-width: 968px) {
    :root { --layout-w: 98%; }

    .card-content {
        padding: 0.4rem 0.6rem;
        gap: 0.4rem;
    }

    .card-name { max-width: 140px; }

    .card-obs, .card-obs-empty {
        width: 105px;
        height: 50px;
    }
}

/* ===== RESPONSIVE - MOBILE (<=480px) ===== */
@media (max-width: 480px) {
    :root { --layout-w: 98%; }

    .reservations-grid {
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .filter-item-date { width: 45%; flex: none; }
    .filter-item-search { width: 50%; flex: none; }

    .totais-info {
        gap: 0.8rem;
        padding: 0.5rem;
        margin: 0.5rem auto;
    }

    .reservation-card {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

    .card-content {
        padding: 0.3rem 0.3rem;
        gap: 0.15rem;
        overflow: hidden;
        width: 100%;
    }

    .card-id-box { min-width: 25px; flex-shrink: 1; }
    .card-center { gap: 0.2rem; flex-shrink: 1; }
    .card-main { min-width: 0; flex: 1; overflow: hidden; }

    .card-name { max-width: 90px; }
    .card-name.truncated { max-width: 90px; }

    .card-stat { padding: 0.15rem 0.3rem; min-height: 40px; }
    .card-time { padding: 0.15rem 0.3rem; min-height: 40px; }
    .card-mesa-box { min-width: 28px; min-height: 40px; }

    .card-obs, .card-obs-empty {
        width: 50px;
        min-width: 0;
        height: 42px;
        padding: 0.3rem;
        flex-shrink: 1;
    }

    .card-status-dot { width: 9px; height: 9px; }
}

/* ===== PRINT ===== */
@media print {
    .card-menu,
    .filter-bar-horizontal,
    .totais-info { display: none; }

    .reservation-card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
}
