/**
 * File: install-button.css
 * Description: ULTIMATE INSTALL BUTTON - Complete UI Design
 * Version: 13.1.0 (FINAL - Scoped, Dopamine-Driven, Responsive)
 *
 * ═══════════════════════════════════════════════════════════
 * DESIGN PHILOSOPHY
 * ═══════════════════════════════════════════════════════════
 *
 * - Scoped CSS (no global pollution)
 * - Dopamine-driven design (gradients, glows, animations)
 * - Mobile-first responsive
 * - Dark mode support (auto + manual)
 * - RTL support
 * - Accessibility (focus states, high contrast, reduced motion)
 * - Micro-interactions (hover, active, focus)
 * - Smooth animations (60fps, GPU accelerated)
 * - 5 themes (gradient, dark, light, minimal, neumorphism)
 * - 6 positions (bottom/top × center/left/right)
 * - 3 sizes (small, medium, large)
 *
 * ═══════════════════════════════════════════════════════════
 * PREFIX
 * ═══════════════════════════════════════════════════════════
 *
 * - Bell module:         nfs-*
 * - Notification module: njn-* / nj-notif-*
 * - Install Button:      nib-*  (this file)
 *
 * All prefixes are unique — no CSS conflicts.
 *
 * ═══════════════════════════════════════════════════════════
 *
 * @package NajibulInstallButton
 * @version 13.1.0
 * @author Najibul
 */

/* ============================================
   1. CSS VARIABLES (Scoped)
   ============================================ */

.nib-wrapper {

    /* ─────────────────────────────────────────
       Colors - Primary
       ───────────────────────────────────────── */
    --nib-primary: #6366f1;
    --nib-primary-hover: #4f46e5;
    --nib-primary-light: #818cf8;
    --nib-primary-dark: #4338ca;
    --nib-primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --nib-primary-gradient-hover: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #9333ea 100%);

    /* ─────────────────────────────────────────
       Colors - State
       ───────────────────────────────────────── */
    --nib-success: #22c55e;
    --nib-success-hover: #16a34a;
    --nib-warning: #f59e0b;
    --nib-error: #ef4444;

    /* ─────────────────────────────────────────
       Colors - Neutral (Light)
       ───────────────────────────────────────── */
    --nib-text: #0f0f0f;
    --nib-text-secondary: #6b7280;
    --nib-text-light: #9ca3af;
    --nib-text-inverse: #ffffff;

    --nib-bg: #ffffff;
    --nib-bg-secondary: #f8fafc;
    --nib-border: #e5e7eb;
    --nib-border-light: rgba(255, 255, 255, 0.1);

    /* ─────────────────────────────────────────
       Shadows
       ───────────────────────────────────────── */
    --nib-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --nib-shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
    --nib-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --nib-shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.15);
    --nib-shadow-glow: 0 8px 24px rgba(99, 102, 241, 0.35);
    --nib-shadow-neumorphism: 6px 6px 14px rgba(0, 0, 0, 0.06), -6px -6px 14px rgba(255, 255, 255, 0.8);
    --nib-shadow-neumorphism-hover: 8px 8px 20px rgba(0, 0, 0, 0.08), -8px -8px 20px rgba(255, 255, 255, 0.9);

    /* ─────────────────────────────────────────
       Radius
       ───────────────────────────────────────── */
    --nib-radius-xs: 8px;
    --nib-radius-sm: 12px;
    --nib-radius-md: 16px;
    --nib-radius-lg: 24px;
    --nib-radius-xl: 32px;
    --nib-radius-full: 9999px;

    /* ─────────────────────────────────────────
       Transitions
       ───────────────────────────────────────── */
    --nib-transition-fast: 0.15s ease;
    --nib-transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --nib-transition-slow: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    --nib-transition-bounce: 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* ─────────────────────────────────────────
       Typography
       ───────────────────────────────────────── */
    --nib-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                       'Helvetica Neue', Arial, 'Noto Sans', 'Noto Sans Bengali',
                       'Noto Sans Devanagari', sans-serif;
    --nib-font-size-xs: 10px;
    --nib-font-size-sm: 12px;
    --nib-font-size-md: 14px;
    --nib-font-size-lg: 16px;
    --nib-font-size-xl: 20px;

    /* ─────────────────────────────────────────
       Z-Index
       ───────────────────────────────────────── */
    --nib-z-wrapper: 2147483000;
    --nib-z-toast: 2147483647;
    --nib-z-confetti: 2147483647;
}

