/* Index Specific Layouts CSS */

/* Base resets & layout switches */
.layout-desktop,
.layout-tablet,
.layout-mobile {
    display: none !important;
}

/* Base utility styles for tool cards */
.tag-badge {
    align-self: flex-start;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}
.tag-media {
    background: rgba(236, 72, 153, 0.15);
    color: #ec4899;
    border: 1px solid rgba(236, 72, 153, 0.3);
}
.tag-pdf {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}
.tag-converter {
    background: rgba(167, 139, 250, 0.15);
    color: #c084fc;
    border: 1px solid rgba(167, 139, 250, 0.3);
}

.pulsing-dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px #10b981;
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* ==========================================================================
   1. DESKTOP LAYOUT (>= 1024px)
   ========================================================================== */
@media (min-width: 1024px) {
    .layout-desktop {
        display: grid !important;
        grid-template-columns: 280px 1fr;
        gap: 2.5rem;
        margin-top: 1rem;
        animation: fadeInUp 0.6s ease-out;
    }

    /* Sidebar styles */
    .pc-sidebar {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        position: sticky;
        top: 90px;
        align-self: start;
    }

    .sidebar-panel {
        background: var(--glass);
        border: 1px solid var(--glass-border);
        border-radius: 16px;
        padding: 1.5rem;
        backdrop-filter: blur(12px);
        box-shadow: var(--shadow);
    }

    .sidebar-title {
        font-size: 0.9rem;
        font-weight: 700;
        text-transform: uppercase;
        color: var(--text-muted);
        letter-spacing: 1px;
        margin-bottom: 1rem;
    }

    .category-menu {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .category-btn {
        background: transparent;
        border: none;
        color: var(--text-muted);
        padding: 0.75rem 1rem;
        border-radius: 10px;
        text-align: left;
        font-size: 0.95rem;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        width: 100%;
    }

    .category-btn:hover {
        background: rgba(255, 255, 255, 0.05);
        color: white;
    }

    .category-btn.active {
        background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(236, 72, 153, 0.15));
        border: 1px solid rgba(99, 102, 241, 0.3);
        color: white;
        font-weight: 600;
    }

    .limit-progress-bar {
        width: 100%;
        height: 6px;
        background: #334155;
        border-radius: 3px;
        overflow: hidden;
        margin: 0.5rem 0;
    }

    .limit-progress-fill {
        height: 100%;
        background: linear-gradient(90deg, var(--primary), var(--secondary));
        border-radius: 3px;
        width: 0%;
        transition: width 0.5s ease;
    }

    /* Main Area styles */
    .pc-main {
        display: flex;
        flex-direction: column;
        gap: 2rem;
    }

    .pc-hero {
        background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.9) 100%);
        border: 1px solid var(--glass-border);
        border-radius: 24px;
        padding: 3rem;
        position: relative;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        gap: 1rem;
        box-shadow: var(--shadow);
    }

    .pc-hero::after {
        content: '';
        position: absolute;
        top: -50%;
        right: -30%;
        width: 400px;
        height: 400px;
        background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, transparent 70%);
        filter: blur(40px);
        z-index: 1;
        pointer-events: none;
    }

    .pc-hero-content {
        position: relative;
        z-index: 2;
    }

    .pc-hero-title {
        font-size: 2.5rem;
        font-weight: 800;
        line-height: 1.2;
        background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        margin-bottom: 0.5rem;
    }

    .pc-hero-subtitle {
        color: var(--text-muted);
        font-size: 1.1rem;
        margin-bottom: 1.5rem;
    }

    .search-wrapper {
        position: relative;
        max-width: 600px;
        width: 100%;
    }

    .search-input-icon {
        position: absolute;
        left: 1.2rem;
        top: 50%;
        transform: translateY(-50%);
        color: var(--text-muted);
        pointer-events: none;
        font-size: 1.2rem;
    }

    .search-input-field {
        width: 100%;
        padding: 1rem 1.5rem 1rem 3.2rem !important;
        font-size: 1.05rem;
        border-radius: 14px !important;
        background: rgba(9, 9, 11, 0.6) !important;
        border: 1px solid var(--border) !important;
        box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
        transition: all 0.3s ease;
    }

    .search-input-field:focus {
        border-color: var(--primary) !important;
        box-shadow: 0 0 15px rgba(99, 102, 241, 0.3), inset 0 2px 4px rgba(0,0,0,0.2) !important;
    }

    .search-shortcut {
        position: absolute;
        right: 1.2rem;
        top: 50%;
        transform: translateY(-50%);
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.15);
        color: var(--text-muted);
        padding: 2px 6px;
        border-radius: 5px;
        font-size: 0.75rem;
        font-family: monospace;
        pointer-events: none;
    }

    /* Grid layout */
    .pc-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
        gap: 1.5rem;
    }

    .pc-card {
        background: var(--glass);
        border: 1px solid var(--glass-border);
        border-radius: 16px;
        padding: 1.75rem;
        text-decoration: none;
        color: var(--text-main);
        transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        position: relative;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        min-height: 180px;
    }

    .pc-card:hover {
        transform: translateY(-5px);
        box-shadow: var(--shadow), var(--glow);
    }

    .pc-card.category-media:hover {
        border-color: var(--secondary);
        box-shadow: var(--shadow), 0 0 20px rgba(236, 72, 153, 0.4);
    }

    .pc-card.category-pdf:hover {
        border-color: var(--primary);
        box-shadow: var(--shadow), 0 0 20px rgba(99, 102, 241, 0.4);
    }

    .pc-card.category-converter:hover {
        border-color: #a78bfa;
        box-shadow: var(--shadow), 0 0 20px rgba(167, 139, 250, 0.4);
    }

    .pc-card-top {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .pc-card h3 {
        font-size: 1.25rem;
        font-weight: 600;
        color: white;
        margin-bottom: 0.25rem;
    }

    .pc-card p {
        color: var(--text-muted);
        font-size: 0.9rem;
        line-height: 1.4;
    }

    .pc-card-footer {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        margin-top: 1rem;
    }

    .pc-card-arrow {
        color: var(--text-muted);
        transition: transform 0.3s ease, color 0.3s ease;
    }

    .pc-card:hover .pc-card-arrow {
        transform: translateX(5px);
        color: white;
    }
}

