/* Flair Mobile Design System
 * WhatsApp-inspired mobile patterns for private pages
 */

/* ============================================
   MOBILE-SPECIFIC VARIABLES
   ============================================ */
@media (max-width: 768px) {
    :root {
        --touch-target-min: 44px;
        --bottom-nav-height: 64px;
        --page-padding-x: 16px;
        --page-padding-top: 8px;
        --card-padding-mobile: 16px;
    }
}

/* ============================================
   PRIVATE PAGE CONTAINER (Mobile)
   ============================================ */
@media (max-width: 768px) {
    .private-container {
        padding-left: var(--page-padding-x);
        padding-right: var(--page-padding-x);
        padding-top: var(--page-padding-top);
        padding-bottom: calc(var(--bottom-nav-height) + var(--spacing-lg));
        margin-top: 0;
    }
}

/* ============================================
   PAGE HEADER (WhatsApp Style)
   ============================================ */
.page-header-mobile {
    padding: var(--spacing-md) var(--page-padding-x, 16px) var(--spacing-sm);
}

.page-title-mobile {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.page-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-sm);
}

/* ============================================
   FAB ACTION BUTTON
   ============================================ */
.fab-action {
    width: var(--touch-target-min, 44px);
    height: var(--touch-target-min, 44px);
    min-width: var(--touch-target-min, 44px);
    min-height: var(--touch-target-min, 44px);
    padding: 0;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
    text-decoration: none;
}

.fab-action:hover {
    background: #4338ca;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
    color: white;
}

.fab-action:active {
    transform: scale(0.95);
}

.fab-action i {
    font-size: 20px;
}

/* ============================================
   WHATSAPP-STYLE LIST ITEM
   ============================================ */
.list-item-wa {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: white;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s ease;
}

.list-item-wa:hover {
    background-color: var(--background-light);
}

.list-item-wa:active {
    background-color: var(--background-lighter);
}

.list-item-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
    background: var(--background-lighter);
}

.list-item-avatar.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-secondary);
}

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

.list-item-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    line-height: 1.3;
}

.list-item-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    line-height: 1.4;
}

.list-item-meta {
    flex-shrink: 0;
    text-align: right;
    font-size: 12px;
    color: var(--text-tertiary);
}

/* ============================================
   FILTER PILLS (Horizontal Scroll)
   ============================================ */
.filter-pills {
    display: flex;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    position: relative;
}

/* Add fade edges indicator when scrollable */
@media (max-width: 768px) {
    .filter-pills::before,
    .filter-pills::after {
        content: '';
        position: sticky;
        width: 20px;
        height: 100%;
        pointer-events: none;
        z-index: 1;
    }
    
    .filter-pills::before {
        left: 0;
        background: linear-gradient(to right, white, transparent);
    }
    
    .filter-pills::after {
        right: 0;
        background: linear-gradient(to left, white, transparent);
    }
}

.filter-pills::-webkit-scrollbar {
    display: none;
}

.filter-pill {
    padding: 6px 16px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: white;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Mobile: Increase filter pill touch targets */
@media (max-width: 768px) {
    .filter-pill {
        padding: 10px 16px;
        min-height: 44px;
    }
}

.filter-pill:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-pill.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* ============================================
   SECTION GROUPS (Settings Style)
   ============================================ */
.section-group {
    background: white;
    border-radius: var(--radius-md);
    margin: var(--spacing-sm) var(--spacing-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.section-group-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: var(--spacing-sm) var(--spacing-md);
    margin: 0;
}

.section-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 14px var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: inherit;
}

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

.section-item-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 16px;
    flex-shrink: 0;
}

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

.section-item-label {
    font-size: 16px;
    color: var(--text-primary);
}

.section-item-chevron {
    color: var(--text-tertiary);
    font-size: 14px;
}

/* ============================================
   MOBILE CARDS (Enhanced)
   ============================================ */
@media (max-width: 768px) {
    .card-mobile {
        padding: var(--card-padding-mobile, 16px);
        border-radius: var(--radius-md);
        background: white;
        border: 1px solid var(--border-color);
        box-shadow: var(--shadow-sm);
    }
    
    /* Comprehensive touch target fixes - ensure ALL interactive elements meet 44px minimum */
    button, 
    .btn,
    [role="button"],
    a.nav-link,
    a.action-btn {
        min-height: var(--touch-target-min, 44px);
        min-width: var(--touch-target-min, 44px);
    }
    
    /* Filter pills touch targets */
    .filter-pill {
        min-height: 44px;
        padding: 10px 16px; /* Increase from 6px 16px */
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Links and clickable areas */
    a.nav-link, 
    .clickable,
    a.btn,
    .btn-link {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    
    /* Form inputs minimum height */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="search"],
    input[type="url"],
    input[type="password"],
    textarea,
    select {
        min-height: 44px;
    }
    
    /* Show More buttons */
    .show-more-btn {
        min-height: 44px;
        padding: 10px 16px;
    }
}

/* ============================================
   ADAPTIVE TABLE → CARDS
   ============================================ */
@media (max-width: 768px) {
    .table-adaptive {
        display: none !important;
    }
    
    .cards-adaptive {
        display: block !important;
    }
}

@media (min-width: 769px) {
    .table-adaptive {
        display: table !important;
    }
    
    .cards-adaptive {
        display: none !important;
    }
}

/* ============================================
   LOADING SKELETON
   ============================================ */
.skeleton {
    background: linear-gradient(90deg, var(--background-lighter) 25%, var(--background-light) 50%, var(--background-lighter) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 16px;
    margin-bottom: var(--spacing-xs);
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-card {
    height: 100px;
    margin-bottom: var(--spacing-sm);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state-mobile {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-md);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--spacing-md);
    background: var(--background-lighter);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--text-tertiary);
}

.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--spacing-xs);
}

.empty-state-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 var(--spacing-md);
    line-height: 1.5;
}

/* ============================================
   ERROR STATE
   ============================================ */
.error-state {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-md);
    background: #FEF2F2;
    border-radius: var(--radius-md);
    border: 1px solid #FECACA;
}

.error-state-icon {
    font-size: 32px;
    color: var(--danger-color);
    margin-bottom: var(--spacing-sm);
}

.error-state-text {
    font-size: 14px;
    color: var(--danger-color);
    margin: 0 0 var(--spacing-md);
}

.error-state .btn-retry {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
}
