/* ============================================================================
   Bayon Portal Custom Additions
   Enhances dashboard.css with Modals, Drawers, Filter Bars, and Tags
   ============================================================================ */

/* Global Button Font Family Rule */
button,
input[type="button"],
input[type="submit"],
input[type="reset"],
.btn,
.btn-primary,
.btn-outline,
.btn-success,
.btn-danger,
.btn-info,
.btn-sm,
.btn-icon,
.refresh-btn,
.logout-btn,
.page-btn,
.social-button,
.back-btn {
    font-family: "Kantumruy Pro", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif !important;
}

/* Filter Bar */
.filter-bar {
    background: white;
    border-radius: var(--card-radius);
    padding: 16px 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.form-control {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: #1e293b;
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(26, 58, 92, 0.15);
}

.form-select {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: #1e293b;
    background-color: white;
    outline: none;
    cursor: pointer;
}

/* Data Table */
.data-table-container {
    background: white;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table-responsive {
    overflow-x: auto;
}

.portal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.portal-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.portal-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

.portal-table tbody tr:hover {
    background-color: #f8fafc;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.badge-success {
    background: #def7ec;
    color: #03543f;
}

.badge-danger {
    background: #fde8e8;
    color: #9b1c1c;
}

.badge-info {
    background: #e1effe;
    color: #1e429f;
}

/* Action Buttons */
.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 4px;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-top: 1px solid #e2e8f0;
    font-size: 13px;
    color: #64748b;
}

.pagination-controls {
    display: flex;
    gap: 6px;
}

.page-btn {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    background: white;
    color: #334155;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-btn:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: var(--primary);
}

/* Modal Backdrop & Dialog */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-dialog {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalFadeIn 0.2s ease-out;
}

.modal-dialog.modal-lg {
    max-width: 800px;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 8px;
}

.modal-close:hover {
    color: #1e293b;
}

.modal-body {
    padding: 20px 24px;
}

.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #f8fafc;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

/* Form Styles */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: #475569;
}

.form-group label .required {
    color: var(--danger);
    margin-left: 2px;
}

/* Tags Input / Display */
.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    min-height: 44px;
    margin-bottom: 12px;
}

.tag-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e2e8f0;
    color: #1e293b;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-family: monospace;
}

.tag-remove {
    cursor: pointer;
    color: #ef4444;
    font-weight: bold;
}

.tag-remove:hover {
    color: #b91c1c;
}

/* Switch */
.switch-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
}

.switch-input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Loading & Alerts */
.toast-alert {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: 8px;
    background: #1e293b;
    color: white;
    box-shadow: var(--shadow-lg);
    z-index: 3000;
    display: none;
    font-size: 13px;
    animation: slideUp 0.3s ease;
}

.toast-alert.success {
    background: #10b981;
}

.toast-alert.error {
    background: #ef4444;
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Ministry Statistics & Involvement Report */
.report-table-wrapper {
    overflow-x: auto;
    background: white;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    margin-top: 15px;
}

.progress-bar-container {
    background: #e2e8f0;
    border-radius: 9999px;
    height: 8px;
    min-width: 80px;
    overflow: hidden;
    position: relative;
    margin-top: 4px;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.4s ease-in-out;
}

.progress-bar-fill.high {
    background: linear-gradient(90deg, #10b981, #059669);
}

.progress-bar-fill.medium {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.progress-bar-fill.low {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.ministry-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ministry-logo-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #f1f5f9;
    object-fit: cover;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 16px;
}
