// ============================================
// ADMIN REQUESTS - Mobile-First Compact Design
// ============================================
@import '../admin-shared.scss';

.admin-requests {
    min-height: 100%;
    padding: $admin-space-md;
    padding-bottom: calc($admin-space-md + 80px); // Mobile nav space
    animation: pageEnter 0.4s ease-out;

    @media (min-width: 768px) {
        padding: $admin-space-lg;
        padding-bottom: $admin-space-lg;
    }
}

// ============================================
// PAGE HEADER - Compact Stats
// ============================================
.page-header {
    display: flex;
    flex-direction: column;
    gap: $admin-space-sm;
    margin-bottom: $admin-space-md;
    animation: fadeIn 0.3s ease-out;

    @media (min-width: 768px) {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.header-left {
    display: flex;
    align-items: center;
    gap: $admin-space-sm;
    flex-wrap: wrap;
}

.page-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: $color-text-primary;
    margin: 0;
    display: flex;
    align-items: center;
    gap: $admin-space-xs;

    @media (min-width: 768px) {
        font-size: 1.25rem;
    }
}

.mini-stats {
    display: flex;
    gap: $admin-space-xs;
    flex-wrap: wrap;
}

.mini-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba($color-gray-100, 0.8);
    border-radius: $radius-full;
    font-size: 0.6875rem;
    font-weight: 600;
    color: $color-text-secondary;

    app-icon {
        font-size: 0.75rem;
    }

    strong {
        color: $color-text-primary;
    }

    &--open {
        background: rgba($accent-blue, 0.1);
        color: $accent-blue;
        strong { color: $accent-blue; }
    }

    &--done {
        background: rgba($accent-green, 0.1);
        color: $accent-green;
        strong { color: $accent-green; }
    }
}

// ============================================
// FILTER TABS
// ============================================
.filter-bar {
    display: flex;
    gap: $admin-space-2xs;
    padding: 3px;
    background: rgba($color-gray-100, 0.6);
    border-radius: $radius-md;
    overflow-x: auto;
    scrollbar-width: none;

    &::-webkit-scrollbar {
        display: none;
    }
}

.filter-tab {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: $admin-space-xs $admin-space-sm;
    background: transparent;
    border: none;
    border-radius: $radius-sm;
    font-size: 0.75rem;
    font-weight: 600;
    color: $color-text-secondary;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;

    app-icon {
        font-size: 0.875rem;
    }

    .count {
        padding: 2px 6px;
        background: rgba($color-gray-200, 0.6);
        border-radius: $radius-full;
        font-size: 0.625rem;
        font-weight: 700;
    }

    &:hover {
        color: $color-text-primary;
        background: rgba(white, 0.6);
    }

    &--active {
        background: white;
        color: $color-brand-primary;
        box-shadow: 0 1px 3px rgba(black, 0.08);

        .count {
            background: rgba($color-brand-primary, 0.15);
            color: $color-brand-primary;
        }
    }

    @media (max-width: 480px) {
        app-icon { display: none; }
    }
}

// ============================================
// REQUESTS LIST
// ============================================
.requests-list {
    display: flex;
    flex-direction: column;
    gap: $admin-space-xs;
}

.request-item {
    background: $glass-bg;
    border: 1px solid $glass-border;
    border-radius: $radius-md;
    overflow: hidden;
    transition: all 0.2s ease;
    animation: staggerFade 0.3s ease-out backwards;

    @for $i from 1 through 20 {
        &:nth-child(#{$i}) {
            animation-delay: #{$i * 30}ms;
        }
    }

    &:hover {
        border-color: rgba($color-brand-primary, 0.2);
        box-shadow: $shadow-sm;
    }

    &--expanded {
        border-color: rgba($color-brand-primary, 0.3);
        box-shadow: $shadow-md;
    }
}

.request-item__main {
    display: flex;
    align-items: center;
    gap: $admin-space-sm;
    padding: $admin-space-sm;
    cursor: pointer;

    @media (max-width: 640px) {
        flex-wrap: wrap;
    }
}

// Status Indicator
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;

    &--open {
        background: $accent-yellow;
        box-shadow: 0 0 0 3px rgba($accent-yellow, 0.2);
        animation: pulse 2s ease-in-out infinite;
    }

    &--done {
        background: $accent-green;
    }
}

// Info Content
.info-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.info-primary {
    display: flex;
    align-items: center;
    gap: $admin-space-xs;
    flex-wrap: wrap;
}

.name {
    font-size: 0.875rem;
    font-weight: 600;
    color: $color-text-primary;
}

.service-tag {
    padding: 2px 6px;
    background: rgba($color-brand-primary, 0.1);
    border-radius: $radius-sm;
    font-size: 0.625rem;
    font-weight: 600;
    color: $color-brand-primary;
}

.info-secondary {
    display: flex;
    align-items: center;
    gap: $admin-space-xs;
    font-size: 0.75rem;
    color: $color-text-tertiary;

    .email {
        max-width: 200px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;

        @media (max-width: 640px) {
            max-width: 150px;
        }
    }

    .separator {
        opacity: 0.5;
    }
}

// Quick Actions
.quick-actions {
    display: flex;
    align-items: center;
    gap: $admin-space-2xs;

    @media (max-width: 640px) {
        width: 100%;
        padding-top: $admin-space-xs;
        border-top: 1px solid $border-default;
        justify-content: flex-end;
    }
}

