/* ========== HEADER & NAVIGATION ========== */
.navbar {
    background: linear-gradient(135deg, #0f2027 0%, #203a43 100%);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    padding: 1rem 0;
}
.navbar-brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff !important;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}
.navbar-nav .nav-link {
    color: rgba(255,255,255,0.85) !important;
    font-weight: 500;
    margin: 0 0.5rem;
    transition: all 0.3s;
    font-size: clamp(0.85rem,2vw,1rem);
}
.navbar-nav .nav-link.active {
    color: #dc3545 !important;
    border-bottom: 3px solid #dc3545;
}
.navbar-nav .nav-link:hover {
    color: #dc3545 !important;
}

/* Dropdown Menu Styling */
.dropdown-menu {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border: 2px solid #dc3545;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
    padding: 1rem;
    width: auto;
    min-width: 280px;
    max-width: 95vw;
    left: auto !important;
    right: 0 !important;
    transform: none !important;
    max-height: 80vh;
    overflow-y: auto;
    overflow-x: hidden;
    margin-top: 0.5rem !important;
    top: 100% !important;
    -webkit-overflow-scrolling: touch;
    position: absolute;
}

/* Multi-Column Grid for PDF Tools */
.dropdown-menu.grid-layout {
    display: none;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    width: 900px;
    max-width: 95vw;
    padding: 1rem;
    max-height: 75vh;
    overflow-y: auto;
    overflow-x: hidden;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
}

.dropdown-menu.grid-layout.show {
    display: grid;
}

.dropdown-column {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dropdown-menu::-webkit-scrollbar {
    width: 8px;
}
.dropdown-menu::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
}
.dropdown-menu::-webkit-scrollbar-thumb {
    background: #dc3545;
    border-radius: 10px;
}
.dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: #ff6b6b;
}

