/* =========================================
   1. CORE FIXES (For Fluidity)
   ========================================= */
:root {
    --container-padding: 1rem;
}

/* Fix grid to prevent overflow on small screens */
.services-grid { 
    display: grid; 
    /* Changed 380px to 300px for better initial tablet support */
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); 
    gap: 30px; 
    padding: 0 var(--container-padding); 
}

/* Ensure images don't overflow */
img {
    max-width: 100%;
    height: auto;
}

/* ... Your Existing CSS (Keep it here) ... */
main { padding-top: 0; }
.hero-section { position: relative; height: 60vh; min-height: 400px; overflow: hidden; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--color-text-light); }
.slider-wrapper { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.slider-image { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.5s ease-in-out; filter: brightness(50%); }
.slider-image.active { opacity: 1; }
.hero-content { position: relative; z-index: 10; padding: 30px; background: var(--color-navbar-bg-transparent); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); border-radius: 10px; width: 90%; max-width: 800px; }
.hero-content h1 { font-size: 3rem; margin-bottom: 15px; color: var(--color-accent-blue); line-height: 1.2; }
.hero-content p { font-size: 1.25rem; max-width: 600px; margin: 0 auto; color: var(--color-text-light); }

.services-grid-section { padding: 60px 0; background-color: var(--color-section-bg-light); }

.service-card { background-color: var(--color-card-bg); border-radius: 12px; overflow: hidden; box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3); transition: transform var(--transition-speed), box-shadow var(--transition-speed); display: flex; flex-direction: column; position: relative; border: 2px solid transparent; }
.service-card:hover { transform: translateY(-8px); box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5), 0 0 18px rgba(40, 137, 216, 0.6); border-color: var(--color-accent-blue); }

.card-image-background { height: 220px; background-size: cover; background-position: center; position: relative; color: var(--color-text-light); display: flex; align-items: flex-end; padding: 20px; }
.card-image-background::after { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.9) 100%); }
.card-category { position: absolute; top: 20px; left: 20px; background-color: var(--color-accent-blue); color: white; padding: 6px 12px; border-radius: 4px; font-size: 0.85rem; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; z-index: 1; }

.card-content { padding: 20px 25px; flex-grow: 1; display: flex; flex-direction: column; }
.card-icon-title-group { display: flex; align-items: center; gap: 15px; margin-bottom: 15px; }
.card-icon { font-size: 2rem; color: var(--color-accent-blue); min-width: 2rem; }
.card-title { font-size: 1.75rem; color: var(--color-text-light); margin: 0; font-weight: 700; line-height: 1.3; }
.card-tags { margin-bottom: 15px; }
.tag { display: inline-block; background-color: transparent; color: var(--color-accent-blue); border: 1px solid var(--color-accent-hover); font-size: 0.7rem; padding: 2px 7px; border-radius: 10px; margin-right: 5px; margin-bottom: 5px; font-weight: 600; text-transform: uppercase; }
.card-separator { height: 1px; background-color: rgba(255, 255, 255, 0.15); margin: 15px 0; }
.card-short-description { font-size: 1rem; color: var(--color-text-muted); margin-bottom: 20px; flex-grow: 1; line-height: 1.6; }
.detail-button { display: block; background-color: var(--color-accent-blue); color: white; padding: 12px 20px; border-radius: 6px; text-align: center; font-weight: 600; transition: background-color var(--transition-speed), box-shadow var(--transition-speed); margin-top: auto; text-transform: uppercase; letter-spacing: 0.5px; text-decoration: none;}
.detail-button:hover { background-color: var(--color-accent-hover); box-shadow: 0 5px 15px rgba(40, 137, 216, 0.4); }