/* ============================================
   2. RESET & BASE (Scoped)
   ============================================ */

.nib-wrapper,
.nib-wrapper *,
.nib-wrapper *::before,
.nib-wrapper *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

.nib-wrapper {
    position: fixed;
    z-index: var(--nib-z-wrapper);
    font-family: var(--nib-font-family);
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: none;
    pointer-events: none;
    transition: all var(--nib-transition-normal);
}

.nib-wrapper.show,
.nib-wrapper.show-flex {
    display: block !important;
    pointer-events: auto;
    animation: nibSpringPop 0.7s var(--nib-transition-bounce) forwards;
}

.nib-wrapper button {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin: 0;
    outline: none;
}

/* ============================================
   3. POSITION CLASSES
   ============================================ */

.nib-pos-bottom-center {
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
}

.nib-pos-bottom-left {
    bottom: 24px;
    left: 24px;
}

.nib-pos-bottom-right {
    bottom: 24px;
    right: 24px;
}

.nib-pos-top-center {
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
}

.nib-pos-top-left {
    top: 24px;
    left: 24px;
}

.nib-pos-top-right {
    top: 24px;
    right: 24px;
}

/* ============================================
   4. THEME CLASSES
   ============================================ */

/* ─────────────────────────────────────────
   Theme: Gradient (Default)
   ───────────────────────────────────────── */

.nib-theme-gradient .nib-btn {
    background: var(--nib-primary-gradient);
    color: #ffffff;
    border: none;
    box-shadow: var(--nib-shadow-glow), var(--nib-shadow-lg);
}

.nib-theme-gradient .nib-btn:hover:not(:disabled) {
    background: var(--nib-primary-gradient-hover);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.45), 0 0 60px rgba(139, 92, 246, 0.25);
}

.nib-theme-gradient .nib-btn:active:not(:disabled) {
    transform: scale(0.95) translateY(0);
}

/* ─────────────────────────────────────────
   Theme: Dark
   ───────────────────────────────────────── */

.nib-theme-dark .nib-btn {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #ffffff;
    border: 1px solid var(--nib-border-light);
    box-shadow: var(--nib-shadow-neumorphism);
}

.nib-theme-dark .nib-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #1e1b4b 0%, #1a1a2e 100%);
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--nib-shadow-neumorphism-hover), 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* ─────────────────────────────────────────
   Theme: Light
   ───────────────────────────────────────── */

.nib-theme-light .nib-btn {
    background: var(--nib-bg);
    color: var(--nib-text);
    border: 1px solid var(--nib-border);
    box-shadow: var(--nib-shadow-neumorphism);
}

.nib-theme-light .nib-btn:hover:not(:disabled) {
    background: var(--nib-bg-secondary);
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--nib-shadow-neumorphism-hover);
}

/* ─────────────────────────────────────────
   Theme: Minimal
   ───────────────────────────────────────── */

.nib-theme-minimal .nib-btn {
    background: transparent;
    color: var(--nib-text);
    border: 2px solid var(--nib-text);
    box-shadow: none;
    border-radius: var(--nib-radius-xs);
    padding: 10px 20px;
}

.nib-theme-minimal .nib-btn:hover:not(:disabled) {
    background: rgba(99, 102, 241, 0.04);
    transform: translateY(-3px) scale(1.02);
    border-color: var(--nib-primary);
}

/* ─────────────────────────────────────────
   Theme: Neumorphism
   ───────────────────────────────────────── */

