/* ============================================================
   EASYFLOW - Apple Minimalist Design System
   ============================================================ */

/* --- Cards --- */
.ef-card {
    background: #FFFFFF;
    border-radius: 28px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.ef-card-sm {
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

/* --- Inputs --- */
.ef-input {
    background: #F5F5F7;
    border: 1.5px solid transparent;
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 0.95rem;
    color: #1D1D1F;
    transition: all 0.2s ease;
    outline: none;
    width: 100%;
}

.ef-input::placeholder {
    color: #86868B;
}

.ef-input:focus {
    background: #FFFFFF;
    border-color: #0071E3;
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textbox;
}

/* --- Buttons --- */
.ef-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #0071E3;
    color: white;
    border-radius: 12px;
    padding: 14px 28px;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ef-btn:hover {
    background: #0077ED;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 113, 227, 0.3);
}

.ef-btn:active {
    transform: translateY(0);
}

.ef-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ef-btn-secondary {
    background: #F5F5F7;
    color: #1D1D1F;
}

.ef-btn-secondary:hover {
    background: #E8E8ED;
    box-shadow: none;
}

.ef-btn-danger {
    background: #FF3B30;
}

.ef-btn-danger:hover {
    background: #FF453A;
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3);
}

.ef-btn-sm {
    padding: 10px 20px;
    font-size: 0.875rem;
    border-radius: 10px;
}

/* --- Sidebar --- */
.ef-sidebar {
    width: 280px;
    background: #FFFFFF;
    border-left: 1px solid rgba(0, 0, 0, 0.06);
    height: 100vh;
    position: fixed;
    top: 0;
    right: 0;
    overflow-y: auto;
    z-index: 40;
    transition: transform 0.3s ease;
    transform: translateX(100%);
}
.ef-sidebar.open {
    transform: translateX(0);
}
.ef-sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #86868B;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.15s ease;
    border-radius: 12px;
    margin: 2px 12px;
    text-decoration: none;
}

.ef-sidebar-link:hover,
.ef-sidebar-link.active {
    background: #F5F5F7;
    color: #1D1D1F;
}

.ef-sidebar-link.active {
    font-weight: 600;
}

.ef-sidebar-section {
    font-size: 0.7rem;
    font-weight: 700;
    color: #86868B;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 20px 24px 8px;
}

/* --- Topbar --- */
.ef-topbar {
    height: 56px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 30;
}

