/**
 * AbhiHub — 03_components.css
 * Reusable UI components: buttons, cards, forms, badges, modals,
 * notifications, share panel, skeleton, loading spinner.
 * Depends on: 01_tokens.css, 02_base.css
 */

/* ════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
    font-weight: 600;
    font-family: var(--font-primary);
    border: none;
    border-radius: var(--radius-xl);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--text-inverse);
    box-shadow: var(--shadow-blue);
}
.btn-primary:hover {
    background: var(--gradient-primary-h);
    transform: translateY(-2px);
    box-shadow: var(--shadow-blue-lg);
    color: var(--text-inverse);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-gray-medium);
    border: 1px solid var(--border-medium);
}
.btn-secondary:hover {
    background: var(--border-light);
    color: var(--text-gray-dark);
    transform: translateY(-2px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}
.btn-ghost:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

.btn-success {
    background: var(--gradient-green);
    color: var(--text-inverse);
    box-shadow: 0 4px 16px rgba(16,185,129,0.3);
}
.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16,185,129,0.4);
    color: var(--text-inverse);
}

.btn-sm { padding: var(--space-2) var(--space-4); font-size: var(--text-sm); }
.btn-lg { padding: var(--space-4) var(--space-8); font-size: var(--text-lg); }

@media (max-width: 480px) {
    .btn-block { width: 100%; justify-content: center; }
}

/* ════════════════════════════════════════
   CARDS
   ════════════════════════════════════════ */
.card {
    background: var(--surface);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-2xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}
.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-normal);
}
.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--primary-200);
}
.card:hover::before { opacity: 1; }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}
.card-title {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--primary-600);
    margin-bottom: var(--space-2);
}
.card-description {
    color: var(--text-gray-medium);
    font-size: var(--text-base);
    line-height: 1.6;
    margin-bottom: var(--space-6);
}

@media (max-width: 768px) {
    .card { padding: var(--space-4); }
}

/* ════════════════════════════════════════
   GLASS CARD
   ════════════════════════════════════════ */
.glass-card {
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: var(--radius-2xl);
    box-shadow: 0 8px 32px rgba(0,0,0,0.08);
}

/* ════════════════════════════════════════
   FORMS
   ════════════════════════════════════════ */
.form-group  { margin-bottom: var(--space-5); }

.form-label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
    font-family: var(--font-primary);
    color: var(--text-primary);
    background: var(--surface);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-600);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.13);
    background: var(--bg-secondary);
}
.form-input::placeholder { color: var(--text-tertiary); }
.form-textarea { resize: vertical; min-height: 120px; }

/* ════════════════════════════════════════
   BADGES
   ════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-primary  { background: var(--primary-100);  color: var(--primary-700); }
.badge-success  { background: rgba(16,185,129,0.1); color: var(--accent-green-dark); border: 1px solid rgba(16,185,129,0.2); }
.badge-warning  { background: rgba(245,158,11,0.1); color: #d97706; border: 1px solid rgba(245,158,11,0.2); }
.badge-purple   { background: rgba(139,92,246,0.1); color: #7c3aed; border: 1px solid rgba(139,92,246,0.2); }

/* Beta badge via class (replaces ::before hacks) */
.badge-beta {
    background: var(--gradient-primary);
    color: var(--text-inverse);
    box-shadow: var(--shadow-blue);
    animation: pulse 2s ease-in-out infinite;
}

/* ════════════════════════════════════════
   NOTIFICATION MODAL  (single definition)
   ════════════════════════════════════════ */
.notification-popup {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 2000;
    animation: fadeIn 0.4s ease-out;
    backdrop-filter: blur(4px);
}
.notification-popup.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.notification-content {
    background: var(--surface);
    border-radius: var(--radius-2xl);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-2xl);
    position: relative;
    animation: slideUpBounce 0.6s ease-out;
    border: 1px solid var(--border-light);
}

