/* ==========================================
   TABLE.CSS - Table and Modal Styles
   ========================================== */

/* Table Styles */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background-color: #FFFFFF;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table thead th {
    background-color: #2B2B2B;
    color: #FFFFFF;
    padding: 0.75rem;
    text-align: left;
    border-bottom: 2px solid #E84E1B;
    font-weight: 600;
}

.table thead th.sortable-header {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
    position: relative;
}

.table thead th.sortable-header:hover {
    background-color: #3A3A3A;
}

.table thead th.sortable-header:active {
    background-color: #E84E1B;
}

.sort-indicator {
    margin-left: 0.5rem;
    display: inline-flex;
    align-items: center;
    color: #E84E1B;
    vertical-align: middle;
}

.sort-indicator svg {
    display: block;
}

.table tbody td {
    padding: 0.75rem;
    border-bottom: 1px solid #E0E0E0;
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr.clickable-row {
    cursor: pointer;
}

.table tbody tr.clickable-row:hover {
    background-color: #FFF3E0;
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(232, 78, 27, 0.15);
}

/* Distance Badge */
.distance-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    background-color: #E8F5E9;
    color: #2E7D32;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
}

.distance-badge.loading {
    background-color: #FFF3E0;
    color: #E65100;
    padding: 0.25rem 0.5rem;
}

.distance-badge.error {
    background-color: #F5F5F5;
    color: #757575;
}

/* Type Badge */
.type-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.type-badge.personal {
    background-color: #E3F2FD;
    color: #1976D2;
}

.type-badge.work {
    background-color: #F3E5F5;
    color: #7B1FA2;
}

.table-footer-disclaimer {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background-color: #FFF3E0;
    border-left: 3px solid #E84E1B;
    border-radius: 0.25rem;
    font-size: 0.85rem;
    color: #E84E1B;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.table-footer-disclaimer svg {
    flex-shrink: 0;
    color: #E84E1B;
}

/* Modal Styles (General) - Used by AppointmentModal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
    animation: fadeIn 0.2s ease-out;
    overflow-y: auto; /* Allow scrolling if content is too tall */
}

.modal-content {
    background: white;
    border-radius: 1rem;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUpModal 0.3s ease-out;
    margin: auto; /* Center in the overlay */
}

/* Mobile-specific modal adjustments */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 0.5rem;
        align-items: center; /* Center on mobile too */
    }

    .modal-content {
        margin: auto;
        max-height: calc(100vh - 2rem);
        border-radius: 1rem;
    }

    .modal-body {
        padding: 1.5rem;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }

    .detail-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .detail-value {
        text-align: left;
    }
}

/* Extra small devices (phones in portrait) */
@media (max-width: 480px) {
    .modal-overlay {
        padding: 0.5rem;
    }
    
    .modal-content {
        border-radius: 0.75rem;
        max-height: calc(100vh - 1rem);
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-header h2 {
        font-size: 1.25rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 1rem;
    }
}

@keyframes slideUpModal {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: linear-gradient(135deg, #F5F5F5 0%, #E0E0E0 100%);
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: #E84E1B;
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(232, 78, 27, 0.15);
}

.stat-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #E84E1B;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #E84E1B;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.95rem;
    color: #666;
    font-weight: 500;
}

/* Appointments Specific Styles */
.appointments-tabs {
    display: flex;
    justify-content:space-between;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #E0E0E0;
}

.tab-button {
    background: none;
    border: none;
    color: #666;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    position: relative;
    bottom: -2px;
}

.tab-button:hover {
    color: #E84E1B;
}

.tab-button.active {
    color: #E84E1B;
    border-bottom-color: #E84E1B;
}

.tab-button svg {
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* Settings Section */
.settings-container {
    max-width: 800px;
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.settings-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #E0E0E0;
}

.settings-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.settings-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2B2B2B;
    margin-bottom: 1rem;
}

.toggle-switch {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 1rem;
    gap: 1rem;
}

.toggle-switch input[type="checkbox"] {
    width: 40px;
    height: 24px;
    margin: 0;
    cursor: pointer;
}

.toggle-slider {
    display: inline-block;
    width: 50px;
    height: 24px;
    background-color: #ccc;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s;
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider {
    background-color: #E84E1B;
}

.age-limit-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #E0E0E0;
    outline: none;
    -webkit-appearance: none;
}

.age-limit-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #E84E1B;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.age-limit-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #E84E1B;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: none;
}

.age-limit-value {
    display: block;
    margin-top: 0.5rem;
    color: #E84E1B;
    font-weight: 600;
    font-size: 1.1rem;
}

.btn-google {
    background: #4285F4;
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-google:hover:not(:disabled) {
    background: #357AE8;
}

.btn-google:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.imported-events-preview {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #E0E0E0;
}

.imported-events-preview h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #2B2B2B;
    margin-bottom: 1rem;
}

.event-preview-card {
    background: #F9F9F9;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    border-left: 3px solid #E84E1B;
}

.event-preview-card strong {
    display: block;
    color: #2B2B2B;
    margin-bottom: 0.25rem;
}

.event-preview-card span {
    color: #666;
    font-size: 0.875rem;
}
