/* Global Tools Hub - Custom Styles */

/* ===== Navigation Dropdowns ===== */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    padding: 0.5rem 0;
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.dropdown:hover .dropdown-menu,
.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    padding: 0.5rem 1rem;
    color: #374151;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.dropdown-item:hover {
    background-color: #f3f4f6;
    color: #1f2937;
}

/* ===== Mobile Menu ===== */
.mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mobile-menu.active {
    max-height: 2000px;
}

.hamburger {
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 0.5rem;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 3px;
    background-color: #374151;
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile accordion */
.mobile-category {
    border-bottom: 1px solid #e5e7eb;
}

.mobile-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    cursor: pointer;
    background-color: white;
    transition: background-color 0.2s ease;
}

.mobile-category-header:hover {
    background-color: #f9fafb;
}

.mobile-category-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background-color: #f9fafb;
}

.mobile-category.active .mobile-category-content {
    max-height: 500px;
}

.mobile-category-arrow {
    transition: transform 0.3s ease;
}

.mobile-category.active .mobile-category-arrow {
    transform: rotate(180deg);
}

/* ===== Animations ===== */
.result-card {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===== Smooth Scrolling ===== */
html {
    scroll-behavior: smooth;
}

/* ===== Focus Styles for Accessibility ===== */
*:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* ===== Calculator Result Styles ===== */
.result-card {
    border: 2px solid #10b981;
    background: linear-gradient(to bottom, #ecfdf5, #ffffff);
}

.error-message {
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* ===== Form Styles ===== */
.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-input:focus {
    border-color: #3b82f6;
}

.form-input.error {
    border-color: #ef4444;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #374151;
}

/* ===== Button Styles ===== */
.btn-primary {
    background-color: #3b82f6;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

/* ===== Navigation Active State ===== */
.nav-link.active {
    color: #3b82f6;
    font-weight: 600;
}

/* ===== Print Styles ===== */
@media print {
    nav, footer, .no-print, .mobile-menu, .hamburger {
        display: none !important;
    }
    
    .result-card {
        page-break-inside: avoid;
        border: 2px solid #000;
    }
    
    body {
        font-size: 12pt;
    }
}

/* ===== Responsive Breakpoints ===== */

/* Tablet: 768px - 1024px */
@media (max-width: 1024px) {
    .dropdown-menu {
        min-width: 200px;
    }
}

/* Mobile: < 768px */
@media (max-width: 768px) {
    .desktop-nav {
        display: none;
    }
    
    .mobile-nav {
        display: block;
    }
    
    .form-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .result-card {
        padding: 1rem;
    }
}

/* Desktop: > 768px */
@media (min-width: 769px) {
    .mobile-nav {
        display: none;
    }
    
    .desktop-nav {
        display: flex;
    }
}

/* ===== Utility Classes ===== */
.hidden {
    display: none;
}

.visible {
    display: block;
}

/* Skip to content link for accessibility */
.skip-to-content {
    position: absolute;
    top: -100px;
    left: 0;
    background: #3b82f6;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.skip-to-content:focus {
    top: 10px;
    opacity: 1;
    pointer-events: auto;
}

/* ===== Language Switcher ===== */
.language-switcher {
    position: relative;
}

.language-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    padding: 0.5rem 0;
    min-width: 150px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.language-switcher:hover .language-dropdown,
.language-switcher.active .language-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.language-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.language-option:hover {
    background-color: #f3f4f6;
}

.language-option.active {
    background-color: #dbeafe;
    color: #1e40af;
}

/* ===== Scroll to Top Button ===== */
.scroll-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: #3b82f6;
    color: white;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    background-color: #2563eb;
    transform: translateY(-5px);
}

/* ===== Loading Spinner ===== */
.spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== Unit Converter Specific Styles ===== */
.conversion-row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.conversion-row .form-group {
    flex: 1;
}

.conversion-arrow {
    text-align: center;
    font-size: 24px;
    margin: 15px 0;
}

.reference-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.reference-section h3 {
    color: #3b82f6;
    margin-bottom: 15px;
}

.reference-list {
    list-style: none;
    padding: 0;
}

.reference-list li {
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

.reference-list li:last-child {
    border-bottom: none;
}

.table-header {
    background: #3b82f6;
    color: white;
    padding: 15px;
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
    font-size: 18px;
}

.table-header + .comparison-table {
    margin-top: 0;
    border-radius: 0 0 8px 8px;
}

/* ===== Responsive Updates for Unit Converter ===== */
@media (max-width: 768px) {
    .conversion-row {
        flex-direction: column;
        gap: 0;
    }
    
    .reference-section {
        padding: 15px;
    }
}


/* ===== Enhanced Accessibility Focus Styles ===== */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #4F46E5;
    outline-offset: 2px;
}

/* Focus visible for keyboard navigation only */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid #4F46E5;
    outline-offset: 3px;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Remove outline for mouse clicks */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) {
    outline: none;
}

/* Dropdown focus styles */
.dropdown-trigger:focus {
    background-color: rgba(79, 70, 229, 0.05);
}

/* Mobile menu button focus */
#mobileMenuBtn:focus {
    background-color: rgba(79, 70, 229, 0.1);
}