/* ==========================================================================
   2. TABLET LAYOUT (768px <= width < 1024px)
   ========================================================================== */
@media (min-width: 768px) and (max-width: 1023px) {
    .layout-tablet {
        display: grid !important;
        grid-template-columns: 220px 1fr;
        gap: 2rem;
        margin-top: 1rem;
        animation: fadeInUp 0.6s ease-out;
    }

    .tablet-sidebar {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    .tablet-panel {
        background: var(--glass);
        border: 1px solid var(--glass-border);
        border-radius: 16px;
        padding: 1.25rem;
        backdrop-filter: blur(10px);
    }

    .tablet-category-menu {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .tablet-category-btn {
        background: transparent;
        border: none;
        color: var(--text-muted);
        padding: 0.7rem 0.9rem;
        border-radius: 8px;
        text-align: left;
        font-size: 0.9rem;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.25s ease;
        width: 100%;
    }

    .tablet-category-btn:hover {
        background: rgba(255, 255, 255, 0.04);
        color: white;
    }

    .tablet-category-btn.active {
        background: rgba(99, 102, 241, 0.15);
        border: 1px solid rgba(99, 102, 241, 0.3);
        color: white;
        font-weight: 600;
    }

    .tablet-main {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    .tablet-header {
        background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.9) 100%);
        border: 1px solid var(--glass-border);
        border-radius: 18px;
        padding: 2rem;
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .tablet-title {
        font-size: 1.8rem;
        font-weight: 700;
        color: white;
    }

    .tablet-search-wrapper {
        position: relative;
        width: 100%;
    }

    .tablet-search-input {
        width: 100%;
        padding: 0.8rem 1rem 0.8rem 2.8rem !important;
        border-radius: 10px !important;
        background: rgba(9, 9, 11, 0.6) !important;
        border: 1px solid var(--border) !important;
        color: white !important;
    }

    .tablet-search-icon {
        position: absolute;
        left: 1rem;
        top: 50%;
        transform: translateY(-50%);
        color: var(--text-muted);
        pointer-events: none;
    }

    .tablet-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1.25rem;
    }

    .tablet-card {
        background: var(--glass);
        border: 1px solid var(--glass-border);
        border-radius: 14px;
        padding: 1.5rem;
        text-decoration: none;
        color: var(--text-main);
        transition: transform 0.2s ease, border-color 0.2s ease;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        min-height: 150px;
    }

    .tablet-card:hover {
        transform: translateY(-3px);
        border-color: var(--primary);
    }

    .tablet-card h3 {
        font-size: 1.15rem;
        color: white;
        margin-bottom: 0.25rem;
    }

    .tablet-card p {
        color: var(--text-muted);
        font-size: 0.85rem;
    }
}

/* ==========================================================================
   3. MOBILE LAYOUT (< 768px)
   ========================================================================== */
@media (max-width: 767px) {
    .layout-mobile {
        display: flex !important;
        flex-direction: column;
        gap: 1.25rem;
        animation: fadeInUp 0.5s ease-out;
        padding-bottom: 3rem;
    }

    /* Mobile Search */
    .mobile-search-bar {
        position: relative;
        width: 100%;
        margin-top: 0.5rem;
    }

    .mobile-search-input {
        width: 100% !important;
        padding: 0.75rem 1rem 0.75rem 2.5rem !important;
        border-radius: 10px !important;
        background: rgba(30, 41, 59, 0.7) !important;
        border: 1px solid var(--border) !important;
        font-size: 0.95rem !important;
        color: white !important;
    }

    .mobile-search-icon {
        position: absolute;
        left: 0.9rem;
        top: 50%;
        transform: translateY(-50%);
        color: var(--text-muted);
        font-size: 1rem;
        pointer-events: none;
    }

    /* Mobile horizontal scroll selector */
    .mobile-pills-scroll {
        display: flex;
        overflow-x: auto;
        gap: 0.6rem;
        padding: 0.2rem 0;
        scrollbar-width: none; /* Firefox */
    }

    .mobile-pills-scroll::-webkit-scrollbar {
        display: none; /* Safari & Chrome */
    }

    .mobile-pill {
        flex: 0 0 auto;
        background: rgba(30, 41, 59, 0.6);
        border: 1px solid var(--border);
        color: var(--text-muted);
        padding: 0.5rem 1.1rem;
        border-radius: 20px;
        font-size: 0.85rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .mobile-pill.active {
        background: linear-gradient(135deg, var(--primary), var(--secondary));
        color: white;
        border-color: transparent;
        box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
    }

    /* Swipeable Carousel */
    .mobile-carousel {
        position: relative;
        width: 100%;
        overflow: hidden;
        border-radius: 14px;
        background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(236, 72, 153, 0.15) 100%);
        border: 1px solid rgba(255, 255, 255, 0.08);
        padding: 1.25rem;
        min-height: 120px;
        box-shadow: var(--shadow);
    }

    .carousel-slide {
        display: none;
        animation: fadeEffect 0.5s ease-in-out;
        flex-direction: column;
        gap: 0.3rem;
    }

    .carousel-slide.active {
        display: flex;
    }

    .carousel-tag {
        align-self: flex-start;
        background: rgba(167, 139, 250, 0.2);
        color: #c084fc;
        font-size: 0.65rem;
        font-weight: 700;
        padding: 2px 6px;
        border-radius: 4px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .carousel-title {
        font-size: 1.1rem;
        font-weight: 700;
        color: white;
    }

    .carousel-desc {
        font-size: 0.8rem;
        color: var(--text-muted);
        line-height: 1.3;
    }

    .carousel-dots {
        display: flex;
        justify-content: center;
        gap: 5px;
        margin-top: 0.8rem;
    }

    .carousel-dot {
        width: 6px;
        height: 6px;
        background-color: rgba(255, 255, 255, 0.3);
        border-radius: 50%;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .carousel-dot.active {
        width: 18px;
        background-color: var(--primary);
        border-radius: 3px;
    }

    /* Mobile Single Column cards */
    .mobile-list {
        display: flex;
        flex-direction: column;
        gap: 0.8rem;
    }

    .mobile-card {
        background: var(--glass);
        border: 1px solid var(--glass-border);
        border-radius: 12px;
        padding: 1rem 1.25rem;
        text-decoration: none;
        color: var(--text-main);
        display: flex;
        align-items: center;
        justify-content: space-between;
        transition: background-color 0.2s ease, transform 0.1s ease;
        gap: 1rem;
    }

    .mobile-card:active {
        transform: scale(0.97);
        background-color: rgba(255, 255, 255, 0.05);
    }

    .mobile-card-content {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        flex: 1;
    }

    .mobile-card-title-row {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .mobile-card h3 {
        font-size: 1.05rem;
        font-weight: 600;
        color: white;
        margin-bottom: 0;
    }

    .mobile-card p {
        color: var(--text-muted);
        font-size: 0.8rem;
        line-height: 1.3;
    }

    .mobile-card-icon {
        color: var(--text-muted);
        font-size: 1.1rem;
    }
}

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

@keyframes fadeEffect {
    from { opacity: 0; }
    to { opacity: 1; }
}
