/**
 * ===========================================
 * Reusable UI Components - AppointGenius BO
 * ===========================================
 *
 * This file contains reusable component styles that can be shared
 * across different parts of the application.
 */

/* ===========================================
   BADGES - Global Styling
   =========================================== */

/* Center align all badge content (icons + text) */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    vertical-align: middle;
}

.badge i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ===========================================
   INFO BOXES & ALERTS
   =========================================== */

/* Generic Info Box - can be colored with variants */
.info-box {
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.info-box i {
    font-size: 1.1rem;
    margin-top: 0.1rem;
}

/* Info Box Variants */
.info-box.info-primary {
    background: rgba(32, 201, 151, 0.1);
    border-color: #20c997;
    color: #0a2b22;
}

.info-box.info-primary i {
    color: #20c997;
}

.info-box.info-blue {
    background: rgba(13, 110, 253, 0.1);
    border-color: #0d6efd;
    color: #084298;
}

.info-box.info-blue i {
    color: #0d6efd;
}

.info-box.info-warning {
    background: rgba(255, 193, 7, 0.1);
    border-color: #ffc107;
    color: #856404;
}

.info-box.info-warning i {
    color: #ffc107;
}

.info-box.info-danger {
    background: rgba(220, 53, 69, 0.1);
    border-color: #dc3545;
    color: #721c24;
}

.info-box.info-danger i {
    color: #dc3545;
}

/* ===========================================
   BADGES
   =========================================== */

.badge-premium {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ===========================================
   AVATAR
   =========================================== */

.avatar {
    border-radius: 50%;
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar i {
    color: #6c757d;
}

/* Avatar Sizes */
.avatar-xs {
    width: 32px;
    height: 32px;
}

.avatar-xs i {
    font-size: 0.9rem;
}

.avatar-sm {
    width: 40px;
    height: 40px;
}

.avatar-sm i {
    font-size: 1rem;
}

.avatar-md {
    width: 48px;
    height: 48px;
}

.avatar-md i {
    font-size: 1.2rem;
}

.avatar-lg {
    width: 64px;
    height: 64px;
}

.avatar-lg i {
    font-size: 1.5rem;
}

/* ===========================================
   SELECTABLE ITEMS (with checkbox/selection)
   =========================================== */

.selectable-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.selectable-item:hover {
    border-color: var(--color-primary, #20c997);
    box-shadow: 0 4px 12px rgba(32, 201, 151, 0.15);
    transform: translateY(-2px);
}

.selectable-item.selected {
    border-color: var(--color-primary, #20c997);
    background: linear-gradient(135deg, rgba(32, 201, 151, 0.05) 0%, rgba(40, 167, 69, 0.05) 100%);
    box-shadow: 0 4px 12px rgba(32, 201, 151, 0.2);
}

.selectable-item-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.selectable-item-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.selectable-item-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #2d3748;
}

.selectable-item-subtitle {
    font-size: 0.8rem;
    color: #6c757d;
}

/* ===========================================
   CUSTOM CHECKBOX
   =========================================== */

.custom-checkbox {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-checkbox input[type="checkbox"] {
    appearance: none;
    width: 24px;
    height: 24px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.custom-checkbox input[type="checkbox"]:hover {
    border-color: var(--color-primary, #20c997);
}

.custom-checkbox input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #20c997 0%, #28a745 100%);
    border-color: var(--color-primary, #20c997);
}

.custom-checkbox input[type="checkbox"]:checked::after {
    content: '\f00c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.75rem;
}

/* ===========================================
   SCROLLABLE LIST
   =========================================== */

.scrollable-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.scrollable-list::-webkit-scrollbar {
    width: 6px;
}

.scrollable-list::-webkit-scrollbar-track {
    background: #f1f3f4;
    border-radius: 10px;
}

.scrollable-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

.scrollable-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ===========================================
   EMPTY STATE
   =========================================== */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 3rem;
    color: #adb5bd;
    margin-bottom: 1rem;
}

.empty-state p,
.empty-state h6 {
    margin: 0;
    font-size: 0.95rem;
}

.empty-state h6 {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

/* ===========================================
   CHIPS (Tags/Labels)
   =========================================== */

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.chip-warning {
    background: linear-gradient(135deg, rgba(230, 177, 23, 0.78) 0%, rgba(243, 187, 10, 0.68) 100%);
    border: 1px solid rgba(230, 181, 17, 0.64);
    color: #070707;
}

.chip-warning:hover {
    background: linear-gradient(135deg, rgba(243, 187, 10, 0.88) 0%, rgba(243, 187, 10, 0.78) 100%);
    border: 1px solid rgba(230, 181, 17, 0.84);
    transform: translateY(-1px);
}

.chip-primary {
    background: linear-gradient(135deg, rgba(32, 201, 151, 0.1) 0%, rgba(40, 167, 69, 0.1) 100%);
    border: 1px solid rgba(32, 201, 151, 0.3);
    color: #0a2b22;
}

.chip-primary:hover {
    background: linear-gradient(135deg, rgba(32, 201, 151, 0.15) 0%, rgba(40, 167, 69, 0.15) 100%);
    border-color: rgba(32, 201, 151, 0.5);
    transform: translateY(-1px);
}

.chip-secondary {
    background: rgba(108, 117, 125, 0.1);
    border: 1px solid rgba(108, 117, 125, 0.3);
    color: #495057;
}

.chip-removable .chip-remove-btn {
    width: 16px;
    height: 16px;
    border: none;
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s ease;
}

.chip-removable .chip-remove-btn:hover {
    background: #dc3545;
    color: white;
    transform: scale(1.15);
}

.chip-removable .chip-remove-btn i {
    font-size: 0.6rem;
}

/* ===========================================
   ICON BUTTONS
   =========================================== */

.btn-icon-sm {
    width: 28px;
    height: 28px;
    border: 2px dashed;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.btn-icon-sm i {
    font-size: 0.8rem;
}

.btn-icon-sm.btn-add {
    border-color: var(--color-primary, #20c997);
    background: rgba(32, 201, 151, 0.1);
    color: var(--color-primary, #20c997);
}

.btn-icon-sm.btn-add:hover {
    background: var(--color-primary, #20c997);
    color: white;
    border-color: var(--color-primary, #20c997);
    transform: scale(1.1);
}

/* ===========================================
   STATUS BADGES
   =========================================== */

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Status Badge Variants - Appointment States */
.status-scheduled {
    background-color: #e3f2fd;
    color: #1976d2;
}

.status-confirmed {
    background-color: #e8f5e9;
    color: #388e3c;
}

.status-inprogress {
    background-color: #fff3e0;
    color: #f57c00;
}

.status-completed {
    background-color: #f1f8e9;
    color: #689f38;
}

.status-cancelled {
    background-color: #ffebee;
    color: #d32f2f;
}

/* Badge Variants - Modal Actions */
.badge-new {
    background: rgba(34, 197, 94, 0.2);
    color: #16a34a;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-edit {
    background: rgba(59, 130, 246, 0.2);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-duplicate {
    background-color: rgba(0, 123, 255, 0.1);
    color: #007bff;
}

.badge-birthday {
    background-color: rgba(255, 193, 7, 0.15);
    color: #f57c00;
    border: 1px solid rgba(255, 193, 7, 0.3);
    font-weight: 600;
    padding: 4px 10px;
}

.badge-birthday i {
    margin-right: 4px;
}

/* ===========================================
   ACTION BUTTONS
   =========================================== */

.action-buttons {
    display: flex;
    gap: 8px;
    padding: 16px;
    background-color: white;
    border-top: 1px solid #e9ecef;
}

.action-btn {
    flex: 1;
    height: 44px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-delete {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.btn-delete:hover:not(:disabled) {
    background-color: rgba(220, 53, 69, 0.15);
}

.btn-duplicate {
    background-color: rgba(108, 117, 125, 0.1);
    color: #495057;
}

.btn-duplicate:hover:not(:disabled) {
    background-color: rgba(108, 117, 125, 0.15);
}

.btn-complete {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.btn-complete:hover:not(:disabled) {
    background-color: rgba(40, 167, 69, 0.15);
}

/* ===========================================
   RESPONSIVE
   =========================================== */

@media (max-width: 576px) {
    .selectable-item {
        padding: 0.875rem;
    }

    .avatar-md {
        width: 40px;
        height: 40px;
    }

    .avatar-md i {
        font-size: 1rem;
    }

    .selectable-item-info {
        gap: 0.75rem;
    }

    .empty-state {
        padding: 2rem 1rem;
    }

    .empty-state i {
        font-size: 2.5rem;
    }

    .action-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .action-btn {
        width: 100%;
    }
}


/* Filter Section Container */
.ag-filter-section {
    margin-bottom: 2rem;
}

/* Filter Card */
.ag-filter-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

/* Filter Header */
.ag-filter-header {
    background: linear-gradient(135deg, #20c997 0%, #28a745 100%);
    color: white;
    padding: 1rem 1.5rem;
}

.ag-filter-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
}

/* Collapsible Header */
.ag-filter-header.collapsible {
    cursor: pointer;
    transition: background 0.2s ease;
}

.ag-filter-header.collapsible:hover {
    background: linear-gradient(135deg, #1ab386 0%, #218838 100%);
}

.ag-filter-header .collapse-icon {
    margin-left: auto;
    transition: transform 0.3s ease;
}

.ag-filter-header.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

/* Filter Body */
.ag-filter-body {
    padding: 1.5rem;
}

.ag-filter-body.collapsed {
    display: none;
}

/* Filter Row */
.ag-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.ag-filter-row + .ag-filter-row {
    margin-top: 1rem;
}

/* Filter Label */
.ag-filter-label {
    min-width: 150px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

/* Preset Buttons */
.ag-preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ag-preset-buttons .btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.ag-preset-buttons .btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(32, 201, 151, 0.3);
}

.ag-preset-buttons .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.ag-preset-buttons .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
}

.ag-preset-buttons .btn-outline-primary {
    border: 2px solid #667eea;
    color: #667eea;
    background: transparent;
}

.ag-preset-buttons .btn-outline-primary:hover:not(:disabled) {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

/* Date Range Inputs */
.ag-date-range-inputs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.ag-date-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ag-date-input-group .ag-date-label {
    font-weight: 500;
    color: #6c757d;
    font-size: 0.875rem;
    min-width: auto;
}

.ag-date-input-group .form-control {
    width: auto;
    min-width: 150px;
    padding: 0.5rem 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.ag-date-input-group .form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

.ag-date-input-group .form-control:disabled {
    background-color: #f8f9fa;
    opacity: 0.7;
}

.ag-date-range-inputs .btn-success {
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    background: linear-gradient(135deg, #20c997 0%, #28a745 100%);
    border: none;
    transition: all 0.2s ease;
}

.ag-date-range-inputs .btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.ag-date-range-inputs .btn-success:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Filter Summary */
.ag-filter-summary {
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: #667eea;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.ag-filter-summary i {
    color: #667eea;
}

.ag-filter-summary strong {
    color: #2c3e50;
}

.ag-filter-summary .loading-indicator {
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Loading Overlay for filtered content */
.ag-loading-overlay {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.ag-loading-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    z-index: 10;
}

/* Search Input in Filters */
.ag-filter-search {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 200px;
    max-width: 400px;
}

.ag-filter-search .form-control {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.ag-filter-search .form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

/* Filter Select Dropdown */
.ag-filter-select {
    min-width: 150px;
    padding: 0.5rem 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #2c3e50;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ag-filter-select:hover {
    border-color: #667eea;
}

.ag-filter-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ag-filter-select:disabled {
    background-color: #f8f9fa;
    opacity: 0.7;
    cursor: not-allowed;
}

/* Filter Actions */
.ag-filter-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

/* Responsive Filters */
@media (max-width: 992px) {
    .ag-filter-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .ag-filter-label {
        min-width: auto;
        margin-bottom: 0.25rem;
    }

    .ag-preset-buttons {
        width: 100%;
    }

    .ag-date-range-inputs {
        width: 100%;
    }

    .ag-filter-search {
        max-width: 100%;
    }

    .ag-filter-actions {
        margin-left: 0;
        margin-top: 1rem;
        width: 100%;
    }
}

@media (max-width: 576px) {
    .ag-filter-body {
        padding: 1rem;
    }

    .ag-preset-buttons .btn {
        flex: 1;
        min-width: calc(33.333% - 0.5rem);
        padding: 0.5rem 0.5rem;
        font-size: 0.8rem;
    }

    .ag-date-input-group {
        width: 100%;
    }

    .ag-date-input-group .form-control {
        flex: 1;
        min-width: auto;
    }

    .ag-date-range-inputs .btn-success {
        width: 100%;
        margin-top: 0.5rem;
    }
}