.notification-header {
    padding: var(--space-8) var(--space-8) var(--space-4);
    text-align: center;
    position: relative;
}
.notification-icon {
    font-size: 4rem;
    margin-bottom: var(--space-4);
    display: block;
}
.notification-title {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    line-height: 1.3;
}
.notification-subtitle {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    margin: 0;
}
.notification-close {
    position: absolute;
    top: var(--space-4); right: var(--space-4);
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    width: 40px; height: 40px;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}
.notification-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    transform: scale(1.1);
}

.notification-body {
    padding: 0 var(--space-8) var(--space-8);
}
.notification-message {
    font-size: var(--text-lg);
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: var(--space-6);
    text-align: center;
}
.notification-actions {
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
    justify-content: center;
}

.notification-btn {
    padding: var(--space-3) var(--space-8);
    font-size: var(--text-lg);
    font-weight: 600;
    border-radius: var(--radius-xl);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 120px;
}
.notification-btn.primary {
    background: var(--gradient-primary);
    color: var(--text-inverse);
    box-shadow: var(--shadow-lg);
}
.notification-btn.primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-xl); }
.notification-btn.secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-medium);
}
.notification-btn.secondary:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    transform: translateY(-2px);
}
.notification-btn.share {
    background: var(--gradient-green);
    color: var(--text-inverse);
    box-shadow: var(--shadow-lg);
}
.notification-btn.share:hover { transform: translateY(-2px); box-shadow: var(--shadow-xl); }

@media (max-width: 900px) {
    .notification-header { padding: var(--space-6) var(--space-6) var(--space-4); }
    .notification-body   { padding: 0 var(--space-6) var(--space-6); }
    .notification-icon   { font-size: 3rem; }
    .notification-title  { font-size: var(--text-xl); }
    .notification-actions { flex-direction: column; }
    .notification-btn    { width: 100%; }
}

/* ════════════════════════════════════════
   SHARE PANEL
   ════════════════════════════════════════ */
.share-options {
    display: none;
    margin-top: var(--space-4);
    padding: var(--space-4);
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
}
.share-options.show {
    display: block;
    animation: slideDown 0.3s ease-out;
}
.share-buttons {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
    flex-wrap: wrap;
}
.share-btn {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-lg);
    border: none;
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-inverse);
}
.share-btn:hover        { transform: scale(1.05); opacity: 0.9; }
.share-btn.whatsapp     { background: #25d366; }
.share-btn.twitter      { background: #1da1f2; }
.share-btn.facebook     { background: #4267b2; }
.share-btn.copy         { background: var(--text-secondary); }

@media (max-width: 900px) {
    .share-buttons { flex-direction: column; }
    .share-btn     { justify-content: center; }
}

/* ════════════════════════════════════════
   LOADING SPINNER
   ════════════════════════════════════════ */
.spinner {
    display: inline-block;
    width: 20px; height: 20px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary-600);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ════════════════════════════════════════
   SKELETON LOADER
   ════════════════════════════════════════ */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

/* ════════════════════════════════════════
   EMPTY STATE
   ════════════════════════════════════════ */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-tertiary);
}
.empty-state-icon        { font-size: 4rem; margin-bottom: var(--space-4); opacity: 0.5; }
.empty-state-title       { font-size: var(--text-xl); font-weight: 600; color: var(--text-secondary); margin-bottom: var(--space-2); }
.empty-state-description { font-size: var(--text-base); max-width: 400px; margin: 0 auto; }

/* ════════════════════════════════════════
   TOGGLE SWITCH
   ════════════════════════════════════════ */
.toggle-switch {
    position: relative;
    width: 44px; height: 24px;
    background: var(--gray-300);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background 0.3s;
}
.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 20px; height: 20px;
    background: var(--surface);
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    box-shadow: var(--shadow-sm);
}
.toggle-switch.active               { background: var(--accent-green); }
.toggle-switch.active::after        { transform: translateX(20px); }