.nib-theme-neumorphism .nib-btn {
    background: var(--nib-bg-secondary);
    color: var(--nib-text);
    border: none;
    box-shadow: var(--nib-shadow-neumorphism);
    border-radius: var(--nib-radius-xl);
}

.nib-theme-neumorphism .nib-btn:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--nib-shadow-neumorphism-hover);
}

/* ============================================
   5. SIZE CLASSES
   ============================================ */

.nib-size-small .nib-btn {
    padding: 8px 18px 8px 14px;
    min-width: 100px;
    height: 40px;
    font-size: var(--nib-font-size-sm);
    border-radius: var(--nib-radius-sm);
    gap: 6px;
}

.nib-size-small .nib-icon svg {
    width: 16px;
    height: 16px;
}

.nib-size-large .nib-btn {
    padding: 18px 40px 18px 32px;
    min-width: 180px;
    height: 68px;
    font-size: var(--nib-font-size-lg);
    border-radius: var(--nib-radius-xl);
    gap: 12px;
}

.nib-size-large .nib-icon svg {
    width: 26px;
    height: 26px;
}

/* ============================================
   6. MAIN BUTTON
   ============================================ */

.nib-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px 14px 24px;
    min-width: 140px;
    height: 56px;
    border: none;
    border-radius: var(--nib-radius-lg);
    font-size: var(--nib-font-size-md);
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: all var(--nib-transition-normal);
    will-change: transform, box-shadow;
    overflow: hidden;
    gap: 10px;
    white-space: nowrap;
    font-family: var(--nib-font-family);
}

.nib-btn:focus-visible {
    outline: 3px solid var(--nib-primary);
    outline-offset: 4px;
}

.nib-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: scale(0.98);
}

/* ============================================
   7. BUTTON CONTENT (Icon, Label, Badge)
   ============================================ */

.nib-btn-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    z-index: 1;
}

/* ─────────────────────────────────────────
   Icon
   ───────────────────────────────────────── */

.nib-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform var(--nib-transition-slow);
}

.nib-btn:hover:not(:disabled) .nib-icon {
    transform: rotate(-10deg) scale(1.1);
}

.nib-icon svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    transition: transform var(--nib-transition-slow);
}

/* ─────────────────────────────────────────
   Label
   ───────────────────────────────────────── */

.nib-label {
    font-weight: 700;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
}

/* ─────────────────────────────────────────
   Badge (NEW)
   ───────────────────────────────────────── */

.nib-badge {
    position: absolute;
    top: -10px;
    right: -12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 18px;
    padding: 0 10px;
    border-radius: var(--nib-radius-full);
    background: linear-gradient(135deg, #ff3366, #ff0040);
    color: #ffffff;
    font-size: var(--nib-font-size-xs);
    font-weight: 900;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 4px 14px rgba(255, 51, 102, 0.4);
    border: 2px solid #ffffff;
    z-index: 10;
    animation: nibBadgePulse 2s ease-in-out infinite;
    pointer-events: none;
}

.nib-size-small .nib-badge {
    top: -8px;
    right: -10px;
    min-width: 24px;
    height: 14px;
    font-size: 8px;
    padding: 0 8px;
}

.nib-size-large .nib-badge {
    top: -12px;
    right: -14px;
    min-width: 36px;
    height: 22px;
    font-size: var(--nib-font-size-sm);
    padding: 0 12px;
}

/* ============================================
   8. RIPPLE EFFECT
   ============================================ */

.nib-ripple {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.nib-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    transform: translate(-50%, -50%);
    transition: width 0.6s var(--nib-transition-bounce),
                height 0.6s var(--nib-transition-bounce),
                opacity 0.6s ease;
    opacity: 0;
}

.nib-btn:active:not(:disabled) .nib-ripple::after {
    width: 400px;
    height: 400px;
    opacity: 1;
    transition: 0s;
}

/* ============================================
   9. STATES
   ============================================ */

/* Success State */
.nib-btn.success {
    background: linear-gradient(135deg, var(--nib-success), var(--nib-success-hover)) !important;
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.3) !important;
    cursor: default;
}

