/* /portal/css/services.css */

/* --- Layout Overrides --- */

/* Force the main content grid to be single column for Services */
.content-grid.single-column {
    display: block !important;
    /* Override the CSS Grid from portal.css */
    grid-template-columns: none !important;
    max-width: 100%;
    /* Full width as requested */
    margin: 0;
    width: 100%;
}

/* ... existing code ... */

.btn-back i {
    transition: transform 0.2s;
}

[dir="rtl"] .btn-back i {
    transform: scaleX(-1);
}

.btn-back:hover {
    background-color: #f8fafc;
    transform: translateX(-2px);
}

[dir="rtl"] .btn-back:hover {
    transform: translateX(2px);
}

/* Ensure the scrollable area has breathing room */
.services-view {
    padding-bottom: 40px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Category Headers --- */
.service-category {
    margin-bottom: 30px;
}

.category-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-title i {
    color: var(--primary-accent);
}

/* --- Services Grid --- */
.services-grid {
    display: grid;
    /* Responsive Grid: Fit as many as possible, minimum 150px wide */
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.service-card {
    background: var(--card-background);
    border-radius: 16px;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center; /* Base alignment */
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    border: 1px solid var(--border-light);
    cursor: pointer;
    height: 100%;
    /* Fill grid cell */
    position: relative;
    overflow: hidden;
}

/* Hover Effect */
.service-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-glow);
    border-color: rgba(24, 119, 242, 0.3);
    /* Subtle primary tint */
}

.service-card:active {
    transform: scale(0.98);
}

/* Icon Styling */
.icon-circle {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    /* Squircle */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 12px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.service-card:hover .icon-circle {
    transform: scale(1.1);
}

.service-info {
    text-align: center;
    width: 100%;
}

.service-info h3 {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center; /* Explicitly override global styles */
}

.service-info p {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.3;
    text-align: center; /* Explicitly override global styles */
}

/* --- Color Variables (Refactored for Gradients) --- */
.event-color {
    background: var(--gradient-event);
    color: white;
}

.market-color {
    background: var(--gradient-market);
    color: white;
}

.wallet-color {
    background: var(--gradient-wallet);
    color: white;
}

.community-color {
    background: var(--gradient-community);
    color: white;
}

.info-color {
    background: linear-gradient(135deg, #94a3b8, #cbd5e1);
    color: white;
}

.dining-color {
    background: var(--gradient-dining);
    color: white;
}

.maint-color {
    background: var(--gradient-maint);
    color: white;
}

.transport-color {
    background: var(--gradient-transport);
    color: white;
}

.cleaning-color {
    background: var(--gradient-cleaning);
    color: white;
}


/* --- Sub Views (Directory/Resources) --- */
.services-sub-view {
    display: none;
    padding-bottom: 40px;
    animation: slideIn 0.2s ease-out;
}

.services-sub-view.active-view {
    display: block;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.sub-view-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    background: var(--portal-background);
    z-index: 10;
    padding-top: 10px;
    padding-bottom: 10px;
}

.sub-view-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}

.btn-back {
    background: white;
    border: 1px solid var(--border-light);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 20px;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-back:hover {
    background-color: #f8fafc;
    transform: translateX(-2px);
}

/* List Items (Reused) */
.list-item-card {
    background: white;
    border-radius: 16px;
    box-shadow: var(--box-shadow);
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.list-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.2s;
}

.list-item:hover {
    background: #f8fafc;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
}

.list-item-details {
    flex-grow: 1;
}

.list-item-details h4 {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 600;
}

.list-item-details p {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.list-item-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
}

.list-item-icon.pdf {
    background-color: #e74c3c;
}

.list-item-icon.link {
    background-color: #3498db;
}

@media (min-width: 992px) {

    /* On desktop, keep grid reasonable */
    .services-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}