.action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: $radius-sm;
    color: $color-text-tertiary;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;

    app-icon {
        font-size: 1rem;
    }

    &:hover {
        background: $color-gray-100;
        color: $color-text-primary;
    }

    &--mail:hover {
        background: rgba($accent-blue, 0.1);
        color: $accent-blue;
    }

    &--call:hover {
        background: rgba($accent-green, 0.1);
        color: $accent-green;
    }

    &--done:hover {
        background: rgba($accent-green, 0.1);
        color: $accent-green;
    }

    &--reopen:hover {
        background: rgba($accent-yellow, 0.1);
        color: $accent-yellow;
    }

    &--delete:hover {
        background: rgba($accent-red, 0.1);
        color: $accent-red;
    }
}

.expand-toggle {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: $radius-sm;
    color: $color-text-tertiary;
    cursor: pointer;
    transition: all 0.15s ease;

    app-icon {
        font-size: 1rem;
        transition: transform 0.2s ease;
    }

    &--open {
        color: $color-brand-primary;

        app-icon {
            transform: rotate(180deg);
        }
    }
}

// ============================================
// DETAIL PANEL
// ============================================
.request-item__detail {
    padding: $admin-space-sm;
    padding-top: 0;
    border-top: 1px solid $border-default;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.detail-block {
    background: $color-gray-50;
    border-radius: $radius-sm;
    overflow: hidden;
    margin-bottom: $admin-space-xs;

    &:last-child {
        margin-bottom: 0;
    }

    &__header {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: $admin-space-xs $admin-space-sm;
        background: $color-gray-100;
        font-size: 0.6875rem;
        font-weight: 700;
        color: $color-text-tertiary;
        text-transform: uppercase;
        letter-spacing: 0.03em;

        app-icon {
            font-size: 0.875rem;
        }
    }

    &__content {
        padding: $admin-space-sm;
    }
}

.message-text {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: $color-text-primary;
    white-space: pre-wrap;
    word-break: break-word;
}

.detail-grid {
    display: grid;
    gap: $admin-space-xs;

    @media (min-width: 480px) {
        grid-template-columns: repeat(2, 1fr);
    }
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 2px;

    .label {
        font-size: 0.6875rem;
        font-weight: 600;
        color: $color-text-tertiary;
        text-transform: uppercase;
        letter-spacing: 0.02em;
    }

    .value {
        font-size: 0.8125rem;
        color: $color-text-primary;
    }
}

.detail-actions {
    display: flex;
    gap: $admin-space-xs;
    padding-top: $admin-space-sm;
    border-top: 1px solid $border-default;
    margin-top: $admin-space-sm;
    flex-wrap: wrap;

    @media (max-width: 480px) {
        flex-direction: column;

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

// ============================================
// BUTTONS (using admin-shared, extending)
// ============================================
.btn {
    @extend .admin-btn;
}

.btn--primary {
    @extend .admin-btn--primary;
}

.btn--success {
    background: $accent-green;
    color: white;
    box-shadow: 0 2px 8px rgba($accent-green, 0.25);

    &:hover {
        background: darken($accent-green, 6%);
        transform: translateY(-1px);
    }
}

.btn--danger {
    background: rgba($accent-red, 0.1);
    color: $accent-red;

    &:hover {
        background: rgba($accent-red, 0.15);
    }
}

.btn--ghost {
    @extend .admin-btn--ghost;
}

// ============================================
// EMPTY STATE
// ============================================
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: $admin-space-2xl $admin-space-md;
    text-align: center;
    animation: fadeIn 0.4s ease-out;

    app-icon {
        font-size: 2.5rem;
        color: $color-gray-300;
        margin-bottom: $admin-space-sm;
    }

    h3 {
        font-size: 1rem;
        font-weight: 600;
        color: $color-text-secondary;
        margin: 0 0 $admin-space-2xs;
    }

    p {
        font-size: 0.8125rem;
        color: $color-text-tertiary;
        margin: 0;
    }
}

// ============================================
// LOADING STATE
// ============================================
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: $admin-space-sm;
    padding: $admin-space-2xl;
    color: $color-text-secondary;
    font-size: 0.875rem;

    app-icon {
        animation: spin 1s linear infinite;
    }
}

// ============================================
// TOAST NOTIFICATION
// ============================================
.toast {
    position: fixed;
    bottom: 5rem; // Above mobile nav
    left: 50%;
    transform: translateX(-50%);
    padding: $admin-space-sm $admin-space-md;
    background: $color-gray-900;
    color: white;
    border-radius: $radius-md;
    font-size: 0.8125rem;
    font-weight: 500;
    box-shadow: $shadow-lg;
    z-index: 1000;
    animation: popIn 0.3s ease-out;

    @media (min-width: 768px) {
        bottom: $admin-space-lg;
    }
}

// ============================================
// RESPONSIVE TWEAKS
// ============================================
@media (max-width: 640px) {
    .admin-requests {
        padding: $admin-space-sm;
        padding-bottom: calc($admin-space-sm + 80px);
    }

    .page-header {
        gap: $admin-space-xs;
    }

    .page-title {
        font-size: 1rem;
    }
}

// Reduced motion
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