.nib-btn.success .nib-badge {
    display: none;
}

/* Dismissed State */
.nib-btn.dismissed {
    opacity: 0.5;
    transform: scale(0.92);
    pointer-events: none;
    animation: none;
}

/* Loading State */
.nib-btn.loading {
    opacity: 0.7;
    cursor: wait;
}

/* Loading Spinner */
.nib-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: nibSpin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
    flex-shrink: 0;
}

/* ============================================
   10. PROGRESS BAR
   ============================================ */

.nib-progress {
    margin-top: 16px;
    padding: 16px 24px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--nib-radius-md);
    border: 1px solid var(--nib-border-light);
    min-width: 140px;
    box-shadow: var(--nib-shadow-xl);
    display: none;
    animation: nibProgressIn 0.4s var(--nib-transition-bounce);
}

.nib-progress.active {
    display: block;
}

.nib-progress-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
}

.nib-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--nib-primary-gradient);
    border-radius: 4px;
    transition: width 0.3s var(--nib-transition-bounce);
}

.nib-progress-label {
    display: block;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: var(--nib-font-size-sm);
    font-weight: 600;
    margin-top: 8px;
    letter-spacing: 0.5px;
}

/* ============================================
   11. SUCCESS DISPLAY
   ============================================ */

.nib-success {
    margin-top: 16px;
    padding: 16px 24px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--nib-radius-md);
    border: 1px solid rgba(34, 197, 94, 0.2);
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 120px;
    box-shadow: var(--nib-shadow-xl);
}

.nib-success.active {
    display: flex !important;
    animation: nibSuccessIn 0.5s var(--nib-transition-bounce);
}

.nib-success-icon {
    font-size: var(--nib-font-size-xl);
    animation: nibSuccessSpin 1s ease-in-out;
    flex-shrink: 0;
}