/* Dropdown Item Styling */
.dropdown-item-custom {
    color: #e0e0e0;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    transition: all 0.3s;
    border-left: 4px solid transparent;
    margin-bottom: 0.35rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dropdown-item-custom i {
    min-width: 18px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}
.dropdown-item-custom:hover {
    background-color: rgba(220,53,69,0.3);
    color: #fff;
    border-left-color: #ffc107;
    padding-left: 1.5rem;
    transform: translateX(5px);
}

/* Category Dropdown Toggle */
.category-dropdown-toggle {
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: rgba(255,255,255,0.85) !important;
    font-weight: 500;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: clamp(0.85rem,2vw,1rem);
}

.category-dropdown-toggle:hover {
    color: #dc3545 !important;
}

.category-dropdown-toggle::after {
    content: '';
    display: inline-block;
    width: 0.3em;
    height: 0.3em;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.3s;
    margin-left: 0.3rem;
}

.category-dropdown-toggle[aria-expanded="true"]::after {
    transform: rotate(45deg);
}

/* Header Section */
.dropdown-category-header {
    color: #dc3545;
    font-weight: 800;
    font-size: 0.85rem;
    text-transform: uppercase;
    padding: 0.5rem 0;
    letter-spacing: 1.5px;
    margin: 0.75rem 0 0.5rem 0;
    border-bottom: 2px solid #dc3545;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Grid column header */
.grid-column-header {
    color: #dc3545;
    font-weight: 800;
    font-size: 0.8rem;
    text-transform: uppercase;
    padding: 0.75rem;
    letter-spacing: 1px;
    border-bottom: 2px solid #dc3545;
    border-radius: 4px;
    background: rgba(220,53,69,0.1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Search Box */
.tools-search-box {
    padding: 0.75rem 0;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid #444;
}

.grid-search-box {
    grid-column: 1 / -1;
    padding: 0 0 1rem 0;
    margin: 0 0 1rem 0;
    border-bottom: 1px solid #444;
}

.tools-search-box input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid #dc3545;
    color: #fff;
    border-radius: 6px;
    font-size: 0.9rem;
}

.tools-search-box input::placeholder {
    color: rgba(255,255,255,0.5);
}

.tools-search-box input:focus {
    outline: none;
    background: rgba(255,255,255,0.15);
    border-color: #ff6b6b;
    box-shadow: 0 0 8px rgba(220,53,69,0.3);
}

/* Responsive */
@media (max-width:1399px) {
    .dropdown-menu.grid-layout {
        grid-template-columns: repeat(3, 1fr);
        width: 800px;
    }
}

@media (max-width:1199px) {
    .dropdown-menu { min-width: 260px; }
    .dropdown-menu.grid-layout {
        grid-template-columns: repeat(2, 1fr);
        width: 700px;
    }
}

@media (max-width:991px) {
    .navbar-collapse { background: transparent; border-radius: 0; margin-top: 0; padding: 0; }
    .dropdown-menu {
        background: rgba(26,26,26,0.98);
        border: 1px solid #dc3545;
        display: none !important;
        position: static !important;
        box-shadow: none;
        margin-top: 0 !important;
        max-width: 100%;
        transform: none !important;
        max-height: 60vh;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 0.75rem;
        border-radius: 0.75rem;
        width: 100% !important;
        min-width: unset;
    }
    .dropdown-menu.grid-layout {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        padding: 0.75rem;
        max-height: 60vh;
        overflow-y: auto;
        overflow-x: hidden;
        width: 100% !important;
        left: 0 !important;
        transform: none !important;
    }
    .dropdown-menu.show { display: block !important; }
    .dropdown-menu.grid-layout.show { display: grid !important; }

    .category-dropdown-toggle::after {
        display: inline-block;
        margin-left: 0.5rem;
        vertical-align: 0.255em;
        content: '';
        border-top: 0.3em solid;
        border-right: 0.3em solid transparent;
        border-bottom: 0;
        border-left: 0.3em solid transparent;
        transition: transform 0.3s ease;
        transform: none;
    }

    .category-dropdown-toggle[aria-expanded="true"]::after {
        transform: rotate(180deg);
    }
}

@media (max-width:576px) {
    .dropdown-menu {
        padding: 0.5rem;
        max-height: 50vh;
        max-width: 100%;
        min-width: unset;
    }
    .dropdown-menu.grid-layout {
        grid-template-columns: 1fr;
        padding: 0.5rem;
        gap: 0.5rem;
    }
    .dropdown-item-custom { padding: 0.5rem 0.75rem; font-size: 0.85rem; gap: 0.5rem; }
    .dropdown-category-header { font-size: 0.75rem; }
}

.dropdown-divider {
    border-color: #444;
    margin: 0.75rem 0;
}

/* ========== HERO SECTION ========== */
.hero-section {
    background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    color: #ffffff;
    padding: 2.5rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 4px solid #dc3545;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.hero-title {
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    font-weight: 900;
    margin-bottom: 0.75rem;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
}

.hero-title .emoji {
    animation: bounce 2s infinite;
    display: inline-block;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.hero-subtitle {
    font-size: clamp(0.95rem, 3vw, 1.1rem);
    font-weight: 500;
    margin-bottom: 1.25rem;
    opacity: 0.95;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.hero-cta {
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.hero-cta .btn {
    transition: all 0.3s ease;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
    padding: 0.6rem 1.5rem;
    font-size: clamp(0.9rem, 2vw, 1rem);
}

.hero-cta .btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(220, 53, 69, 0.5);
}

[data-bs-theme="dark"] .hero-section {
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #2a2a5a 100%);
    border-bottom-color: #ff6b6b;
}

/* ========== SECTION SPACING ========== */
.tools-section {
    padding: 2.5rem 0;
    margin-bottom: 1rem;
}

.tools-section h2 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 800;
    margin-bottom: 2rem;
    position: relative;
    display: inline-block;
    width: 50%;
}

/* ========== CARD STYLING ========== */
.card-link {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    display: block;
    height: 100%;
}

.card-link:hover { text-decoration: none; }

.tool-card {
    border: 2px solid #e9ecef;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #ffffff;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.tool-card:hover {
    transform: translateY(-8px);
    border-color: #dc3545;
    box-shadow: 0 12px 32px rgba(220, 53, 69, 0.2);
}

.tool-card .card-body {
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.tool-card .card-title {
    font-size: clamp(1.1rem, 2.5vw, 0.95rem);
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.tool-card .card-text {
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    color: #6c757d;
    margin-bottom: 0;
    line-height: 1.4;
}

.tool-card i {
    transition: all 0.3s ease;
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin-bottom: 0.75rem;
}

.tool-card:hover i {
    transform: scale(1.15) rotate(5deg);
}

[data-bs-theme="dark"] .tool-card {
    background: #1a1a1a;
    border-color: #333333;
}

[data-bs-theme="dark"] .tool-card:hover { border-color: #ff6b6b; }
[data-bs-theme="dark"] .tool-card .card-text { color: #a0a0a0; }

/* ========== GRID RESPONSIVE ========== */
.tools-grid {
    display: grid;
    gap: 1.5rem;
    width: 100%;
}

@media (min-width: 1920px) {
    .tools-grid { grid-template-columns: repeat(5, 1fr); gap: 1.75rem; }
}

@media (min-width: 1400px) and (max-width: 1919px) {
    .tools-grid { grid-template-columns: repeat(5, 1fr); gap: 1.5rem; }
}

@media (min-width: 1200px) and (max-width: 1399px) {
    .tools-grid { grid-template-columns: repeat(6, 1fr); gap: 1.5rem; }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .tools-grid { grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
}

@media (min-width: 576px) and (max-width: 767px) {
    .tools-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
}

@media (max-width: 575px) {
    .tools-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
}

/* ========== FAQ SECTION ========== */
.faq-section { padding: 2.5rem 0; }

.faq-section h2 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 800;
    margin-bottom: 2rem;
}

.accordion-button {
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    padding: 1rem;
}

.accordion-body {
    font-size: clamp(0.85rem, 2vw, 0.95rem);
    padding: 1rem;
    line-height: 1.6;
}

.accordion-button:not(.collapsed) {
    color: #dc3545;
    background-color: #fff5f5;
}

[data-bs-theme="dark"] .accordion-button:not(.collapsed) {
    background-color: #2a2a2a;
    color: #ff6b6b;
}

/* ========== MAIN CONTAINER ========== */
main { min-height: calc(100vh - 200px); }

/* ========== DARK MODE SUPPORT ========== */
[data-bs-theme="dark"] {
    background-color: #0d1117;
    color: #e0e0e0;
}

[data-bs-theme="dark"] .tools-section { background-color: transparent; }
[data-bs-theme="dark"] .tools-section.bg-light { background-color: #1a1a1a !important; }
