/* ===========================================
   CATEGORIES GRID LAYOUT STYLES
   Modern Grid Design for Categories
   =========================================== */

/* Reset and Base Styles - Only for categories section */
.categories-section * {
    box-sizing: border-box;
}

/* Main Container - Only for standalone categories page */
.product-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px 0;
}

/* Categories Section for Home Page */
.categories-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 40px 0;
    margin-bottom: 30px;
    border-radius: 0 0 30px 30px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    /* padding: 0 20px; */
}

/* Header Section */
.categories-header {
    text-align: center;
    margin-bottom: 50px;
    padding: 40px 0;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.categories-title {
    font-size: 3rem;
    font-weight: 800;
    color: #0F3557;
    margin-bottom: 15px;
    position: relative;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.categories-subtitle {
    font-size: 1.2rem;
    color: #6c757d;
    margin-bottom: 30px;
    font-weight: 400;
}

.categories-title::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 5px;
    /* background: linear-gradient(90deg, #3BAFDA 0%, #C6D300 100%); */
    border-radius: 3px;
    box-shadow: 0 2px 10px rgba(59, 175, 218, 0.3);
}

/* Grid Layout */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 40px;
    padding: 0 10px;
}

/* Category Cards */
.category-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 12px 8px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #3BAFDA 0%, #C6D300 100%);
    border-radius: 20px 20px 0 0;
}

.category-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(59, 175, 218, 0.05) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.category-card:hover::after {
    opacity: 1;
}

.category-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border-color: #3BAFDA;
}

/* Category Icon */
.category-icon {
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 35px;
    position: relative;
}

.category-icon::before {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, rgba(59, 175, 218, 0.1) 0%, rgba(198, 211, 0, 0.1) 100%);
    border-radius: 50%;
    z-index: 0;
}

.category-icon img {
    width: 20px;
    height: 20px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.category-card:hover .category-icon img {
    transform: scale(1.1) rotate(3deg);
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.2));
}

/* Category Name */
.category-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #0F3557;
    margin-bottom: 10px;
    line-height: 1.2;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.05);
}

/* Category Links Container */
.category-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Individual Links */
.category-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
}

.category-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.6s ease;
}

.category-link:hover::before {
    left: 100%;
}