.nib-success-text {
    color: rgba(255, 255, 255, 0.95);
    font-size: var(--nib-font-size-md);
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* ============================================
   12. STATS DISPLAY
   ============================================ */

.nib-stats {
    margin-top: 16px;
    text-align: center;
    font-size: var(--nib-font-size-sm);
    color: var(--nib-text-secondary);
    background: var(--nib-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 16px 24px;
    border-radius: var(--nib-radius-md);
    border: 1px solid var(--nib-border);
    display: none;
    min-width: 160px;
    box-shadow: var(--nib-shadow-lg);
}

.nib-stats.active {
    display: block;
    animation: nibStatsIn 0.5s var(--nib-transition-bounce);
}

.nib-stats-total {
    font-weight: 500;
    display: inline-block;
    margin-right: 16px;
}

.nib-stats-total-value {
    font-weight: 700;
    color: var(--nib-primary);
    font-size: var(--nib-font-size-md);
}

.nib-stats-today {
    font-weight: 500;
    display: inline-block;
}

.nib-stats-today-value {
    font-weight: 700;
    color: var(--nib-success);
    font-size: var(--nib-font-size-md);
}

/* ─────────────────────────────────────────
   Stats Shortcode Output
   ───────────────────────────────────────── */

.nib-stats-shortcode {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 12px 20px;
    background: var(--nib-bg);
    border: 1px solid var(--nib-border);
    border-radius: var(--nib-radius-md);
    font-family: var(--nib-font-family);
    font-size: var(--nib-font-size-md);
    color: var(--nib-text);
    box-shadow: var(--nib-shadow-sm);
}

.nib-stats-shortcode .nib-stat-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nib-stats-shortcode .nib-stat-label {
    color: var(--nib-text-secondary);
    font-weight: 500;
}

.nib-stats-shortcode .nib-stat-value {
    color: var(--nib-primary);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   13. TOAST NOTIFICATION
   ============================================ */

.nib-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: #323232;
    color: #ffffff;
    padding: 14px 28px;
    border-radius: 14px;
    font-size: var(--nib-font-size-md);
    font-weight: 600;
    z-index: var(--nib-z-toast);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    text-align: center;
    letter-spacing: 0.3px;
    animation: nibToastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    word-break: break-word;
    pointer-events: auto;
}

.nib-toast.success { background: var(--nib-success); }
.nib-toast.error   { background: var(--nib-error); }
.nib-toast.warning { background: var(--nib-warning); }
.nib-toast.info    { background: var(--nib-primary); }

/* ============================================
   14. CONFETTI
   ============================================ */

.nib-confetti-piece {
    position: fixed;
    pointer-events: none;
    z-index: var(--nib-z-confetti);
    top: -20px;
    display: flex;
    align-items: center;
    justify-content: center;
    will-change: transform, opacity;
}

/* ============================================
   15. ANIMATIONS
   ============================================ */

@keyframes nibSpringPop {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(40px) scale(0.8);
    }
    60% {
        opacity: 1;
        transform: translateX(-50%) translateY(-8px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

/* For non-center positions */
.nib-pos-bottom-left.show,
.nib-pos-bottom-right.show,
.nib-pos-top-left.show,
.nib-pos-top-right.show {
    animation-name: nibSlideInSide;
}

@keyframes nibSlideInSide {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.8);
    }
    60% {
        opacity: 1;
        transform: translateY(-8px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes nibBadgePulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.15); }
}

@keyframes nibSpin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes nibProgressIn {
    0%   { opacity: 0; transform: scale(0.9) translateY(-8px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes nibSuccessIn {
    0%   { opacity: 0; transform: scale(0.8) translateY(12px); }
    60%  { transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes nibSuccessSpin {
    0%   { transform: rotate(0deg) scale(0); }
    50%  { transform: rotate(360deg) scale(1.3); }
    100% { transform: rotate(360deg) scale(1); }
}

@keyframes nibStatsIn {
    0%   { opacity: 0; transform: translateY(-10px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes nibToastIn {
    0%   { opacity: 0; transform: translateX(-50%) translateY(20px); }
    100% { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes nibConfettiFall {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg) scale(0.3);
        opacity: 0;
    }
}

/* ============================================
   16. RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .nib-wrapper {
        padding: 0 16px;
    }

    /* Center positions */
    .nib-pos-bottom-center,
    .nib-pos-top-center {
        left: 50%;
        transform: translateX(-50%);
    }

    /* Side positions become full-width */
    .nib-pos-bottom-left,
    .nib-pos-bottom-right,
    .nib-pos-top-left,
    .nib-pos-top-right {
        bottom: 16px;
        left: 16px;
        right: 16px;
        top: auto;
    }

    .nib-btn {
        padding: 10px 24px 10px 18px;
        min-width: 100px;
        height: 44px;
        font-size: var(--nib-font-size-sm);
        border-radius: var(--nib-radius-sm);
        gap: 8px;
        width: 100%;
    }

    .nib-icon svg {
        width: 18px;
        height: 18px;
    }

    .nib-badge {
        top: -6px;
        right: -8px;
        min-width: 22px;
        height: 14px;
        font-size: 8px;
        padding: 0 6px;
    }

    .nib-progress,
    .nib-success {
        min-width: 100px;
        padding: 8px 16px;
    }

    .nib-progress-label,
    .nib-success-text {
        font-size: var(--nib-font-size-sm);
    }

    .nib-stats-shortcode {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .nib-btn {
        padding: 8px 18px 8px 14px;
        min-width: 85px;
        height: 38px;
        font-size: var(--nib-font-size-xs);
        border-radius: var(--nib-radius-xs);
        gap: 6px;
    }

    .nib-icon svg {
        width: 16px;
        height: 16px;
    }

    .nib-badge {
        top: -5px;
        right: -6px;
        min-width: 18px;
        height: 12px;
        font-size: 7px;
        padding: 0 5px;
        border-width: 1.5px;
    }

    .nib-progress,
    .nib-success {
        min-width: 85px;
        padding: 8px 12px;
        border-radius: var(--nib-radius-xs);
    }

    .nib-progress-label,
    .nib-success-text {
        font-size: var(--nib-font-size-xs);
    }

    .nib-toast {
        padding: 12px 20px;
        font-size: var(--nib-font-size-sm);
        bottom: 80px;
    }
}

/* ============================================
   17. DARK MODE
   ============================================ */

@media (prefers-color-scheme: dark) {
    .nib-wrapper {
        --nib-text: #e8e8e8;
        --nib-text-secondary: #9ca3af;
        --nib-text-light: #6b7280;
        --nib-text-inverse: #0f0f0f;

        --nib-bg: #1a1a2e;
        --nib-bg-secondary: #14142a;
        --nib-border: rgba(255, 255, 255, 0.06);
        --nib-border-light: rgba(255, 255, 255, 0.1);

        --nib-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --nib-shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
        --nib-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
        --nib-shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.6);
        --nib-shadow-neumorphism: 6px 6px 14px rgba(0, 0, 0, 0.4), -6px -6px 14px rgba(255, 255, 255, 0.02);
        --nib-shadow-neumorphism-hover: 8px 8px 20px rgba(0, 0, 0, 0.5), -8px -8px 20px rgba(255, 255, 255, 0.03);
    }

    .nib-theme-light .nib-btn {
        background: #1a1a2e;
        color: #e8e8e8;
        border: 1px solid rgba(255, 255, 255, 0.06);
    }

    .nib-theme-minimal .nib-btn {
        color: #e8e8e8;
        border: 2px solid #e8e8e8;
    }

    .nib-stats {
        background: #1a1a2e;
        color: #e2e8f0;
        border-color: rgba(255, 255, 255, 0.06);
    }

    .nib-stats-total-value {
        color: #818cf8;
    }

    .nib-stats-today-value {
        color: #34d399;
    }

    .nib-progress,
    .nib-success {
        background: rgba(0, 0, 0, 0.92);
    }

    .nib-badge {
        border-color: #1a1a2e;
    }

    .nib-stats-shortcode {
        background: #1a1a2e;
        border-color: rgba(255, 255, 255, 0.06);
        color: #e8e8e8;
    }

    .nib-stats-shortcode .nib-stat-value {
        color: #818cf8;
    }
}

/* ============================================
   18. RTL SUPPORT
   ============================================ */

[dir="rtl"] .nib-btn {
    flex-direction: row-reverse;
}

[dir="rtl"] .nib-icon svg {
    transform: scaleX(-1);
}

[dir="rtl"] .nib-badge {
    right: auto;
    left: -12px;
}

[dir="rtl"] .nib-stats-total {
    margin-right: 0;
    margin-left: 16px;
}

[dir="rtl"] .nib-btn:hover:not(:disabled) .nib-icon {
    transform: rotate(10deg) scale(1.1);
}

/* ============================================
   19. ACCESSIBILITY
   ============================================ */

.nib-wrapper *:focus-visible {
    outline: 3px solid var(--nib-primary);
    outline-offset: 3px;
    border-radius: var(--nib-radius-xs);
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .nib-wrapper {
        --nib-border: #000000;
        --nib-text: #000000;
    }

    .nib-theme-minimal .nib-btn {
        border-width: 3px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .nib-wrapper,
    .nib-btn,
    .nib-icon,
    .nib-badge,
    .nib-progress-bar,
    .nib-success,
    .nib-stats,
    .nib-toast,
    .nib-confetti-piece,
    .nib-ripple::after {
        animation: none !important;
        transition: none !important;
    }

    .nib-wrapper.show {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    .nib-pos-bottom-center.show,
    .nib-pos-top-center.show {
        transform: translateX(-50%) !important;
    }
}

/* ============================================
   20. PRINT
   ============================================ */

@media print {
    .nib-wrapper,
    .nib-toast,
    .nib-confetti-piece,
    .nib-progress,
    .nib-success {
        display: none !important;
    }
}

/* ============================================
   END OF FILE
   ============================================ */