/* Admin Toolbar Styles */
.admin-toolbar-container { background-color: var(--color-card-bg); border-bottom: 1px solid rgba(255, 255, 255, 0.1); padding: 10px 0; }
.admin-toolbar { display: flex; align-items: center; gap: 15px; justify-content: flex-end; flex-wrap: wrap; padding: 0 var(--container-padding); }
.toolbar-label { color: var(--color-text-muted); font-weight: 600; font-size: 0.9rem; text-transform: uppercase; }
.admin-btn { padding: 8px 16px; border-radius: 4px; font-size: 0.9rem; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; transition: all 0.2s; white-space: nowrap;}
.btn-add { background-color: #10b981; color: white; }
.btn-add-secondary { background-color: var(--color-section-bg-dark); border: 1px solid rgba(255,255,255,0.2); color: var(--color-text-light); }
.card-admin-actions { position: absolute; top: 15px; right: 15px; z-index: 20; display: flex; gap: 8px; opacity: 0.8; transition: opacity 0.2s; }
.service-card:hover .card-admin-actions { opacity: 1; }
.icon-btn { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background-color: white; box-shadow: 0 2px 5px rgba(0,0,0,0.3); color: #333; transition: all 0.2s; text-decoration: none; }
.btn-edit { color: #f59e0b; }
.btn-delete { color: #ef4444; }


/* =========================================
   2. MEDIA QUERIES (Responsive Logic)
   ========================================= */

/* --- Tablet (Max 786px) --- */
@media screen and (max-width: 786px) {
    .hero-content h1 { font-size: 2.5rem; }
    .hero-content p { font-size: 1.1rem; }
    
    .services-grid {
        /* Switch to 2 columns max */
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .card-title { font-size: 1.5rem; }
    .card-image-background { height: 200px; }
}

/* --- Large Mobile / Small Tablet (Max 650px) --- */
@media screen and (max-width: 650px) {
    .hero-section { height: 50vh; min-height: 350px; }
    
    .services-grid {
        /* Force single column for readability */
        grid-template-columns: 1fr; 
        padding: 0 2rem; /* Add side padding for aesthetic */
    }
    
    .admin-toolbar {
        justify-content: space-between;
    }
    
    .card-admin-actions { opacity: 1; /* Always visible on touch screens */ }
}

/* --- Standard Mobile (Max 540px) --- */
@media screen and (max-width: 540px) {
    .hero-content { width: 95%; padding: 20px; }
    .hero-content h1 { font-size: 2rem; }
    
    .services-grid { padding: 0 1rem; }
    
    /* Stack the admin toolbar buttons */
    .admin-toolbar {
        justify-content: center;
        gap: 10px;
    }
    .admin-btn {
        flex-grow: 1;
        justify-content: center;
    }
    
    .card-content { padding: 15px; }
    .card-icon { font-size: 1.75rem; }
    .card-title { font-size: 1.35rem; }
}

/* --- Small Mobile (Max 430px) --- */
@media screen and (max-width: 430px) {
    .hero-section { height: auto; padding: 40px 0; }
    .hero-content h1 { font-size: 1.75rem; margin-bottom: 10px; }
    .hero-content p { font-size: 1rem; }
    
    .card-image-background { height: 180px; }
    .card-category { top: 15px; left: 15px; font-size: 0.75rem; }
    
    /* Make buttons easier to tap */
    .detail-button { padding: 14px 20px; font-size: 1rem; }
    
    .card-admin-actions { top: 10px; right: 10px; }
    .icon-btn { width: 36px; height: 36px; /* Larger tap target */ }
}

/* --- Tiny Mobile (Max 320px) --- */
@media screen and (max-width: 320px) {
    :root { --container-padding: 0.5rem; }
    
    .hero-content h1 { font-size: 1.5rem; }
    .hero-content { padding: 15px; backdrop-filter: blur(8px); } /* Stronger blur for readability */
    
    .services-grid-section { padding: 30px 0; }
    .services-grid { gap: 15px; }
    
    .card-icon-title-group { flex-direction: column; align-items: flex-start; gap: 5px; }
    .card-title { font-size: 1.25rem; }
    .card-tags { display: flex; flex-wrap: wrap; }
    
    /* Simplify Admin Toolbar */
    .admin-toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-label { text-align: center; margin-bottom: 5px; }
}

/* --- Micro Mobile / Watch (Max 220px) --- */
@media screen and (max-width: 220px) {
    .hero-content h1 { font-size: 1.2rem; }
    .hero-content p { display: none; /* Hide description to save space */ }
    
    .card-image-background { height: 120px; }
    .card-category { font-size: 0.6rem; padding: 4px 8px; top: 10px; left: 10px; }
    
    .card-content { padding: 10px; }
    .card-icon { display: none; /* Remove icon to save horizontal space */ }
    .card-title { font-size: 1.1rem; }
    
    .tag { font-size: 0.6rem; margin-bottom: 2px; }
    .card-short-description { font-size: 0.85rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
    
    .detail-button { padding: 10px; font-size: 0.8rem; }
    
    /* Admin Actions - move to bottom or simplify */
    .card-admin-actions { top: auto; bottom: 10px; right: 10px; flex-direction: column; }
    .icon-btn { width: 28px; height: 28px; font-size: 0.8rem; }
}