/**
 * ═══════════════════════════════════════════════════════════════
 * 🧩 COMPONENTS CSS — आकाश सहकारी
 * ═══════════════════════════════════════════════════════════════
 * फाइल: assets/css/components.css
 *
 * यो फाइलमा सबै reusable UI components छन् जुन Public,
 * Admin, Member र Verify — सबै portal ले share गर्छन्।
 *
 * Load order:
 *   1. unified-portal.css
 *   2. global-theme.php
 *   3. components.css  ← यो फाइल
 *   4. Portal-specific overrides
 *
 * ⚠️ हरेक component यहाँ एकपटक मात्र define गर्नुस्।
 * ═══════════════════════════════════════════════════════════════
 */

/* ════════════════════════════════════════════════════════════
   1. FLASH MESSAGE — panel-uniform.php coopFlash() ले यही use गर्छ
   ════════════════════════════════════════════════════════════ */
.flash-message {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: var(--z-toast, 500);
    max-width: 420px;
    min-width: 300px;
    animation: slideInRight 0.3s ease forwards;
}
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}

.flash-message .coop-alert {
    border-radius: var(--radius-md);
    padding: 14px 18px;
    box-shadow: var(--shadow-lg);
}

/* Static flash (inline, not floating) */
.flash-inline {
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--font-size-sm);
    font-weight: 500;
}
.flash-inline.success { background: var(--color-success-bg); color: var(--color-success); border: 1px solid var(--color-success-border); }
.flash-inline.error,
.flash-inline.danger  { background: var(--color-danger-bg); color: var(--color-danger); border: 1px solid var(--color-danger-border); }
.flash-inline.warning { background: var(--color-warning-bg); color: var(--color-warning); border: 1px solid var(--color-warning-border); }
.flash-inline.info    { background: var(--color-info-bg); color: var(--color-info); border: 1px solid var(--color-info-border); }


/* ════════════════════════════════════════════════════════════
   2. BREADCRUMB — सबै portal मा एकरूप
   ════════════════════════════════════════════════════════════ */
.coop-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    list-style: none;
    margin: 0; padding: 0;
    font-size: var(--font-size-xs, 0.75rem);
    color: var(--text-muted);
}
.coop-breadcrumb li { display: flex; align-items: center; gap: 4px; }
.coop-breadcrumb li:not(:last-child)::after { content: '/'; color: var(--text-light); margin-left: 4px; }
.coop-breadcrumb a { color: var(--text-muted); text-decoration: none; transition: color var(--transition-fast); }
.coop-breadcrumb a:hover { color: var(--primary-color); }
.coop-breadcrumb li.active { color: var(--text-primary); font-weight: 500; }
.coop-breadcrumb i { font-size: 0.7em; }

/* Page banner style breadcrumb */
.page-banner .coop-breadcrumb a, .page-banner .coop-breadcrumb { color: rgba(255,255,255,0.75); }
.page-banner .coop-breadcrumb li.active { color: #fff; }
.page-banner .coop-breadcrumb li::after { color: rgba(255,255,255,0.4) !important; }


/* ════════════════════════════════════════════════════════════
   3. DATA TABLE WRAPPER — admin र member मा एकरूप
   ════════════════════════════════════════════════════════════ */
.data-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-sm);
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-soft);
}
.data-table-header h5 {
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
    font-size: var(--font-size-base);
}
.data-table-search {
    display: flex;
    align-items: center;
    gap: 8px;
}
.data-table-search .form-control {
    min-width: 200px;
    height: 36px;
    min-height: 36px;
    padding: 6px 12px;
    font-size: var(--font-size-sm);
}
.data-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-sm);
    padding: 0.75rem 1.25rem;
    background: var(--bg-soft);
    border-top: 1px solid var(--border-soft);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* Empty state row in table */
.table-empty-row td {
    text-align: center;
    padding: 2.5rem 1rem !important;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}
.table-empty-row i { display: block; font-size: 2rem; color: var(--text-light); margin-bottom: 8px; }


/* ════════════════════════════════════════════════════════════
   4. ACTION BUTTONS — admin table rows मा एकरूप
   ════════════════════════════════════════════════════════════ */
