/**
 * Custom styles for Dental Practice Goals Manager
 * Built on Bootstrap 5
 */

:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --info-color: #0dcaf0;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --dark-color: #212529;
    --light-color: #f8f9fa;
}

/* General Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f7fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* Navbar */
.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

.navbar-text {
    font-size: 0.95rem;
}

/* Cards */
.card {
    border: none;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    border-radius: 0.5rem 0.5rem 0 0 !important;
    font-weight: 600;
    padding: 1rem 1.25rem;
}

.card-body {
    padding: 1.5rem;
}

.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

.shadow-lg {
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Forms */
.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #495057;
}

.form-control:focus,
.form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.form-control-sm {
    font-size: 0.875rem;
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table thead th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #dee2e6;
}

.table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

.table-responsive {
    border-radius: 0.375rem;
}

.table-bordered {
    border: 1px solid #dee2e6;
}

.table-bordered td,
.table-bordered th {
    border: 1px solid #dee2e6;
}

/* Buttons */
.btn {
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease-in-out;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.btn-danger {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
}

/* Alerts */
.alert {
    border-radius: 0.5rem;
    border: none;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
}

.alert-danger {
    background-color: #f8d7da;
    color: #842029;
}

.alert-warning {
    background-color: #fff3cd;
    color: #664d03;
}

.alert-info {
    background-color: #cff4fc;
    color: #055160;
}

/* Input Groups */
.input-group-text {
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    font-weight: 500;
}

/* Month Selector */
#monthSelector {
    font-size: 1rem;
    font-weight: 500;
}

/* Dashboard Specific */
.dashboard-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
}

/* Provider Tables */
#providerTargetsTable input,
#providerHoursTable input {
    min-width: 80px;
}

.actual-days {
    font-weight: 600;
    color: var(--success-color);
}

.total-hours {
    font-weight: 600;
    color: var(--info-color);
}

/* Footer */
footer {
    margin-top: auto;
    border-top: 1px solid #dee2e6;
}

/* Utilities */
.bg-light {
    background-color: #f8f9fa !important;
}

.text-muted {
    color: #6c757d !important;
}

/* Icons */
.bi {
    vertical-align: -0.125em;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }

    .table {
        font-size: 0.875rem;
    }

    .btn {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h5 {
        font-size: 1.1rem;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* Custom scrollbar for tables */
.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Loading states */
.btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn .spinner-border-sm {
    width: 0.875rem;
    height: 0.875rem;
    border-width: 0.125em;
}

/* Page loader overlay */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(3px);
}

.page-loader .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3em;
}

/* Multi-select dropdown for filters */
.multi-select-dropdown {
    position: relative;
    display: inline-block;
    min-width: 160px;
}

.multi-select-button {
    padding: 0.25rem 0.5rem;
    border: 1px solid #ced4da;
    background: white;
    cursor: pointer;
    border-radius: 0.375rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    min-height: 31px;
}

.multi-select-button:hover {
    border-color: #86b7fe;
}

.multi-select-dropdown-content {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 100%;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    z-index: 1000;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    margin-top: 2px;
}

.multi-select-dropdown-content.show {
    display: block;
}

.multi-select-option {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    user-select: none;
    font-size: 0.875rem;
}

.multi-select-option:hover {
    background-color: #f8f9fa;
}

.multi-select-option input[type="checkbox"] {
    margin-right: 0.5rem;
    cursor: pointer;
}

.multi-select-option label {
    cursor: pointer;
    flex: 1;
    margin-bottom: 0;
}

/* Saved row styles for goals tables */
.saved-row {
    background-color: #f8f9fa;
}

.saved-row:hover {
    background-color: #e9ecef !important;
}

.saved-input {
    background-color: #e9ecef !important;
    color: #495057;
    cursor: not-allowed;
}

.saved-input:focus {
    background-color: #e9ecef !important;
    box-shadow: none;
}

.saved-badge {
    font-size: 0.7rem;
}

/* Edit button for saved rows - appears on hover */
.edit-row-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease-in-out;
}

.saved-row:hover .edit-row-btn {
    opacity: 1;
    pointer-events: auto;
}

/* Prevent button from shifting on hover */
.edit-row-btn:hover {
    transform: translateY(-50%);
    box-shadow: none;
}

/* When in editing mode */
.saved-row.editing {
    background-color: #fff3cd !important;
}

.saved-row.editing .saved-input {
    background-color: white !important;
    cursor: text;
}

/* Office goals saved state */
.office-goals-saved {
    background-color: #f8f9fa;
    border: 2px solid #198754;
    position: relative;
}

.office-goals-saved .saved-indicator {
    position: absolute;
    top: -12px;
    right: 15px;
    background-color: #198754;
    color: white;
    padding: 6px 16px;
    border-radius: 15px;
    font-size: 0.95rem;
    font-weight: 500;
}

/* Location switcher dropdown */
.location-switcher-menu {
    padding: 0.5rem 0;
}

.location-switcher-menu .dropdown-header {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    padding: 0.5rem 1rem;
    margin-top: 0.5rem;
}

.location-switcher-menu .dropdown-header:first-child {
    margin-top: 0;
}

.location-switch-item {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.location-switch-item i {
    margin-right: 0.5rem;
}

.location-switch-item.active {
    background-color: #e7f1ff;
    color: #0d6efd;
    font-weight: 500;
}

.location-switch-item:hover:not(.active) {
    background-color: #f8f9fa;
}

/* Month Calendar Picker for Admins */
.month-calendar-picker {
    background: #fff;
    border-radius: 0.375rem;
}

.month-calendar-picker .calendar-header {
    padding: 0.5rem 0;
    border-bottom: 1px solid #dee2e6;
}

.month-calendar-picker .calendar-months {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    padding: 0.75rem 0;
}

.month-calendar-picker .month-btn {
    padding: 0.5rem 0.25rem;
    border: 1px solid #dee2e6;
    background: #fff;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s ease-in-out;
    text-align: center;
}

.month-calendar-picker .month-btn:hover {
    background: #e7f1ff;
    border-color: #86b7fe;
}

.month-calendar-picker .month-btn.selected {
    background: #0d6efd;
    color: #fff;
    border-color: #0d6efd;
}

.month-calendar-picker .month-btn.current-month {
    border-color: #198754;
    font-weight: 600;
}

.month-calendar-picker .month-btn.current-month:not(.selected) {
    background: #d1e7dd;
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    footer {
        display: none;
    }

    .card {
        break-inside: avoid;
    }

    .page-loader {
        display: none;
    }
}