/* Workers Link Styles */
.workers-link {
    background: linear-gradient(135deg, #3BAFDA 0%, #2a9fd1 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(59, 175, 218, 0.3);
}

.workers-link:hover {
    background: linear-gradient(135deg, #2a9fd1 0%, #1e7bb8 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(59, 175, 218, 0.4);
    border-color: #1e7bb8;
}

/* Shops Link Styles */
.shops-link {
    background: linear-gradient(135deg, #C6D300 0%, #a8b800 100%);
    color: #0F3557;
    box-shadow: 0 6px 20px rgba(198, 211, 0, 0.3);
}

.shops-link:hover {
    background: linear-gradient(135deg, #a8b800 0%, #8f9a00 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(198, 211, 0, 0.4);
    border-color: #8f9a00;
}

/* Link Elements */
.link-icon {
    font-size: 1.3rem;
    transition: transform 0.3s ease;
}

.category-link:hover .link-icon {
    transform: scale(1.1);
}

.link-text {
    font-weight: 700;
    letter-spacing: 0.5px;
}

.link-count {
    background: rgba(255, 255, 255, 0.25);
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: 700;
    min-width: 30px;
    text-align: center;
    transition: all 0.3s ease;
}

.shops-link .link-count {
    background: rgba(15, 53, 87, 0.15);
    color: #0F3557;
}

.category-link:hover .link-count {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.35);
}

.shops-link:hover .link-count {
    background: rgba(15, 53, 87, 0.25);
}

/* Special Notification Card */
.notification-card {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
    border: none;
}

.notification-card::before {
    background: linear-gradient(90deg, #ff6b6b 0%, #ee5a52 100%);
}

.notification-card .category-name {
    color: white;
}

.notification-card .category-link {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.notification-card .category-link:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* ===========================================
   COMPREHENSIVE RESPONSIVE MEDIA QUERIES
   =========================================== */

/* Extra Large Screens (1400px and up) */
@media (min-width: 1400px) {
    .categories-section .container {
        max-width: 1600px;
        padding: 0 40px;
    }
    
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    
    .category-card {
        padding: 15px 10px;
    }
    
    .categories-title {
        font-size: 2.5rem;
    }
    
    .categories-subtitle {
        font-size: 1.2rem;
    }
}

/* Large Screens (1200px to 1399px) */
@media (max-width: 1399px) and (min-width: 1200px) {
    .categories-section .container {
        max-width: 1200px;
        padding: 0 30px;
    }
    
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
    }
    
    .category-card {
        padding: 14px 9px;
    }
}

/* Medium-Large Screens (992px to 1199px) */
@media (max-width: 1199px) and (min-width: 992px) {
    .categories-section .container {
        max-width: 960px;
        padding: 0 25px;
    }
    
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
    
    .category-card {
        padding: 13px 8px;
    }
    
    .categories-title {
        font-size: 2.2rem;
    }
    
    .categories-subtitle {
        font-size: 1.1rem;
    }
}

/* Medium Screens (768px to 991px) */
@media (max-width: 991px) and (min-width: 768px) {
    .categories-section .container {
        max-width: 720px;
        padding: 0 20px;
    }
    
    .categories-header {
        padding: 30px 20px;
        margin-bottom: 30px;
    }
    
    .categories-title {
        font-size: 2rem;
        margin-bottom: 10px;
    }
    
    .categories-subtitle {
        font-size: 1rem;
        margin-bottom: 20px;
    }
    
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
        margin-top: 30px;
    }
    
    .category-card {
        padding: 12px 8px;
    }
    
    .category-name {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }
    
    .category-link {
        padding: 7px 10px;
        font-size: 0.75rem;
    }
    
    .category-icon {
        height: 30px;
        margin-bottom: 8px;
    }
    
    .category-icon img {
        width: 18px;
        height: 18px;
    }
}

/* Small-Medium Screens (576px to 767px) */
@media (max-width: 767px) and (min-width: 576px) {
    .categories-section .container {
        max-width: 540px;
        padding: 0 15px;
    }
    
    .categories-header {
        padding: 25px 15px;
        margin-bottom: 25px;
    }
    
    .categories-title {
        font-size: 1.8rem;
        margin-bottom: 8px;
    }
    
    .categories-subtitle {
        font-size: 0.9rem;
        margin-bottom: 15px;
    }
    
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
        margin-top: 25px;
    }
    
    .category-card {
        padding: 10px 6px;
    }
    
    .category-name {
        font-size: 0.8rem;
        margin-bottom: 6px;
    }
    
    .category-link {
        padding: 6px 8px;
        font-size: 0.7rem;
    }
    
    .category-icon {
        height: 28px;
        margin-bottom: 6px;
    }
    
    .category-icon img {
        width: 16px;
        height: 16px;
    }
}

/* Small Screens (480px to 575px) */
@media (max-width: 575px) and (min-width: 480px) {
    .categories-section .container {
        max-width: 100%;
        padding: 0 12px;
    }
    
    .categories-header {
        padding: 20px 12px;
        margin-bottom: 20px;
    }
    
    .categories-title {
        font-size: 1.6rem;
        margin-bottom: 6px;
    }
    
    .categories-subtitle {
        font-size: 0.85rem;
        margin-bottom: 12px;
    }
    
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        margin-top: 20px;
    }
    
    .category-card {
        padding: 8px 5px;
    }
    
    .category-name {
        font-size: 0.75rem;
        margin-bottom: 5px;
    }
    
    .category-link {
        padding: 5px 6px;
        font-size: 0.65rem;
    }
    
    .category-icon {
        height: 25px;
        margin-bottom: 5px;
    }
    
    .category-icon img {
        width: 14px;
        height: 14px;
    }
}

/* Extra Small Screens (320px to 479px) */
@media (max-width: 479px) and (min-width: 320px) {
    .categories-section .container {
        max-width: 100%;
        padding: 0 8px;
    }
    
    .categories-header {
        padding: 15px 8px;
        margin-bottom: 15px;
    }
    
    .categories-title {
        font-size: 1.4rem;
        margin-bottom: 4px;
    }
    
    .categories-subtitle {
        font-size: 0.8rem;
        margin-bottom: 10px;
    }
    
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        margin-top: 15px;
    }
    
    .category-card {
        padding: 6px 4px;
    }
    
    .category-name {
        font-size: 0.7rem;
        margin-bottom: 4px;
    }
    
    .category-link {
        padding: 4px 5px;
        font-size: 0.6rem;
    }
    
    .category-icon {
        height: 22px;
        margin-bottom: 4px;
    }
    
    .category-icon img {
        width: 12px;
        height: 12px;
    }
    
    .category-links {
        gap: 6px;
    }
}

/* Very Small Screens (below 320px) */
@media (max-width: 319px) {
    .categories-section .container {
        padding: 0 6px;
    }
    
    .categories-header {
        padding: 12px 6px;
        margin-bottom: 12px;
    }
    
    .categories-title {
        font-size: 1.2rem;
        margin-bottom: 3px;
    }
    
    .categories-subtitle {
        font-size: 0.75rem;
        margin-bottom: 8px;
    }
    
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        margin-top: 12px;
    }
    
    .category-card {
        padding: 5px 3px;
    }
    
    .category-name {
        font-size: 0.65rem;
        margin-bottom: 3px;
    }
    
    .category-link {
        padding: 3px 4px;
        font-size: 0.55rem;
    }
    
    .category-icon {
        height: 20px;
        margin-bottom: 3px;
    }
    
    .category-icon img {
        width: 10px;
        height: 10px;
    }
    
    .category-links {
        gap: 4px;
    }
}