.action-btns {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.btn-action {
    width: 30px; height: 30px;
    border-radius: var(--radius-sm);
    border: none; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.78rem;
    transition: all var(--transition-fast);
    text-decoration: none;
    padding: 0;
}
.btn-action.edit    { background: var(--color-info-bg); color: var(--color-info); }
.btn-action.view    { background: var(--bg-muted); color: var(--primary-color); }
.btn-action.delete  { background: var(--color-danger-bg); color: var(--color-danger); }
.btn-action.toggle  { background: var(--color-warning-bg); color: var(--color-warning); }
.btn-action.approve { background: var(--color-success-bg); color: var(--color-success); }
.btn-action:hover   { filter: brightness(0.9); transform: scale(1.08); }


/* ════════════════════════════════════════════════════════════
   5. SIDEBAR — Admin र Member दुवैमा एकरूप structure
   ════════════════════════════════════════════════════════════ */
.coop-sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-soft);
    height: 100vh;
    position: fixed;
    top: 0; left: 0;
    overflow-y: auto;
    z-index: var(--z-sticky, 200);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-base);
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}
.coop-sidebar::-webkit-scrollbar { width: 4px; }
.coop-sidebar::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

.coop-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-soft);
    position: sticky; top: 0;
    background: var(--bg-card);
    z-index: 1;
}
.coop-sidebar-brand img { height: 36px; width: auto; object-fit: contain; }
.coop-sidebar-brand-text { font-weight: 700; font-size: var(--font-size-sm); color: var(--primary-color); line-height: 1.3; }

