/* Cooperative Dashboard Integrated Styles */
/* For use within index.html main app */

/* Controls */
.coop-controls {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

/* Tab Navigation */
.coop-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0;
    flex-wrap: wrap;
}

.coop-tabs .tab-btn {
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 500;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    margin-bottom: -2px;
}

.coop-tabs .tab-btn:hover {
    color: #b45309;
    background: #fff7ed;
}

.coop-tabs .tab-btn.active {
    color: #b45309;
    border-bottom-color: #b45309;
    background: transparent;
}

.coop-tabs .tab-btn i {
    font-size: 0.875rem;
}

/* Tab Content */
.coop-tab-content {
    animation: fadeIn 0.2s ease-in-out;
}

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

/* Section Styles */
.coop-section {
    background: var(--bg-primary, white);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    position: relative;
    overflow: hidden;
}

.coop-section::before {
    content: '';
    display: block;
    height: 4px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, #b45309, #f59e0b);
}

.coop-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.coop-section .section-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #1f2937;
}

.coop-section .section-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.coop-coop-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.coop-coop-search {
    min-width: 260px;
}

/* Overview Cards */
.overview-card {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 1.25rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    position: relative;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.overview-card::before {
    content: '';
    display: block;
    height: 4px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, #b45309, #f59e0b);
}

.overview-card:hover {
    box-shadow: 0 8px 24px rgba(180, 83, 9, 0.12);
}

.overview-card h3 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
}

.overview-card h3 i {
    color: #b45309;
}

