/* =====================================================================
   ROYAUME DU MAROC — Government Complaints Platform
   Component Styles · Version 2.0
   =====================================================================
   Complementary component layer loaded after moroccan-theme.css.
   Covers: notifications, dialogs, modals, progress bars, pagination,
   tabs, tooltips, breadcrumbs, tags/chips, stat cards, loading
   skeletons, and RTL/responsive overrides.
   ===================================================================== */


/* =====================================================================
   § 1.  KEYFRAMES — Component-specific animations
   ===================================================================== */

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes notificationSlideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes notificationSlideInRTL {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes confirmScaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes overlayFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}


/* =====================================================================
   § 2.  NOTIFICATION TOAST
   =====================================================================
   Fixed-position toast messages that slide in from the right (or left
   in RTL). Supports success, error, warning, and info variants.
   ===================================================================== */

.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 14px 20px;
    padding-right: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    max-width: 400px;
    animation: notificationSlideIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ── Toast Variants ── */

.notification-success {
    background: linear-gradient(135deg, #059669, #10B981);
    color: var(--morocco-white);
}

.notification-error {
    background: linear-gradient(135deg, #DC2626, #EF4444);
    color: var(--morocco-white);
}

.notification-warning {
    background: linear-gradient(135deg, #D97706, #F59E0B);
    color: var(--morocco-white);
}

.notification-info {
    background: linear-gradient(135deg, #2563EB, #3B82F6);
    color: var(--morocco-white);
}

/* ── Close Button ── */

.notification-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: var(--morocco-white);
    font-size: 0.65rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
    line-height: 1;
}

.notification-close:hover {
    background: rgba(255, 255, 255, 0.35);
}


/* =====================================================================
   § 3.  CONFIRM DIALOG
   =====================================================================
   Destructive-action confirmation overlay with centered dialog.
   ===================================================================== */

.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: overlayFadeIn 0.2s ease both;
}

.confirm-dialog {
    background: var(--morocco-white);
    border-radius: 20px;
    padding: 2rem;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: confirmScaleIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.confirm-icon {
    font-size: 2.5rem;
    color: #F59E0B;
    margin-bottom: 1rem;
    line-height: 1;
}

.confirm-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.5rem;
}

.confirm-message {
    font-size: 0.95rem;
    color: #6B7280;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ── Danger Button (used in confirm dialogs) ── */

.btn-danger {
    background: #DC2626;
    color: var(--morocco-white);
    border: 2px solid #DC2626;
    border-radius: var(--radius-md);
    padding: 10px 24px;
    font-family: inherit;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.btn-danger:hover {
    background: #B91C1C;
    border-color: #B91C1C;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.btn-danger:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(220, 38, 38, 0.2);
}


/* =====================================================================
   § 4.  MODAL
   =====================================================================
   General-purpose modal with header, scrollable body, and footer.
   ===================================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    padding: 1rem;
    animation: overlayFadeIn 0.2s ease both;
}

.modal {
    background: var(--morocco-white);
    border-radius: 20px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #F3F4F6;
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #111827;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: #F3F4F6;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6B7280;
    font-size: 0.8rem;
    transition: background-color 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}

.modal-close:hover {
    background: #E5E7EB;
    color: #111827;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 1rem 1.5rem;
    border-top: 1px solid #F3F4F6;
    flex-shrink: 0;
}


/* =====================================================================
   § 5.  PROGRESS BAR
   =====================================================================
   Horizontal progress indicator with size variants.
   ===================================================================== */

.progress-bar {
    width: 100%;
    height: 8px;
    background: #F3F4F6;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #006233, #00A058);
    border-radius: 4px;
    transition: width 0.6s ease;
}

/* ── Size Variants ── */

.progress-bar.progress-sm {
    height: 4px;
}

.progress-bar.progress-lg {
    height: 12px;
}


/* =====================================================================
   § 6.  PAGINATION
   =====================================================================
   Page navigation with active, hover, and disabled states.
   ===================================================================== */

.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    border: 1px solid #E5E7EB;
    background: var(--morocco-white);
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    cursor: pointer;
    text-decoration: none;
    line-height: 1;
    font-family: inherit;
}

.page-link:hover {
    background: #F9FAFB;
    border-color: #D1D5DB;
}

.page-link.active {
    background: #006233;
    color: var(--morocco-white);
    border-color: #006233;
}

.page-link.active:hover {
    background: #004d28;
    border-color: #004d28;
}

.page-link.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}


/* =====================================================================
   § 7.  TABS
   =====================================================================
   Pill-style tab navigation with active highlight.
   ===================================================================== */

.tabs {
    display: flex;
    gap: 2px;
    background: #F3F4F6;
    border-radius: 12px;
    padding: 4px;
}

.tab {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6B7280;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, font-weight 0.2s ease;
    font-family: inherit;
    white-space: nowrap;
    line-height: 1.4;
}

.tab:hover {
    color: #374151;
}

.tab.active {
    background: var(--morocco-white);
    color: #006233;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}


/* =====================================================================
   § 8.  TOOLTIP
   =====================================================================
   Lightweight CSS-only tooltip via data attribute.
   ===================================================================== */

.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    background: var(--morocco-charcoal);
    color: var(--morocco-white);
    font-size: 0.75rem;
    font-weight: var(--font-weight-normal);
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 700;
    line-height: 1.4;
}

.tooltip:hover::after {
    opacity: 1;
}


/* =====================================================================
   § 9.  BREADCRUMB
   =====================================================================
   Horizontal breadcrumb navigation trail.
   ===================================================================== */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.breadcrumb a {
    color: #6B7280;
    text-decoration: none;
    transition: color 0.15s ease;
}

.breadcrumb a:hover {
    color: #006233;
}

.breadcrumb-separator {
    color: #D1D5DB;
    user-select: none;
}

.breadcrumb-current {
    color: #111827;
    font-weight: 600;
}


/* =====================================================================
   § 10.  TAG / CHIP
   =====================================================================
   Compact inline label with semantic color variants.
   ===================================================================== */

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #F3F4F6;
    color: #374151;
    line-height: 1.4;
    white-space: nowrap;
}

/* ── Color Variants ── */

.tag-green {
    background: #D1FAE5;
    color: #065F46;
}

.tag-red {
    background: #FEE2E2;
    color: #991B1B;
}

.tag-gold {
    background: #FEF3C7;
    color: #92400E;
}

.tag-blue {
    background: #DBEAFE;
    color: #1D4ED8;
}

/* ── Close Button Inside Tag ── */

.tag .tag-close {
    cursor: pointer;
    margin-left: 4px;
    opacity: 0.5;
    transition: opacity 0.15s ease;
    font-size: 0.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tag .tag-close:hover {
    opacity: 1;
}



/* =====================================================================
   § 12.  NOTIFICATION DOT (Navbar indicator)
   =====================================================================
   Small red dot positioned over an icon or button to signal unread
   notifications.
   ===================================================================== */

.notification-dot {
    width: 8px;
    height: 8px;
    background: #EF4444;
    border-radius: 50%;
    position: absolute;
    top: -2px;
    right: -2px;
    border: 2px solid var(--morocco-white);
}


/* =====================================================================
   § 13.  SKELETON LOADING
   =====================================================================
   Placeholder shimmer elements for content loading states.
   Uses the shimmer keyframe from moroccan-theme.css.
   ===================================================================== */

.skeleton {
    background: linear-gradient(90deg,
            #F3F4F6 25%,
            #E5E7EB 50%,
            #F3F4F6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

.skeleton-text {
    height: 16px;
    width: 80%;
    margin-bottom: 8px;
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-card {
    height: 120px;
    border-radius: 16px;
}


/* =====================================================================
   § 14.  RTL OVERRIDES
   =====================================================================
   Directional adjustments for right-to-left layouts.
   ===================================================================== */

/* ── Notification Toast ── */

[dir="rtl"] .notification {
    right: auto;
    left: 20px;
    padding-right: 20px;
    padding-left: 44px;
    animation-name: notificationSlideInRTL;
}

[dir="rtl"] .notification-close {
    right: auto;
    left: 10px;
}

/* ── Modal Footer ── */

[dir="rtl"] .modal-footer {
    justify-content: flex-start;
}

/* ── Breadcrumb Separator (no change needed; works symmetrically) ── */
/* ── Tooltip (centered via transform; works symmetrically) ── */
/* ── Confirm Dialog (text-align: center; works symmetrically) ── */


/* =====================================================================
   § 15.  RESPONSIVE — Mobile adjustments
   ===================================================================== */

@media (max-width: 640px) {

    /* Confirm Dialog */
    .confirm-dialog {
        padding: 1.5rem;
        width: 95%;
    }

    /* Modal */
    .modal {
        border-radius: 16px;
        max-width: 100%;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Tabs */
    .tabs {
        flex-wrap: wrap;
    }

    .tab {
        padding: 8px 14px;
        font-size: 0.8rem;
    }

    /* Notification Toast — full width on mobile */
    .notification {
        right: 12px;
        left: 12px;
        max-width: none;
    }

    /* Pagination — slightly more compact */
    .page-link {
        min-width: 32px;
        height: 32px;
        padding: 0 8px;
        font-size: 0.8rem;
    }

    /* Breadcrumb — slightly smaller */
    .breadcrumb {
        font-size: 0.8rem;
        gap: 4px;
    }
}

@media (max-width: 380px) {

    /* Confirm actions stack vertically on very small screens */
    .confirm-actions {
        flex-direction: column-reverse;
    }

    .confirm-actions .btn,
    .confirm-actions .btn-danger {
        width: 100%;
    }

    /* Modal footer stacks */
    .modal-footer {
        flex-direction: column-reverse;
        gap: 8px;
    }

    .modal-footer .btn {
        width: 100%;
    }
}