.coop-sidebar-nav { padding: 12px 10px; flex: 1; }
.coop-sidebar-section { margin-bottom: 4px; }
.coop-sidebar-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 8px 12px 4px;
}
.coop-sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
    margin-bottom: 1px;
    position: relative;
}
.coop-sidebar-link i { width: 20px; text-align: center; font-size: 0.9rem; color: var(--text-muted); flex-shrink: 0; }
.coop-sidebar-link:hover {
    background: var(--bg-muted);
    color: var(--primary-color);
}
.coop-sidebar-link:hover i { color: var(--primary-color); }
.coop-sidebar-link.active {
    background: var(--primary-color);
    color: var(--text-on-primary, #fff);
}
.coop-sidebar-link.active i { color: var(--text-on-primary, #fff); }

/* Badge on sidebar link */
.coop-sidebar-badge {
    margin-left: auto;
    background: var(--color-danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    min-width: 18px;
    text-align: center;
}

/* Sidebar collapsed state (mobile) */
@media (max-width: 992px) {
    .coop-sidebar { transform: translateX(-100%); }
    .coop-sidebar.open { transform: translateX(0); box-shadow: var(--shadow-xl); }
    .coop-main-content { margin-left: 0 !important; }
}


/* ════════════════════════════════════════════════════════════
   6. TOPBAR / HEADER — Admin र Member मा एकरूप
   ════════════════════════════════════════════════════════════ */
.coop-topbar {
    height: 58px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
    position: sticky; top: 0;
    z-index: var(--z-sticky, 200);
    box-shadow: var(--shadow-xs);
}
.coop-topbar-left { display: flex; align-items: center; gap: var(--space-md); }
.coop-topbar-right { display: flex; align-items: center; gap: var(--space-sm); }

.topbar-toggle-btn {
    background: none; border: none; cursor: pointer;
    width: 36px; height: 36px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
    transition: all var(--transition-fast);
}
.topbar-toggle-btn:hover { background: var(--bg-soft); color: var(--primary-color); }

.topbar-page-title {
    font-weight: 700;
    font-size: var(--font-size-base);
    color: var(--text-primary);
}

/* User avatar in topbar */
.topbar-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--text-on-primary, #fff);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.9rem;
    cursor: pointer;
    text-transform: uppercase;
    border: 2px solid transparent;
    transition: border-color var(--transition-fast);
}
.topbar-avatar:hover { border-color: var(--primary-light); }
.topbar-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* Notification bell */
.topbar-bell {
    position: relative;
    width: 36px; height: 36px;
    border-radius: var(--radius-md);
    border: none; background: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary);
    font-size: 1rem;
    transition: all var(--transition-fast);
}
.topbar-bell:hover { background: var(--bg-soft); color: var(--primary-color); }
.topbar-bell-count {
    position: absolute;
    top: 2px; right: 2px;
    background: var(--color-danger);
    color: #fff;
    font-size: 0.6rem; font-weight: 700;
    width: 16px; height: 16px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 1.5px solid var(--bg-card);
}


/* ════════════════════════════════════════════════════════════
   7. AUTH PAGES — Login/Register — सबै portal एकरूप
   ════════════════════════════════════════════════════════════ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    padding: var(--space-lg);
    position: relative;
    overflow: hidden;
}
.auth-page::before {
    content: '';
    position: absolute; inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}
.auth-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}
.auth-logo img { height: 64px; width: auto; object-fit: contain; }
.auth-title {
    text-align: center;
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}
.auth-subtitle {
    text-align: center;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}
.auth-divider {
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    position: relative;
    margin: 1rem 0;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    position: absolute;
    top: 50%; width: calc(50% - 30px);
    height: 1px; background: var(--border-color);
}
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }
.auth-footer {
    text-align: center;
    margin-top: 1.25rem;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

/* Password toggle */
.password-field { position: relative; }
.password-field .form-control { padding-right: 44px; }
.password-toggle {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 0.9rem;
    padding: 4px;
    transition: color var(--transition-fast);
}
.password-toggle:hover { color: var(--primary-color); }


/* ════════════════════════════════════════════════════════════
   8. PORTAL-SPECIFIC HEADER OVERRIDES
   ════════════════════════════════════════════════════════════ */

/* Admin sidebar active indicator */
.admin-sidebar-wrapper .coop-sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 60%;
    background: var(--text-on-primary, #fff);
    border-radius: 0 2px 2px 0;
}

/* Member portal card accent */
.mem-portal-card {
    border-left: 4px solid var(--primary-color);
}

/* Verify portal minimal layout */
.verify-page {
    min-height: 100vh;
    background: var(--bg-page);
    display: flex;
    flex-direction: column;
}
.verify-result-card {
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}
.verify-result-success { border-top: 4px solid var(--color-success); }
.verify-result-error   { border-top: 4px solid var(--color-danger); }


/* ════════════════════════════════════════════════════════════
   9. ID CARD COMPONENT — Member portal print view
   ════════════════════════════════════════════════════════════ */
.id-card {
    width: 85.6mm; height: 53.98mm; /* Standard credit card size */
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: var(--primary-color);
    position: relative;
    font-family: var(--font-primary);
}
.id-card-header {
    background: var(--primary-dark);
    padding: 8px 12px;
    display: flex; align-items: center; gap: 8px;
}
.id-card-header img { height: 28px; }
.id-card-body { padding: 10px 12px; display: flex; gap: 10px; align-items: flex-start; }
.id-card-photo {
    width: 52px; height: 60px;
    border-radius: 4px;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.5);
    flex-shrink: 0;
}
.id-card-info { color: var(--text-on-primary, #fff); flex: 1; }
.id-card-name { font-weight: 700; font-size: 0.7rem; margin-bottom: 2px; }
.id-card-meta { font-size: 0.58rem; opacity: 0.85; line-height: 1.6; }
.id-card-footer {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: rgba(0,0,0,0.25);
    padding: 4px 12px;
    display: flex; justify-content: space-between; align-items: center;
}
.id-card-footer span { font-size: 0.55rem; color: rgba(255,255,255,0.8); }

@media print {
    .id-card { box-shadow: none; border: 1px solid #ccc; }
}


/* ════════════════════════════════════════════════════════════
   10. PRINT STYLES — सबै portal shared
   ════════════════════════════════════════════════════════════ */
@media print {
    .coop-sidebar, .coop-topbar, .mobile-bottom-nav,
    .no-print, .action-btns, .btn-action,
    .sidebar-overlay { display: none !important; }

    body { background: #fff !important; color: #000; font-size: 12px; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; }
    .table th { background: #f0f0f0 !important; -webkit-print-color-adjust: exact; }
    a[href]:after { content: none !important; }

    .print-header { display: block !important; }
    .print-footer { display: block !important; }
}
.print-header, .print-footer { display: none; }
