/* ================================================================
   AapkaLove — Universal UI State System
   9 Core States: Empty, Error, Loading, Offline, Slow Internet,
   No Results, Permission Denied, Session Expired, Validation Success
   ================================================================ */

/* ── 1. Base Container & Layout ── */
.app-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--al-space-12, 32px) var(--al-space-8, 20px);
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    box-sizing: border-box;
    font-family: var(--al-font-sans, 'Inter', -apple-system, sans-serif);
    color: var(--al-text-primary, #171717);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* ── 2. Size & Container Variants ── */
.app-state--card {
    background: var(--al-bg-main, #ffffff);
    border: 1px solid var(--al-border, #e2e8f0);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.02);
}

.app-state--compact {
    padding: var(--al-space-6, 16px) var(--al-space-4, 12px);
    max-width: 360px;
}

.app-state--compact .app-state-icon {
    width: 38px;
    height: 38px;
    margin-bottom: 10px;
}

.app-state--compact .app-state-icon i,
.app-state--compact .app-state-icon svg {
    width: 18px;
    height: 18px;
}

.app-state--compact .app-state-title {
    font-size: 0.9375rem; /* 15px */
    margin-bottom: 4px;
}

.app-state--compact .app-state-description {
    font-size: 0.8125rem; /* 13px */
    margin-bottom: 12px;
}

.app-state--page,
.app-state--fullscreen {
    min-height: 55vh;
    padding: var(--al-space-16, 40px) var(--al-space-6, 16px);
}

.app-state--inline {
    flex-direction: row;
    align-items: center;
    text-align: left;
    max-width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--al-border, #e2e8f0);
    background: #f8fafc;
    gap: 14px;
}

.app-state--inline .app-state-icon {
    margin-bottom: 0;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
}

.app-state--inline .app-state-content {
    flex: 1;
    min-width: 0;
}

.app-state--inline .app-state-title {
    margin-bottom: 2px;
    font-size: 0.875rem;
}

.app-state--inline .app-state-description {
    margin-bottom: 0;
    font-size: 0.8125rem;
}

.app-state--inline .app-state-action {
    margin-top: 0;
    flex-shrink: 0;
}

/* ── 3. Icon Container & Visual Hierarchy ── */
.app-state-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.app-state-icon i,
.app-state-icon svg {
    width: 24px;
    height: 24px;
    stroke-width: 2.2;
}

/* ── 4. Title, Description & Action Elements ── */
.app-state-title {
    font-family: var(--al-font-display, 'Sora', var(--al-font-sans, sans-serif));
    font-size: 1.0625rem; /* 17px */
    font-weight: 700;
    color: var(--al-text-primary, #0f172a);
    margin: 0 0 6px 0;
    line-height: 1.35;
    letter-spacing: -0.015em;
}

.app-state-description {
    font-size: 0.875rem; /* 14px */
    color: var(--al-text-secondary, #64748b);
    line-height: 1.55;
    margin: 0 0 20px 0;
    max-width: 380px;
}

.app-state-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ── 5. Standard State Action Buttons ── */
.app-state-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 10px;
    font-size: 0.84375rem; /* 13.5px */
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    outline: none;
    line-height: 1.4;
}

.app-state-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(224, 33, 122, 0.25);
}

.app-state-btn-primary {
    background: var(--al-accent, #E0217A);
    color: #ffffff !important;
    border-color: var(--al-accent, #E0217A);
    box-shadow: 0 2px 6px rgba(224, 33, 122, 0.25);
}

.app-state-btn-primary:hover {
    background: var(--al-accent-hover, #B81761);
    border-color: var(--al-accent-hover, #B81761);
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(224, 33, 122, 0.32);
}

.app-state-btn-secondary {
    background: #f1f5f9;
    color: var(--al-text-primary, #334155) !important;
    border-color: #e2e8f0;
}

.app-state-btn-secondary:hover {
    background: #e2e8f0;
    color: #0f172a !important;
    transform: translateY(-1px);
}

.app-state-btn-outline {
    background: transparent;
    color: var(--al-accent, #E0217A) !important;
    border-color: rgba(224, 33, 122, 0.3);
}

.app-state-btn-outline:hover {
    background: rgba(224, 33, 122, 0.06);
    border-color: var(--al-accent, #E0217A);
    color: var(--al-accent, #E0217A) !important;
}

.app-state-btn i,
.app-state-btn svg {
    width: 14px;
    height: 14px;
    stroke-width: 2.2;
}

/* ── 6. State Specific Theme Colors & Icons ── */

/* 1. Empty State (Neutral / Editorial) */
.app-state--empty .app-state-icon {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

/* 2. Error State (Red / Alert) */
.app-state--error .app-state-icon {
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fecaca;
}

/* 3. Loading State (Brand Pink Shimmer) */
.app-state--loading .app-state-icon {
    background: rgba(224, 33, 122, 0.08);
    color: var(--al-accent, #E0217A);
    border: 1px solid rgba(224, 33, 122, 0.15);
}

/* 4. No Internet State (Slate / Network Off) */
.app-state--offline .app-state-icon {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

/* 5. Slow Internet State (Amber / Clock) */
.app-state--slow-internet .app-state-icon {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
    animation: alPulseAmber 2.2s infinite ease-in-out;
}

/* 6. No Search Results State (Blue / Search) */
.app-state--no-results .app-state-icon {
    background: #f0f9ff;
    color: #0284c7;
    border: 1px solid #bae6fd;
}

/* 7. Permission Denied State (Purple / Lock) */
.app-state--forbidden .app-state-icon {
    background: #faf5ff;
    color: #9333ea;
    border: 1px solid #e9d5ff;
}

/* 8. Session Expired State (Coral / Key) */
.app-state--session-expired .app-state-icon {
    background: #fff1f2;
    color: #e11d48;
    border: 1px solid #fecdd3;
}

/* 9. Form Validation Success State (Emerald / Check) */
.app-state--success .app-state-icon {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

/* ── 7. Elegant Spinner & Skeletons (Loading State) ── */
.app-state-spinner {
    width: 26px;
    height: 26px;
    border: 2.5px solid rgba(224, 33, 122, 0.18);
    border-top-color: var(--al-accent, #E0217A);
    border-radius: 50%;
    animation: alSpin 0.8s linear infinite;
    display: inline-block;
}

.app-state-spinner--white {
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
}

.app-state-spinner--sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

/* Shimmer Skeleton Infrastructure */
.app-skeleton {
    position: relative;
    overflow: hidden;
    background: #f1f5f9;
    border-radius: 8px;
}

.app-skeleton::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.6) 40%,
        rgba(255, 255, 255, 0.6) 60%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: alShimmer 1.6s infinite ease-out;
}

.app-skeleton-line {
    height: 14px;
    width: 100%;
    margin-bottom: 10px;
    border-radius: 6px;
}

.app-skeleton-line--short { width: 45%; }
.app-skeleton-line--medium { width: 70%; }
.app-skeleton-line--title { height: 20px; width: 60%; margin-bottom: 14px; }

.app-skeleton-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
}

.app-skeleton-card {
    border: 1px solid #e2e8f0;
    background: #ffffff;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 16px;
}

.app-skeleton-media {
    width: 100%;
    height: 160px;
    border-radius: 10px;
    margin-bottom: 14px;
}

/* ── 8. Form Validation Inline Feedback Components ── */
.app-form-feedback {
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    margin-top: 6px;
    line-height: 1.4;
    transition: all 0.2s ease;
}

.app-form-feedback.is-visible {
    display: flex;
}

.app-form-feedback--error {
    color: #dc2626;
}

.app-form-feedback--success {
    color: #059669;
}

.app-form-feedback--warning {
    color: #d97706;
}

.app-form-feedback i,
.app-form-feedback svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    stroke-width: 2.2;
}

/* Inline Form Alert Banner */
.app-form-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.84375rem;
    line-height: 1.45;
    border: 1px solid transparent;
}

.app-form-banner--success {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.app-form-banner--error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.app-form-banner--info {
    background: #f0f9ff;
    border-color: #bae6fd;
    color: #0369a1;
}

.app-form-banner-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.app-form-banner-icon i,
.app-form-banner-icon svg {
    width: 18px;
    height: 18px;
}

.app-form-banner-text {
    flex: 1;
    min-width: 0;
}

.app-form-banner-close {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: currentColor;
    opacity: 0.65;
    transition: opacity 0.15s ease;
    display: flex;
    align-items: center;
}

.app-form-banner-close:hover {
    opacity: 1;
}

/* ── 9. Slow Connection Bar (Top Non-Blocking Indicator) ── */
.app-network-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #ffffff;
    background: #0f172a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    transform: translateY(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-network-banner.is-active {
    transform: translateY(0);
}

.app-network-banner--offline {
    background: #dc2626;
}

.app-network-banner--slow {
    background: #d97706;
}

.app-network-banner--restored {
    background: #059669;
}

/* ── 10. Keyframe Animations ── */
@keyframes alSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes alShimmer {
    100% { transform: translateX(100%); }
}

@keyframes alPulseAmber {
    0%, 100% { transform: scale(1); border-color: #fde68a; }
    50% { transform: scale(1.04); border-color: #f59e0b; }
}

/* ── 11. Responsive Layout Polish ── */
@media (max-width: 576px) {
    .app-state {
        padding: var(--al-space-8, 20px) var(--al-space-4, 12px);
    }
    
    .app-state-title {
        font-size: 1rem;
    }
    
    .app-state-description {
        font-size: 0.8125rem;
        margin-bottom: 16px;
    }

    .app-state-btn {
        width: 100%;
    }

    .app-state--inline {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .app-state--inline .app-state-action {
        width: 100%;
    }
}