/* Landscape Orientation Adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .categories-header {
        padding: 15px 20px;
        margin-bottom: 20px;
    }
    
    .categories-title {
        font-size: 1.8rem;
        margin-bottom: 5px;
    }
    
    .categories-subtitle {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }
    
    .categories-grid {
        gap: 15px;
        margin-top: 20px;
    }
    
    .category-card {
        padding: 15px 12px;
    }
    
    .category-name {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }
    
    .category-icon {
        height: 30px;
        margin-bottom: 10px;
    }
    
    .category-icon img {
        width: 18px;
        height: 18px;
    }
}

/* High DPI / Retina Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .category-icon img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Print Styles */
@media print {
    .product-container {
        background: white !important;
        padding: 0 !important;
    }
    
    .categories-header {
        background: white !important;
        box-shadow: none !important;
        border-bottom: 2px solid #333;
    }
    
    .categories-title {
        color: #000 !important;
        font-size: 2rem !important;
    }
    
    .categories-subtitle {
        color: #666 !important;
    }
    
    .categories-grid {
        display: block !important;
        margin-top: 20px !important;
    }
    
    .category-card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        margin-bottom: 15px !important;
        page-break-inside: avoid;
    }
    
    .category-link {
        background: #f8f9fa !important;
        color: #333 !important;
        border: 1px solid #ddd !important;
    }
    
    .category-card:hover {
        transform: none !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .product-container {
        background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    }
    
    .categories-header {
        background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    }
    
    .categories-title {
        color: #ffffff;
    }
    
    .categories-subtitle {
        color: #b0b0b0;
    }
    
    .category-card {
        background: #2d2d2d;
        border-color: #404040;
        color: #ffffff;
    }
    
    .category-name {
        color: #ffffff;
    }
    
    .workers-link {
        background: linear-gradient(135deg, #4a9eff 0%, #357abd 100%);
    }
    
    .shops-link {
        background: linear-gradient(135deg, #e6ff4a 0%, #d4e600 100%);
        color: #1a1a1a;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .category-card {
        animation: none !important;
        transition: none !important;
    }
    
    .category-link {
        transition: none !important;
    }
    
    .category-icon img {
        transition: none !important;
    }
    
    .category-card:hover {
        transform: none !important;
    }
    
    .category-link:hover {
        transform: none !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .category-card {
        border: 2px solid #000;
    }
    
    .category-link {
        border: 2px solid #000;
    }
    
    .workers-link {
        background: #0000ff;
        color: #ffffff;
    }
    
    .shops-link {
        background: #ffff00;
        color: #000000;
    }
}

/* ===========================================
   HOME PAGE INTEGRATION STYLES
   =========================================== */

/* Categories Section Responsive Adjustments for Home Page */
@media (max-width: 1200px) {
    .categories-section {
        padding: 35px 0;
        margin-bottom: 25px;
    }
}

@media (max-width: 768px) {
    .categories-section {
        padding: 30px 0;
        margin-bottom: 20px;
        border-radius: 0 0 20px 20px;
    }
}

@media (max-width: 480px) {
    .categories-section {
        padding: 25px 0;
        margin-bottom: 15px;
        border-radius: 0 0 15px 15px;
    }
}

/* Smooth transition between sections */
.categories-section + .grid-container {
    margin-top: 0;
    padding-top: 20px;
}

/* Ensure proper spacing between categories and media content */
.categories-section {
    position: relative;
    z-index: 1;
}

.categories-section::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    right: 0;
    height: 10px;
    background: linear-gradient(to bottom, rgba(248, 249, 250, 0.8), transparent);
}

/* Loading Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.category-card {
    animation: fadeInUp 0.8s ease forwards;
    opacity: 0;
}

.category-card:nth-child(1) { animation-delay: 0.1s; }
.category-card:nth-child(2) { animation-delay: 0.2s; }
.category-card:nth-child(3) { animation-delay: 0.3s; }
.category-card:nth-child(4) { animation-delay: 0.4s; }
.category-card:nth-child(5) { animation-delay: 0.5s; }
.category-card:nth-child(6) { animation-delay: 0.6s; }
.category-card:nth-child(7) { animation-delay: 0.7s; }
.category-card:nth-child(8) { animation-delay: 0.8s; }
.category-card:nth-child(9) { animation-delay: 0.9s; }
.category-card:nth-child(10) { animation-delay: 1.0s; }
.category-card:nth-child(11) { animation-delay: 1.1s; }
.category-card:nth-child(12) { animation-delay: 1.2s; }

/* Hover Effects for Icons */
.category-card:hover .category-icon::before {
    animation: pulse 2s infinite;
}

/* Focus States for Accessibility */
.category-link:focus {
    outline: 3px solid #3BAFDA;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .category-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .category-link {
        background: #f8f9fa !important;
        color: #333 !important;
    }
}