/* Activity List */
.activity-list {
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f3f4f6;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.activity-icon.member { background: #dbeafe; color: #2563eb; }
.activity-icon.loan { background: #fef3c7; color: #d97706; }
.activity-icon.sale { background: #d1fae5; color: #059669; }
.activity-icon.coop { background: #fce7f3; color: #db2777; }

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-text {
    font-size: 0.875rem;
    color: #374151;
    margin: 0;
}

.activity-time {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

/* Pending List */
.pending-list {
    max-height: 300px;
    overflow-y: auto;
}

.pending-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: #fef3c7;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.pending-item:last-child {
    margin-bottom: 0;
}

.pending-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pending-info i {
    color: #d97706;
}

.pending-text {
    font-size: 0.875rem;
    color: #92400e;
}

/* Cooperatives Grid */
.cooperatives-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.cooperative-card {
    background: var(--bg-primary, white);
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 0;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    position: relative;
}

.cooperative-card::before {
    content: '';
    display: block;
    height: 4px;
    background: linear-gradient(90deg, #b45309, #f59e0b);
}

.cooperative-card.is-highlighted {
    border: 2px solid #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.cooperative-card:hover {
    transform: translateY(-4px);
    border-color: rgba(180, 83, 9, 0.35);
    box-shadow: 0 12px 28px rgba(180, 83, 9, 0.15);
}

.cooperative-card .card-header,
.cooperative-card .card-stats,
.cooperative-card .card-actions,
.cooperative-card__description,
.cooperative-card__meta {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

.cooperative-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0;
    padding-top: 1.25rem;
    padding-bottom: 0.75rem;
    background: linear-gradient(135deg, rgba(180, 83, 9, 0.06) 0%, rgba(245, 158, 11, 0.03) 100%);
}

.cooperative-card h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #1f2937;
}

.cooperative-card__description {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0;
    line-height: 1.45;
}

.cooperative-card__meta {
    display: grid;
    gap: 0.35rem;
    color: #6b7280;
    font-size: 0.8rem;
}

.cooperative-card__meta div {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.cooperative-card .card-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    border-top: 1px solid #f3f4f6;
}

.cooperative-card .mini-stat {
    text-align: center;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 10px;
    padding: 0.5rem;
}

.cooperative-card .mini-stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #b45309;
}

.cooperative-card .mini-stat-label {
    font-size: 0.75rem;
    color: #6b7280;
}

.cooperative-card .card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0;
    padding-top: 0.875rem;
    padding-bottom: 1rem;
    flex-wrap: wrap;
    background: var(--bg-secondary, #f9fafb);
    border-top: 1px solid #e5e7eb;
}

.cooperative-card__actions .btn {
    flex: 1 1 calc(50% - 0.5rem);
    justify-content: center;
}

/* Tables */
.members-table-container,
.loans-table-container,
.sales-table-container {
    overflow-x: auto;
}

.coop-table {
    width: 100%;
    border-collapse: collapse;
}

.coop-table th,
.coop-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.coop-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
}

.coop-table td {
    font-size: 0.875rem;
    color: #4b5563;
}

.coop-table tr:hover {
    background: #f9fafb;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.active { background: #d1fae5; color: #065f46; }
.status-badge.pending { background: #fef3c7; color: #92400e; }
.status-badge.approved { background: #dbeafe; color: #1e40af; }
.status-badge.completed { background: #e0e7ff; color: #3730a3; }
.status-badge.cancelled { background: #fee2e2; color: #991b1b; }
.status-badge.processing { background: #f3e8ff; color: #7c3aed; }
.status-badge.inactive { background: #f3f4f6; color: #374151; }
.status-badge.suspended { background: #fee2e2; color: #991b1b; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

.empty-state i {
    font-size: 3rem;
    color: #d1d5db;
    margin-bottom: 1rem;
}

.empty-state h3 {
    margin: 0 0 0.5rem 0;
    color: #374151;
}

.empty-state p {
    margin: 0;
}

/* Grid helpers */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

/* Form Select */
.form-select {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: white;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.25rem;
}

.form-select:focus {
    outline: none;
    border-color: #b45309;
    box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.1);
}

/* Loading text */
.loading-text {
    color: #6b7280;
    font-style: italic;
    padding: 1rem;
    text-align: center;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .coop-controls {
        flex-direction: column;
    }

    .coop-controls .btn {
        width: 100%;
        justify-content: center;
    }

    .coop-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.5rem;
    }

    .coop-tabs .tab-btn {
        flex-shrink: 0;
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }

    .coop-section .section-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }

    .coop-section .section-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .coop-coop-search {
        min-width: 0;
        width: 100%;
    }

    .cooperatives-grid {
        grid-template-columns: 1fr;
    }

    .cooperative-card__actions .btn {
        flex: 1 1 100%;
    }
}

/* Vibrant cooperative form modals (admin + dashboard) */
.admin-coop-modal-overlay,
.coop-dash-modal-overlay {
    z-index: 10050;
}

.admin-coop-modal-container,
.coop-dash-modal-container {
    max-width: 620px;
}

.admin-coop-modal-header--green,
.admin-coop-modal-header--amber,
.admin-coop-modal-header--indigo {
    background: linear-gradient(135deg, #6366f1 0%, #818cf8 55%, #a5b4fc 100%);
}

.admin-coop-modal-header--green {
    background: linear-gradient(135deg, #059669 0%, #10b981 55%, #34d399 100%);
}

.admin-coop-modal-header--amber {
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 55%, #fbbf24 100%);
}

.coop-form-modal-vibrant {
    padding: 1.1rem 1.25rem 1.25rem;
}

.coop-form-modal-hero {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    padding: 1rem;
    border-radius: 14px;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(129, 140, 248, 0.08) 100%);
    border: 1px solid rgba(99, 102, 241, 0.18);
}

.coop-form-modal-hero--green {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(52, 211, 153, 0.08) 100%);
    border-color: rgba(16, 185, 129, 0.22);
}

.coop-form-modal-hero--amber {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.14) 0%, rgba(251, 191, 36, 0.08) 100%);
    border-color: rgba(245, 158, 11, 0.24);
}

.coop-form-modal-hero-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #818cf8);
    box-shadow: 0 8px 18px rgba(99, 102, 241, 0.24);
    flex-shrink: 0;
}

.coop-form-modal-hero--green .coop-form-modal-hero-icon {
    background: linear-gradient(135deg, #10b981, #34d399);
    box-shadow: 0 8px 18px rgba(16, 185, 129, 0.24);
}

.coop-form-modal-hero--amber .coop-form-modal-hero-icon {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    box-shadow: 0 8px 18px rgba(245, 158, 11, 0.24);
}

.coop-form-kicker {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6366f1;
    margin-bottom: 0.2rem;
}

.coop-form-modal-hero-copy h3 {
    margin: 0 0 0.25rem;
    font-size: 1.1rem;
    color: #1f2937;
}

.coop-form-modal-hero-copy p {
    margin: 0;
    color: #6b7280;
    font-size: 0.875rem;
}

.coop-form-panel {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 1rem 1.05rem;
}

.coop-form-group {
    margin-bottom: 0.95rem;
}

.coop-form-group label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.45rem;
    font-weight: 600;
    color: #374151;
}

.coop-form-group label i {
    color: #6366f1;
}

.coop-form-control {
    width: 100%;
    padding: 0.62rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    color: #1f2937;
}

.coop-form-control:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.coop-form-control:disabled {
    background: #f9fafb;
    color: #6b7280;
}

.coop-form-note {
    margin: 0 0 0.85rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.22);
    color: #92400e;
    font-size: 0.8125rem;
}

.coop-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
    flex-wrap: wrap;
    margin-top: 0.35rem;
}

@media (max-width: 768px) {
    .coop-form-actions {
        flex-direction: column-reverse;
    }

    .coop-form-actions .btn {
        width: 100%;
    }
}
