/* ============================================================
   ProspeCRM - Componentes Reutilizables
   ============================================================ */

/* --- Modal --- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 250;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-backdrop.visible {
    opacity: 1;
}

.modal {
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    background: #fff;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    overflow: hidden;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.modal-backdrop.visible .modal {
    transform: translateY(0);
}

.modal-handle {
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: var(--radius-full);
    margin: 10px auto 0;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px 0;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 700;
}

.modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

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

.modal-footer .btn {
    flex: 1;
}

/* --- Tabs --- */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    padding: 0 16px;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
    padding: 10px 16px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition-fast);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* --- Toggle Switch --- */
.toggle {
    position: relative;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-track {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.toggle input:checked + .toggle-track {
    background: var(--primary);
}

.toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.toggle input:checked ~ .toggle-thumb {
    transform: translateX(20px);
}

/* --- Activity Feed --- */
.activity-feed {
    display: flex;
    flex-direction: column;
}

.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon svg {
    width: 18px;
    height: 18px;
}

.activity-body {
    flex: 1;
    min-width: 0;
}

.activity-text {
    font-size: 0.8125rem;
    color: var(--text);
    line-height: 1.4;
}

.activity-text strong {
    font-weight: 600;
}

.activity-time {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* --- Establishment Detail --- */
.est-detail-header {
    position: relative;
    width: 100%;
    height: 200px;
    background: var(--bg);
    overflow: hidden;
}

.est-detail-header img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.est-detail-header-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: #fff;
}

.est-detail-title {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.2;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.est-detail-category {
    font-size: 0.8125rem;
    opacity: 0.85;
    margin-top: 2px;
}

.est-detail-back {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 36px;
    height: 36px;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(8px);
    border: none;
    border-radius: var(--radius-full);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.est-detail-back svg {
    width: 20px;
    height: 20px;
}

/* --- Detail Section --- */
.detail-section {
    padding: 16px;
    border-bottom: 8px solid var(--bg);
}

.detail-section-title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* --- Detail Info Row --- */
.info-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.info-row:last-child {
    border-bottom: none;
}

.info-row-icon {
    width: 20px;
    height: 20px;
    stroke: var(--text-secondary);
    flex-shrink: 0;
    margin-top: 1px;
}

.info-row-content {
    flex: 1;
    min-width: 0;
}

.info-row-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-bottom: 1px;
}

.info-row-value {
    font-size: 0.875rem;
    color: var(--text);
    word-break: break-word;
}

.info-row-value a {
    color: var(--primary);
    font-weight: 500;
}

/* --- Action Buttons (in detail) --- */
.action-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 0;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: var(--font);
}

.action-btn:active {
    transform: scale(0.96);
    background: var(--primary-lighter);
}

.action-btn svg {
    width: 22px;
    height: 22px;
    stroke: var(--primary);
}

.action-btn-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* --- Map Container --- */
.map-container {
    width: 100%;
    height: 200px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    position: relative;
    z-index: 0;
}

.map-container.large {
    height: 300px;
}

.map-container.fullscreen {
    height: calc(100vh - var(--topbar-height) - var(--nav-height) - var(--safe-bottom) - 120px);
}

/* --- Opening Hours --- */
.hours-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.hours-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.8125rem;
    border-bottom: 1px solid #F1F5F9;
}

.hours-item:last-child {
    border-bottom: none;
}

.hours-day {
    font-weight: 600;
    color: var(--text);
    text-transform: capitalize;
}

.hours-time {
    color: var(--text-secondary);
}

.hours-item.today {
    background: var(--primary-lighter);
    margin: 0 -8px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
}

.hours-closed {
    color: var(--error);
    font-weight: 500;
}

/* --- Additional Info Badges --- */
.info-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.info-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg);
    border-radius: var(--radius-full);
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.info-badge.positive {
    background: var(--success-bg);
    color: #15803D;
}

.info-badge.negative {
    background: var(--error-bg);
    color: #991B1B;
    text-decoration: line-through;
    opacity: 0.6;
}

