/* ===========================================
   FamilyRack Families Page Styles
   Matches mobile app family cards
   =========================================== */

/* Page Container */
.families-container {
    min-height: 100vh;
    background: var(--surface);
}

/* Header */
.families-header {
    background: var(--surface);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.families-header-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.logout-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.logout-btn:hover {
    text-decoration: underline;
}

/* Content */
.families-content {
    max-width: 600px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* Section */
.section {
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.count-badge {
    background: var(--primary);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    margin-left: 8px;
}

/* Family Card */
.family-card {
    display: flex;
    align-items: center;
    background: white;
    padding: 20px 16px;
    border-radius: 20px;
    margin-bottom: 8px;
    border: 1px solid #E8E0DB;
    position: relative;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
}

.family-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Badges */
.badge-container {
    position: absolute;
    top: 8px;
    right: 12px;
}

.badge {
    display: flex;
    align-items: center;
    padding: 5px;
    border-radius: 14px;
}

.badge-primary {
    background: #ccf8dc;
    color: #17A34A;
}

.badge-origin {
    background: #DBEAFE;
    color: #1976D2;
}

.badge-private {
    background: #F3E5F5;
    color: #9C27B0;
}

.badge .mdi {
    font-size: 14px;
}

/* Avatar */
.family-avatar {
    width: 56px;
    height: 56px;
    border-radius: 28px;
    background: var(--primary-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 14px;
    overflow: hidden;
    flex-shrink: 0;
}

.family-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.family-avatar .mdi {
    font-size: 28px;
    color: var(--primary);
}

/* Avatar Stack (for member composites) */
.avatar-stack {
    display: flex;
    margin-right: 14px;
}

.avatar-stack-item {
    width: 40px;
    height: 40px;
    border-radius: 20px;
    background: var(--primary-soft);
    border: 2px solid white;
    margin-left: -12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.avatar-stack-item:first-child {
    margin-left: 0;
}

.avatar-stack-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-stack-item .initials {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

/* Card Content */
.family-card-content {
    flex: 1;
    min-width: 0;
    margin-right: 8px;
}

.family-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.family-members {
    font-size: 14px;
    color: #7A7A7A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.family-card-chevron {
    color: var(--text-light);
    font-size: 24px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 12px;
}

.empty-state .mdi {
    font-size: 48px;
    color: var(--text-light);
}

.empty-state-title {
    margin-top: 12px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.empty-state-subtitle {
    margin-top: 4px;
    font-size: 14px;
    color: var(--text-secondary);
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
}

.loading-state .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
}

.loading-state-text {
    margin-top: 16px;
    font-size: 16px;
    color: var(--text-secondary);
}

/* Error State */
.error-state {
    text-align: center;
    padding: 40px 24px;
}

.error-state .mdi {
    font-size: 48px;
    color: var(--error);
}

.error-state-text {
    margin-top: 12px;
    font-size: 16px;
    color: var(--error);
}

.retry-btn {
    margin-top: 16px;
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.retry-btn:hover {
    background: var(--primary-dark);
}