/*
 * Lestr Component Library - Shared Styles
 * ========================================
 * This file provides common styles for Lestr components.
 * Import this file in your web project's main CSS or _Host.cshtml.
 *
 * Required CSS Variables (define these in your project's root CSS):
 * --primary-color: Primary brand color (default: #7030A0)
 * --secondary-color: Secondary/background color (default: #f0f2f5)
 * --text-color: Main text color (default: #333)
 * --text-muted: Muted/secondary text color (default: #6b7280)
 * --border-color: Border color (default: #e0e0e0)
 * --card-bg: Card background color (default: #fff)
 * --card-shadow: Card shadow (default: 0 4px 15px rgba(0, 0, 0, 0.07))
 */

/* ============================================
   CSS Variable Defaults (fallbacks)
   ============================================ */
:root {
    /* These can be overridden by project-specific CSS */
    --primary-color: #7030A0;
    --secondary-color: #f0f2f5;
    --text-color: #333;
    --text-muted: #6b7280;
    --border-color: #e0e0e0;
    --card-bg: #fff;
    --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.07);
    --border-radius: 8px;

    /* Status colors */
    --color-success: #059669;
    --color-success-bg: #d1fae5;
    --color-warning: #d97706;
    --color-warning-bg: #fef3c7;
    --color-danger: #dc2626;
    --color-danger-bg: #fee2e2;
    --color-info: #2563eb;
    --color-info-bg: #dbeafe;
    --color-muted: #6b7280;
    --color-muted-bg: #f3f4f6;
}

/* ============================================
   Status Badges (shared across components)
   ============================================ */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Application Status */
.status-badge.status-draft {
    background: var(--color-muted-bg);
    color: var(--color-muted);
}