/* --- Kanban Board --- */
.kanban-wrapper {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.kanban-wrapper::-webkit-scrollbar { display: none; }

.kanban-column {
    min-width: 260px;
    max-width: 280px;
    background: var(--bg);
    border-radius: var(--radius-lg);
    padding: 12px;
    flex-shrink: 0;
}

.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.kanban-column-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    font-weight: 700;
}

.kanban-column-count {
    font-size: 0.6875rem;
    font-weight: 700;
    color: #fff;
    background: var(--text-muted);
    width: 22px;
    height: 22px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.kanban-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition-fast);
}

.kanban-card:active {
    box-shadow: var(--shadow-md);
}

.kanban-card-title {
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.kanban-card-meta {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

/* --- Calendar --- */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.calendar-current {
    font-size: 1rem;
    font-weight: 700;
    min-width: 160px;
    text-align: center;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.calendar-day-header {
    padding: 8px 4px;
    text-align: center;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg);
}

.calendar-day {
    min-height: 50px;
    padding: 4px;
    background: #fff;
    cursor: pointer;
    position: relative;
}

.calendar-day:hover {
    background: var(--primary-lighter);
}

.calendar-day.today {
    background: var(--primary-lighter);
}

.calendar-day-number {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text);
}

.calendar-day.other-month .calendar-day-number {
    color: var(--text-muted);
}

.calendar-event-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-top: 2px;
    display: inline-block;
}

/* --- Weekly Calendar --- */
.week-view {
    display: flex;
    flex-direction: column;
}

.week-day {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.week-day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.week-day-name {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text);
}

.week-day-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.week-event {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--primary-lighter);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    cursor: pointer;
}

.week-event-time {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
}

.week-event-title {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Ranking List --- */
.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ranking-position {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    flex-shrink: 0;
}

.ranking-position.gold { background: #FEF3C7; color: #92400E; }
.ranking-position.silver { background: #F1F5F9; color: #475569; }
.ranking-position.bronze { background: #FED7AA; color: #9A3412; }
.ranking-position.default { background: var(--bg); color: var(--text-muted); }

.ranking-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.ranking-info {
    flex: 1;
    min-width: 0;
}

.ranking-name {
    font-size: 0.875rem;
    font-weight: 600;
}

.ranking-stats {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.ranking-bar {
    width: 80px;
    height: 6px;
    background: var(--bg);
    border-radius: var(--radius-full);
    overflow: hidden;
    flex-shrink: 0;
}

.ranking-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-full);
    transition: width 0.6s ease;
}

/* --- Notification Item --- */
.notification-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition-fast);
}

.notification-item.unread {
    background: var(--primary-lighter);
}

.notification-item:hover {
    background: var(--bg);
}

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon svg {
    width: 18px;
    height: 18px;
}

.notification-body {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
}

.notification-message {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.notification-time {
    font-size: 0.625rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- Audit Log Table --- */
.audit-table {
    width: 100%;
    overflow-x: auto;
}

.audit-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.audit-table th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.audit-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.audit-table tr:hover td {
    background: var(--bg);
}

/* --- File Upload Zone --- */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-lighter);
}

.upload-zone svg {
    width: 40px;
    height: 40px;
    stroke: var(--text-muted);
    margin-bottom: 12px;
}

.upload-zone p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.upload-zone .upload-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- Floating Action Button (FAB) --- */
.fab {
    position: fixed;
    bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
    right: 16px;
    width: 56px;
    height: 56px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    transition: var(--transition);
}

.fab:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.fab:active {
    transform: scale(0.95);
}

.fab svg {
    width: 24px;
    height: 24px;
}

/* --- View Toggle (List/Map) --- */
.view-toggle {
    display: flex;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 3px;
    border: 1px solid var(--border);
}

.view-toggle-btn {
    flex: 1;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.view-toggle-btn.active {
    background: #fff;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.view-toggle-btn svg {
    width: 16px;
    height: 16px;
}