/* --- Semaforo --- */
.semaforo-green  { background: #34C759; }
.semaforo-yellow { background: #FFD60A; }
.semaforo-orange { background: #FF9500; }
.semaforo-red    { background: #FF3B30; }

.semaforo-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* --- Toast (no browser alerts) --- */
.ef-toast-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.ef-toast-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.ef-toast-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: #FFFFFF;
    border-radius: 28px;
    padding: 40px 36px 28px;
    text-align: center;
    min-width: 320px;
    max-width: 420px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ef-toast-box.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

/* --- Snackbar (auto-closing success) --- */
.ef-snackbar {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1d1d1f;
    color: #fff;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 99999;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    pointer-events: none;
}
.ef-snackbar.active {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.ef-snackbar svg {
    color: #34C759;
    flex-shrink: 0;
}

/* --- Modal (reusable) --- */
.ef-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9996;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.ef-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.ef-modal-box {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: #FFFFFF;
    border-radius: 28px;
    padding: 28px;
    min-width: 400px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    z-index: 9997;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ef-modal-box.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

/* --- Table Map --- */
.ef-table-map-canvas {
    position: relative;
    background: #E8F4FD;
    border-radius: 16px;
    overflow: hidden;
    min-height: 500px;
    border: 1px solid #C8E1F2;
    touch-action: none;
    overscroll-behavior: none;
}

/* Map legend */
.ef-map-legend {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    padding: 5px 10px;
    z-index: 5;
    display: flex;
    flex-direction: row;
    gap: 10px;
}
.ef-map-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.65rem;
    color: #48484A;
    font-weight: 500;
}
.ef-map-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1.5px solid;
    flex-shrink: 0;
}

/* Table wrapper (absolute positioned) */
.ef-table-wrap {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    user-select: none;
    z-index: 1;
    cursor: pointer;
}
.ef-table-wrap.dragging {
    z-index: 100;
    filter: brightness(1.2);
}

/* Main table body */
.ef-table-body {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
}
.ef-table-body.square {
    border-radius: 10px;
    background: #E8E8ED;
    border: 2px solid #C7C7CC;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.ef-table-body.round {
    border-radius: 50%;
    background: #E8E8ED;
    border: 2px solid #C7C7CC;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.ef-table-wrap:hover .ef-table-body {
    transform: scale(1.04);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* States */
.ef-table-wrap.occupied .ef-table-body {
    background: #0071E3;
    border-color: #409CFF;
    box-shadow: 0 2px 8px rgba(0,113,227,0.25);
}
.ef-table-wrap.occupied { cursor: not-allowed; }
.ef-table-wrap.confirmed .ef-table-body {
    background: #34C759;
    border-color: #4ADE80;
    box-shadow: 0 2px 8px rgba(52,199,89,0.25);
}
.ef-table-wrap.inactive .ef-table-body {
    background: #D2D2D7;
    border-color: #C7C7CC;
    opacity: 0.45;
}
.ef-table-wrap.selected .ef-table-body {
    border-color: #0071E3;
    box-shadow: 0 0 0 3px rgba(0,113,227,0.3), 0 2px 8px rgba(0,113,227,0.15);
}

/* Drag-to-move: source ghost (semi-transparent) */
.ef-table-wrap.drag-source-ghost {
    opacity: 0.3;
    pointer-events: none;
}

/* Drag-to-move: free table = green border */
.ef-table-wrap.drop-target-free .ef-table-body {
    border-color: #34C759;
    box-shadow: 0 0 0 2px rgba(52,199,89,0.3);
}

/* Drag-to-move: occupied table = orange border (merge) */
.ef-table-wrap.drop-target-merge .ef-table-body {
    border-color: #FF9500;
    box-shadow: 0 0 0 2px rgba(255,149,0,0.3);
}

/* Drag-to-move: hover on drop target */
.ef-table-wrap.drop-hover .ef-table-body {
    transform: scale(1.1);
    box-shadow: 0 0 0 4px rgba(0,113,227,0.5), 0 4px 16px rgba(0,0,0,0.15);
}

/* Drag ghost (follows cursor) */
.ef-drag-ghost {
    position: fixed;
    transform: translate(-50%, -120%);
    background: rgba(0,113,227,0.9);
    color: #fff;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    backdrop-filter: blur(8px);
}

/* Room tab drag target highlight */
.tavoli-room-tab.drag-target-room {
    border-color: #0071E3 !important;
    background: #e8f4fd !important;
}
.tavoli-room-tab.drag-hover {
    background: #0071E3 !important;
    color: #fff !important;
    transform: scale(1.05);
}

/* Table number */
.ef-table-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: #1D1D1F;
    text-align: center;
    line-height: 1;
}
.ef-table-wrap.occupied .ef-table-name,
.ef-table-wrap.confirmed .ef-table-name {
    color: #FFFFFF;
}
.ef-table-capacity {
    font-size: 0.5rem;
    color: #86868B;
    margin-top: 1px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.ef-table-wrap.occupied .ef-table-capacity,
.ef-table-wrap.confirmed .ef-table-capacity {
    color: rgba(255,255,255,0.7);
}

/* Customer name below table (when occupied) */
.ef-table-customer {
    font-size: 0.5rem;
    color: #1D1D1F;
    text-align: center;
    margin-top: 2px;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

/* Chairs hidden */
.ef-chair, .ef-chair-rect { display: none; }

/* Table info text (covers, total) inside table body */
.ef-table-info {
    font-size: 0.5rem;
    font-weight: 600;
    line-height: 1;
    margin-top: 1px;
    text-align: center;
}
.ef-table-total {
    font-weight: 700;
    font-size: 0.55rem;
}

/* Info below table (timer, notes, badge) */
.ef-table-below {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 2px;
    max-width: 90px;
}
.ef-table-timer {
    font-size: 0.45rem;
    font-weight: 600;
    white-space: nowrap;
    margin-top: 1px;
}
.ef-table-tablet-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #FF9500;
    color: #fff;
    font-size: 0.5rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 6px;
    line-height: 1.3;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    z-index: 2;
}
.ef-table-note-icon {
    font-size: 0.5rem;
    cursor: help;
}
.ef-table-badge-preconto {
    font-size: 0.4rem;
    font-weight: 700;
    background: #f57f17;
    color: #fff;
    padding: 1px 4px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Status cursor overrides */
.ef-table-wrap.status-free { cursor: pointer; }
.ef-table-wrap.status-open,
.ef-table-wrap.status-ordered,
.ef-table-wrap.status-preconto { cursor: pointer; }

/* Resize handle */
.ef-map-resize-handle {
    height: 12px;
    cursor: ns-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.02);
    border-radius: 0 0 16px 16px;
    transition: background 0.15s ease;
}
.ef-map-resize-handle:hover,
.ef-map-resize-handle.dragging {
    background: rgba(0,0,0,0.06);
}
.ef-map-resize-handle::after {
    content: '';
    width: 40px;
    height: 3px;
    border-radius: 2px;
    background: #C7C7CC;
}
.ef-map-resize-handle:hover::after,
.ef-map-resize-handle.dragging::after {
    background: #86868B;
}

/* --- Stat Card --- */
.ef-stat-card {
    background: #FFFFFF;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.ef-stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* --- Badge --- */
.ef-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.ef-badge-green  { background: #E8F8EE; color: #1B7A3D; }
.ef-badge-yellow { background: #FFF8E1; color: #8B6914; }
.ef-badge-orange { background: #FFF3E0; color: #9A5B13; }
.ef-badge-red    { background: #FFECED; color: #C41E22; }
.ef-badge-blue   { background: #E8F0FE; color: #1A56DB; }
.ef-badge-gray   { background: #F5F5F7; color: #86868B; }

/* --- Responsive --- */

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #D2D2D7;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #86868B;
}

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ef-fade-in {
    animation: fadeIn 0.4s ease forwards;
}

/* --- Read-only Banner --- */
.ef-readonly-banner {
    background: linear-gradient(135deg, #FF9500, #FF3B30);
    color: white;
    text-align: center;
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
}

/* --- Dashboard: Day Navigation --- */
.ef-day-nav {
    background: #FFFFFF;
    border-radius: 20px;
    padding: 12px 16px 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.ef-day-nav-arrow {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: #86868B;
    transition: all 0.15s ease;
    background: transparent;
    border: none;
    cursor: pointer;
}
.ef-day-nav-arrow:hover {
    background: #F5F5F7;
    color: #1D1D1F;
}

.ef-day-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 6px 8px;
    border-radius: 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    flex: 1;
    min-width: 0;
}
.ef-day-btn:hover {
    background: #F5F5F7;
}
.ef-day-btn.active {
    background: rgba(0, 113, 227, 0.10);
}
.ef-day-btn.active .ef-day-name,
.ef-day-btn.active .ef-day-num {
    color: #1D1D1F;
    font-weight: 700;
}
.ef-day-btn.active .ef-day-today-label {
    color: #1D1D1F;
}
.ef-day-btn.today .ef-day-num {
    color: #0071E3;
    font-weight: 700;
}

.ef-day-name {
    font-size: 0.6rem;
    font-weight: 600;
    color: #86868B;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.ef-day-num {
    font-size: 1.05rem;
    font-weight: 600;
    color: #1D1D1F;
}
.ef-day-today-label {
    font-size: 0.55rem;
    font-weight: 700;
    color: #0071E3;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1;
}


/* --- Dashboard: Day Badges (shift counts) --- */
.ef-day-badges {
    display: flex;
    gap: 3px;
    margin-top: 2px;
}
.ef-day-badge {
    font-size: 0.55rem;
    font-weight: 700;
    line-height: 1;
    padding: 2px 5px;
    border-radius: 6px;
    color: #FFFFFF;
    min-width: 16px;
    text-align: center;
}
.ef-day-badge-empty  { background: #E5E5EA; color: #86868B; }
.ef-day-badge-green  { background: #34C759; }
.ef-day-badge-yellow { background: #FFD60A; color: #1D1D1F; }
.ef-day-badge-orange { background: #FF9500; }
.ef-day-badge-red    { background: #FF3B30; }
.ef-day-badge-closed { background: #D2D2D7; color: #86868B; }
.ef-day-btn.active .ef-day-badge-green  { background: #34C759; }
.ef-day-btn.active .ef-day-badge-yellow { background: #FFD60A; color: #1D1D1F; }
.ef-day-btn.active .ef-day-badge-orange { background: #FF9500; }
.ef-day-btn.active .ef-day-badge-red    { background: #FF3B30; }

/* --- Dashboard: Stats --- */
.ef-dash-stat {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #FFFFFF;
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
}
.ef-dash-stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* --- Dashboard: Tab Bar --- */
.ef-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #86868B;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}
.ef-tab-btn:hover {
    color: #1D1D1F;
}
.ef-tab-btn.active {
    background: #FFFFFF;
    color: #1D1D1F;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* --- Dashboard: Booking Row --- */
.ef-booking-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    cursor: pointer;
    transition: background 0.15s ease;
}
.ef-booking-row:last-child {
    border-bottom: none;
}
.ef-booking-row:hover {
    background: #FAFAFA;
}

.ef-booking-time {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 44px;
}

.ef-booking-actions {
    opacity: 0.4;
    transition: opacity 0.15s ease;
}
.ef-booking-row:hover .ef-booking-actions {
    opacity: 1;
}

/* --- Dashboard: Action Buttons --- */
.ef-action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}
.ef-action-btn:hover {
    transform: scale(1.1);
    filter: brightness(1.1);
}
.ef-action-seen {
    background: #E8F0FE;
    color: #0071E3;
}
.ef-action-confirm {
    background: #E8F8EE;
    color: #34C759;
}
.ef-action-complete {
    background: #E8F8EE;
    color: #30A14E;
}
.ef-action-table {
    background: #F0E6FF;
    color: #8B5CF6;
}
.ef-action-noshow {
    background: #FFECED;
    color: #FF3B30;
}
.ef-action-trash {
    background: #FFECED;
    color: #FF3B30;
}

/* --- Mobile adjustments for dashboard --- */
@media (max-width: 640px) {
    .ef-booking-actions {
        opacity: 1;
    }
    .ef-booking-row {
        padding: 12px 14px;
        gap: 10px;
    }
    .ef-day-btn {
        padding: 4px 2px;
    }
    .ef-day-num {
        font-size: 0.95rem;
    }
}