.status-badge.status-submitted,
.status-badge.status-eligibility,
.status-badge.status-under-review {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.status-badge.status-pending {
    background: var(--color-info-bg);
    color: var(--color-info);
}

.status-badge.status-approved,
.status-badge.status-completed {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.status-badge.status-declined,
.status-badge.status-failed-kyc {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.status-badge.status-withdrawn {
    background: var(--color-muted-bg);
    color: #9ca3af;
}

/* Active/Inactive Status */
.status-badge.status-active {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.status-badge.status-inactive {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

/* ============================================
   Data Tables
   ============================================ */
.table-container {
    overflow-x: auto;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--secondary-color);
}

.data-table th {
    padding: 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-color);
    white-space: nowrap;
}

.data-table td {
    padding: 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
}

.data-table tbody tr:hover {
    background: rgba(112, 48, 160, 0.03);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================
   Filter Controls
   ============================================ */
.filters-container {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    margin-bottom: 20px;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 200px;
}

.filter-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-color);
}

.filter-input,
.filter-select {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text-color);
    background: var(--card-bg);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(112, 48, 160, 0.1);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    border: none;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    filter: brightness(1.1);
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--text-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-link:hover {
    background: rgba(112, 48, 160, 0.1);
}

.btn-clear {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-clear:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 20px;
}

.info-card {
    background: var(--secondary-color);
    border-radius: var(--border-radius);
    padding: 20px;
}

/* ============================================
   Alerts
   ============================================ */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.alert-success {
    background: var(--color-success-bg);
    border: 1px solid #a7f3d0;
    color: var(--color-success);
}

.alert-warning {
    background: var(--color-warning-bg);
    border: 1px solid #fde68a;
    color: var(--color-warning);
}

.alert-danger {
    background: var(--color-danger-bg);
    border: 1px solid #fecaca;
    color: var(--color-danger);
}

.alert-info {
    background: var(--color-info-bg);
    border: 1px solid #bfdbfe;
    color: var(--color-info);
}

/* ============================================
   Utility Classes
   ============================================ */
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-danger { color: var(--color-danger); }
.text-muted { color: var(--text-muted); }

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.empty-state p {
    color: var(--text-muted);
    margin: 0;
}

/* ============================================
   Practice Areas Multi-Select
   ============================================ */
.practice-areas-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.practice-area-item {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.practice-area-item span {
    white-space: nowrap;
}

.results-count {
    margin-top: 15px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.error-alert {
    background: var(--color-danger-bg);
    border: 1px solid #fecaca;
    color: var(--color-danger);
    padding: 15px 20px;
    border-radius: var(--border-radius);
}

.success-alert {
    background: var(--color-success-bg);
    border: 1px solid #a7f3d0;
    color: var(--color-success);
    padding: 15px 20px;
    border-radius: var(--border-radius);
}

/* ============================================
   Page Headers
   ============================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 768px) {
    .filter-row {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
        min-width: auto;
    }

    .data-table th,
    .data-table td {
        padding: 10px;
        font-size: 0.85rem;
    }
}

/* ============================================
   Law Firm Details Popup
   ============================================ */
.firm-popup-overlay {
    background: rgba(0, 0, 0, 0.6);
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.firm-popup-overlay.visible {
    display: flex;
}

.firm-popup {
    background: white;
    border-radius: 12px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
    position: relative;
    display: flex;
    flex-direction: column;
}

.firm-popup-header {
    background: #f8f9fa;
    padding: 20px 40px;
    position: relative;
    border-bottom: 3px solid #6b2d5c;
}

.firm-logo-container {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.firm-logo-placeholder {
    height: 80px;
    width: 80px;
    background: linear-gradient(135deg, #6b2d5c 0%, #8b3a7a 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.firm-logo-image {
    height: 80px;
    max-width: 200px;
    border-radius: 8px;
    object-fit: contain;
    flex-shrink: 0;
}

.firm-company-name {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #6b2d5c;
    margin: 0 0 25px 0;
}

.firm-popup-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #e9ecef;
    border: none;
    color: #6b2d5c;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 2;
}

.firm-popup-close-btn:hover {
    background: #dee2e6;
    transform: rotate(90deg);
}

.firm-popup-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.firm-main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
    background: linear-gradient(to bottom, #ffffff 0%, #fafbfc 100%);
}

.firm-section {
    margin-bottom: 35px;
}

.firm-section-title {
    color: #6b2d5c;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.firm-section-title::before {
    content: '';
    width: 4px;
    height: 24px;
    background: linear-gradient(135deg, #6b2d5c, #8b3a7a);
    border-radius: 2px;
}

.firm-about-text {
    color: #333;
    line-height: 1.7;
    font-size: 15px;
}

.firm-contact-grid {
    display: grid;
    gap: 15px;
}

.firm-contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 10px;
    transition: all 0.2s;
    border: 1px solid #e9ecef;
}

.firm-contact-item:hover {
    transform: translateX(3px);
    border-color: #dee2e6;
    background: #ffffff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.firm-contact-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #6b2d5c, #8b3a7a);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(107, 45, 92, 0.2);
}

.firm-contact-icon svg {
    width: 20px;
    height: 20px;
}

.firm-contact-details {
    flex: 1;
}

.firm-contact-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.firm-contact-value {
    color: #333;
    font-size: 15px;
    font-weight: 500;
}

.firm-contact-value a {
    color: #6b2d5c;
    text-decoration: none;
    transition: color 0.2s;
    font-weight: 500;
}

.firm-contact-value a:hover {
    text-decoration: underline;
    color: #8b3a7a;
}

.firm-services-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.firm-service-tag {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    color: #2e7d32;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid #a5d6a7;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.firm-service-tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.firm-service-tag.neutral {
    background: linear-gradient(135deg, #f5f5f5, #e0e0e0);
    color: #666;
    border-color: #ccc;
}

.firm-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: linear-gradient(to bottom, #f8f9fa 0%, #f1f3f5 100%);
    border-left: 1px solid #dee2e6;
    padding: 40px 30px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.firm-sidebar-title {
    color: #6b2d5c;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e8e0e7;
}

.firm-office-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.firm-office-item {
    background: white;
    padding: 18px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(107, 45, 92, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.firm-office-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(107, 45, 92, 0.15);
}

.firm-office-name {
    font-weight: 600;
    color: #6b2d5c;
    font-size: 15px;
    margin-bottom: 8px;
}

.firm-office-address {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

.firm-popup-loading,
.firm-popup-error {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.firm-popup-error {
    color: #dc3545;
}

@media (max-width: 768px) {
    .firm-popup {
        max-height: 95vh;
        display: flex;
        flex-direction: column;
    }

    .firm-popup-content {
        flex-direction: column;
        flex: 1;
        overflow-y: auto;
        min-height: 0;
    }

    .firm-main-content {
        padding: 25px 20px;
        overflow-y: visible;
        flex: none;
    }

    .firm-sidebar {
        width: 100%;
        flex-shrink: 0;
        border-left: none;
        border-top: 1px solid #e8e0e7;
        padding: 30px 20px;
        overflow-y: visible;
        flex: none;
    }

    .firm-popup-header {
        padding: 20px;
        flex-shrink: 0;
    }

    .firm-logo-placeholder {
        height: 60px;
        width: 60px;
        font-size: 22px;
    }

    .firm-logo-image {
        height: 60px;
        max-width: 150px;
    }

    .firm-company-name {
        font-size: 22px;
        margin-bottom: 20px;
    }

    .firm-popup-close-btn {
        top: 15px;
        right: 15px;
        width: 32px;
        height: 32px;
        font-size: 20px;
    }

    .firm-section {
        margin-bottom: 25px;
    }

    .firm-section-title {
        font-size: 18px;
    }

    .firm-about-text {
        font-size: 14px;
    }

    .firm-contact-icon {
        width: 36px;
        height: 36px;
    }

    .firm-contact-icon svg {
        width: 18px;
        height: 18px;
    }

    .firm-contact-label {
        font-size: 11px;
    }

    .firm-contact-value {
        font-size: 14px;
    }

    .firm-service-tag {
        font-size: 13px;
        padding: 8px 16px;
    }

    .firm-sidebar-title {
        font-size: 16px;
        margin-bottom: 15px;
    }

    .firm-office-item {
        padding: 15px;
    }

    .firm-office-name {
        font-size: 14px;
    }

    .firm-office-address {
        font-size: 12px;
    }

    .firm-office-list {
        gap: 15px;
    }

    .firm-contact-grid {
        gap: 12px;
    }

    .firm-contact-item {
        padding: 10px;
    }
}
