/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Exo 2', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0c0c14;
    min-height: 100vh;
    color: #00f3ff;
    overflow-x: hidden;
    position: relative;
}

.space-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 10% 20%, rgba(12, 12, 20, 0.8) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(12, 12, 20, 0.8) 0%, transparent 20%),
        radial-gradient(circle at 50% 50%, rgba(12, 15, 30, 0.9) 0%, rgba(12, 12, 20, 1) 100%);
    z-index: -2;
    pointer-events: none;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Bottom Legal Links */
.bottom-legal-links {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    max-width: 300px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.bottom-legal-links .legal-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.bottom-legal-links .legal-btn span {
    font-size: 0.9rem;
}

.legal-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    color: #6a6aff;
    transition: all 0.2s ease;
    background: rgba(20, 20, 50, 0.5);
    border: 1px solid rgba(106, 106, 255, 0.2);
    font-family: 'Orbitron', monospace;
    font-weight: 500;
    font-size: 0.8rem;
}

.legal-btn:hover {
    background: rgba(30, 30, 70, 0.7);
    color: #00f3ff;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
    border: 1px solid rgba(0, 243, 255, 0.3);
    transform: translateY(-2px);
}

.legal-btn i {
    color: #6a6aff;
}

.legal-btn:hover i {
    color: #00f3ff;
    text-shadow: 0 0 8px rgba(0, 243, 255, 0.5);
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    padding: 0.5rem 0;
}

/* Header Styles */
.header {
    display: flex;
    flex-direction: row;
    align-items: center;
    text-align: left;
    margin: 0.5rem 0;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    /* Allow wrapping on small screens */
}

.logo-display {
    margin-bottom: 0;
}

.logo {
    font-family: 'Orbitron', monospace;
    font-size: 1.8rem;
    font-weight: 700;
    color: #00f3ff;
    margin-bottom: 0;
    letter-spacing: 1px;
    text-shadow: 0 0 15px rgba(0, 243, 255, 0.7);
    animation: pulse 2s ease-in-out infinite;
    position: relative;
    white-space: nowrap;
}

.logo::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #00f3ff, transparent);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.7);
}

@keyframes pulse {
    0% {
        text-shadow: 0 0 10px rgba(0, 243, 255, 0.7);
    }

    50% {
        text-shadow: 0 0 25px rgba(0, 243, 255, 0.9), 0 0 40px rgba(0, 243, 255, 0.6);
    }

    100% {
        text-shadow: 0 0 10px rgba(0, 243, 255, 0.7);
    }
}

/* Search Section */
.search-section {
    display: flex;
    justify-content: center;
    margin: 0.5rem 0;
    flex: 1;
}

/* Header Search */
.search-container-header {
    flex: 1;
    max-width: 500px;
    min-width: 0;
    /* Allow flexbox to shrink properly on small screens */
}

.search-box-header {
    position: relative;
    background: rgba(15, 15, 35, 0.7);
    border-radius: 12px;
    box-shadow: 0 0 15px rgba(106, 106, 255, 0.3);
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: all 0.3s ease;
    border: 1px solid rgba(106, 106, 255, 0.3);
    backdrop-filter: blur(10px);
}

.search-box-header:hover {
    box-shadow: 0 0 20px rgba(106, 106, 255, 0.5);
    transform: translateY(-2px);
    border: 1px solid rgba(0, 243, 255, 0.5);
}

.search-icon {
    color: #00f3ff;
    font-size: 1rem;
    text-shadow: 0 0 5px rgba(0, 243, 255, 0.5);
}

#search-input-header {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.9rem;
    color: #00f3ff;
    font-weight: 400;
    background: transparent;
    font-family: 'Exo 2', sans-serif;
}

#search-input-header::placeholder {
    color: #4a4aff;
}

#search-input-header:focus {
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
}

.search-engines-header {
    display: flex;
    gap: 0.3rem;
    margin-left: auto;
}

.engine-btn-header {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: rgba(20, 20, 50, 0.8);
    color: #6a6aff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    border: 1px solid rgba(106, 106, 255, 0.3);
}

.engine-btn-header:hover {
    background: rgba(30, 30, 70, 0.9);
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(106, 106, 255, 0.5);
    color: #00f3ff;
}

.engine-btn-header.active {
    background: rgba(0, 243, 255, 0.2);
    color: #00f3ff;
    border: 1px solid #00f3ff;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
}

.search-container {
    width: 100%;
    max-width: 700px;
}

.search-box {
    position: relative;
    background: rgba(15, 15, 35, 0.7);
    border-radius: 15px;
    box-shadow: 0 0 25px rgba(106, 106, 255, 0.3);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    transition: all 0.3s ease;
    border: 1px solid rgba(106, 106, 255, 0.3);
    backdrop-filter: blur(10px);
}

.search-box:hover {
    box-shadow: 0 0 35px rgba(106, 106, 255, 0.5);
    transform: translateY(-3px);
    border: 1px solid rgba(0, 243, 255, 0.5);
}

.search-icon {
    color: #00f3ff;
    font-size: 1.3rem;
    text-shadow: 0 0 8px rgba(0, 243, 255, 0.5);
}

#search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    color: #00f3ff;
    font-weight: 400;
    background: transparent;
    font-family: 'Exo 2', sans-serif;
}

#search-input::placeholder {
    color: #4a4aff;
}

#search-input:focus {
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.3);
}

.search-engines {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.engine-btn {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 10px;
    background: rgba(20, 20, 50, 0.8);
    color: #6a6aff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 1.1rem;
    border: 1px solid rgba(106, 106, 255, 0.3);
}

.engine-btn:hover {
    background: rgba(30, 30, 70, 0.9);
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(106, 106, 255, 0.5);
    color: #00f3ff;
}

.engine-btn.active {
    background: rgba(0, 243, 255, 0.2);
    color: #00f3ff;
    border: 1px solid #00f3ff;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.5);
}

/* Section Titles */
.section-title {
    font-family: 'Orbitron', monospace;
    color: #00f3ff;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    text-align: center;
    text-shadow: 0 0 8px rgba(0, 243, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
}

/* Quick Tools Section */
.quick-tools-section {
    margin: 0.3rem 0;
}

.tools-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.6rem;
}

.tool-card {
    background: rgba(15, 15, 35, 0.7);
    border-radius: 15px;
    padding: 1rem;
    border: 1px solid rgba(106, 106, 255, 0.3);
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(106, 106, 255, 0.2);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #00f3ff, #6a6aff);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.tool-card:hover::before {
    transform: scaleX(1);
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 30px rgba(106, 106, 255, 0.4);
    border: 1px solid rgba(0, 243, 255, 0.5);
}

/* Tool Button Styles */
.tool-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    text-align: center;
    min-height: 120px;
}

.tool-icon {
    font-size: 2rem;
    color: #00f3ff;
    text-shadow: 0 0 8px rgba(0, 243, 255, 0.5);
}

.tool-name {
    font-family: 'Orbitron', monospace;
    font-size: 0.9rem;
    font-weight: 500;
    color: #6a6aff;
}

/* Tool Panels */
.tool-panels {
    margin-top: 1rem;
}

.tool-panel {
    background: rgba(15, 15, 35, 0.9);
    border-radius: 15px;
    padding: 1rem;
    border: 1px solid rgba(106, 106, 255, 0.3);
    box-shadow: 0 0 30px rgba(106, 106, 255, 0.3);
    backdrop-filter: blur(10px);
    position: relative;
    display: none;
}

.tool-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(106, 106, 255, 0.3);
}

.panel-header h3 {
    font-family: 'Orbitron', monospace;
    color: #00f3ff;
    margin: 0;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.close-panel {
    background: rgba(255, 50, 50, 0.2);
    color: #ff6b6b;
    border: 1px solid rgba(255, 50, 50, 0.3);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-panel:hover {
    background: rgba(255, 50, 50, 0.3);
    transform: scale(1.1);
}

/* Calculator Styles */
.calculator-container {
    background: rgba(20, 20, 50, 0.8);
    border-radius: 10px;
    padding: 1rem;
    border: 1px solid rgba(106, 106, 255, 0.3);
}

.calculator-display {
    margin-bottom: 1rem;
}

.calculator-display input {
    width: 100%;
    background: rgba(10, 10, 30, 0.9);
    border: 1px solid rgba(0, 243, 255, 0.3);
    border-radius: 5px;
    padding: 0.8rem;
    font-size: 1.2rem;
    color: #00f3ff;
    text-align: right;
    font-family: 'Orbitron', monospace;
    outline: none;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.2);
}

.calculator-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.calc-btn {
    padding: 1rem;
    border: none;
    border-radius: 8px;
    background: rgba(30, 30, 70, 0.8);
    color: #6a6aff;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(106, 106, 255, 0.3);
    font-family: 'Orbitron', monospace;
}

.calc-btn:hover {
    background: rgba(40, 40, 90, 0.9);
    color: #00f3ff;
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.3);
    border: 1px solid rgba(0, 243, 255, 0.5);
}

.calc-btn:active {
    transform: translateY(0);
}

.calc-btn.operator {
    background: rgba(0, 243, 255, 0.2);
    color: #00f3ff;
    font-size: 1.2rem;
}

.calc-btn.operator:hover {
    background: rgba(0, 243, 255, 0.3);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.5);
}

#calc-equals {
    background: rgba(106, 106, 255, 0.3);
    color: #ffffff;
}

#calc-equals:hover {
    background: rgba(106, 106, 255, 0.5);
    box-shadow: 0 0 20px rgba(106, 106, 255, 0.7);
}

#calc-clear {
    background: rgba(255, 50, 50, 0.2);
    color: #ff6b6b;
}

#calc-clear:hover {
    background: rgba(255, 50, 50, 0.3);
    box-shadow: 0 0 20px rgba(255, 50, 50, 0.5);
}

/* Currency Converter Styles */
.currency-converter-container {
    background: rgba(20, 20, 50, 0.8);
    border-radius: 10px;
    padding: 1rem;
    border: 1px solid rgba(106, 106, 255, 0.3);
}

.currency-input-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.currency-input-group input,
.currency-input-group select {
    flex: 1;
    padding: 0.8rem;
    border-radius: 5px;
    border: 1px solid rgba(106, 106, 255, 0.3);
    background: rgba(10, 10, 30, 0.9);
    color: #00f3ff;
    font-family: 'Orbitron', monospace;
    font-size: 1rem;
}

.currency-input-group input {
    text-align: right;
}

.currency-input-group select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300f3ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1rem;
    padding-right: 2rem;
}

.currency-input-group input:focus,
.currency-input-group select:focus {
    outline: none;
    border: 1px solid rgba(0, 243, 255, 0.5);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
}

.currency-swap {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

#swap-currencies {
    background: rgba(0, 243, 255, 0.2);
    color: #00f3ff;
    border: 1px solid rgba(0, 243, 255, 0.3);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

#swap-currencies:hover {
    background: rgba(0, 243, 255, 0.3);
    transform: rotate(180deg);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.5);
}

.currency-result {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

#convert-btn {
    background: rgba(106, 106, 255, 0.3);
    color: #ffffff;
    border: 1px solid rgba(106, 106, 255, 0.5);
    border-radius: 8px;
    padding: 0.8rem 1.5rem;
    font-family: 'Orbitron', monospace;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

#convert-btn:hover {
    background: rgba(106, 106, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(106, 106, 255, 0.7);
}

.exchange-rate-info {
    text-align: center;
    color: #6a6aff;
    font-size: 0.9rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(106, 106, 255, 0.2);
}

#exchange-rate,
#last-updated {
    margin-bottom: 0.3rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Categories Section */
.categories-section {
    margin: 0.3rem 0;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.6rem;
}

.category-card {
    background: rgba(15, 15, 35, 0.7);
    border-radius: 15px;
    padding: 1rem;
    border: 1px solid rgba(106, 106, 255, 0.3);
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(106, 106, 255, 0.2);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.category-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #00f3ff, #6a6aff);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.category-card:hover::before {
    transform: scaleX(1);
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 30px rgba(106, 106, 255, 0.4);
    border: 1px solid rgba(0, 243, 255, 0.5);
}

.category-card h3 {
    font-family: 'Orbitron', monospace;
    font-size: 1.1rem;
    font-weight: 600;
    color: #00f3ff;
    margin-bottom: 1rem;
    text-align: center;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    text-shadow: 0 0 8px rgba(0, 243, 255, 0.5);
}

.category-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
}

.category-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    text-decoration: none;
    color: #6a6aff;
    transition: all 0.2s ease;
    background: rgba(20, 20, 50, 0.5);
    border: 1px solid rgba(106, 106, 255, 0.2);
    position: relative;
    overflow: hidden;
    font-size: 0.9rem;
}

.category-link::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 243, 255, 0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.category-link:hover::before {
    transform: translateX(100%);
}

.category-link:hover {
    background: rgba(30, 30, 70, 0.7);
    transform: translateX(8px);
    color: #00f3ff;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.3);
    border: 1px solid rgba(0, 243, 255, 0.3);
}

.category-link i {
    font-size: 1.3rem;
    width: 24px;
    text-align: center;
    color: #6a6aff;
}

.category-link:hover i {
    color: #00f3ff;
    text-shadow: 0 0 8px rgba(0, 243, 255, 0.5);
}

.category-link span {
    font-weight: 500;
    font-size: 1rem;
}

/* News Section */
.news-section {
    margin-top: 0.3rem;
}

.news-widget {
    background: rgba(15, 15, 35, 0.7);
    border-radius: 15px;
    padding: 1rem;
    border: 1px solid rgba(106, 106, 255, 0.3);
    box-shadow: 0 0 20px rgba(106, 106, 255, 0.2);
    backdrop-filter: blur(10px);
    position: relative;
}

.news-widget::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #00f3ff, #6a6aff);
}

.news-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.8rem;
    /* Ensure proper alignment even with single item */
    justify-items: stretch;
    align-items: start;
}

/* Ensure single news item takes appropriate space */
.news-container:has(.news-item:nth-child(1):last-child) {
    display: flex;
    justify-content: center;
}

.news-item {
    padding: 0.8rem;
    border-radius: 10px;
    background: rgba(20, 20, 50, 0.5);
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid rgba(106, 106, 255, 0.2);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* Remove fixed min-height to allow natural sizing */
    width: 100%;
}

.news-item::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 243, 255, 0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.news-item:hover::before {
    transform: translateX(100%);
}

.news-item:hover {
    background: rgba(30, 30, 70, 0.7);
    transform: translateY(-3px);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.3);
    border: 1px solid rgba(0, 243, 255, 0.3);
}

.news-image-container {
    width: 100%;
    height: 120px;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 0.6rem;
    /* Ensure proper aspect ratio handling */
    display: flex;
    align-items: center;
    justify-content: center;
}

.news-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    background-color: rgba(30, 30, 70, 0.5);
    /* Placeholder background */
    /* Ensure image stays sharp */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy-image[src] {
    opacity: 1;
}

.news-item:hover .news-image {
    transform: scale(1.05);
}

.news-text {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.news-title {
    font-weight: 500;
    color: #6a6aff;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    line-height: 1.3;
}

.news-source {
    font-size: 0.85rem;
    color: #00f3ff;
    font-weight: 600;
    margin-bottom: 0.3rem;
    text-shadow: 0 0 5px rgba(0, 243, 255, 0.5);
}

.news-time {
    font-size: 0.8rem;
    color: #4a4aff;
    margin-top: auto;
}

.news-loading {
    text-align: center;
    color: #6a6aff;
    font-style: italic;
    padding: 2rem;
    font-family: 'Orbitron', monospace;
    /* Ensure loading message is centered even when alone */
    grid-column: 1 / -1;
}

/* Weather Widget */
.weather-section {
    margin-top: 0.3rem;
}

.weather-widget {
    background: rgba(15, 15, 35, 0.7);
    border-radius: 15px;
    padding: 1rem;
    border: 1px solid rgba(106, 106, 255, 0.3);
    box-shadow: 0 0 20px rgba(106, 106, 255, 0.2);
    backdrop-filter: blur(10px);
    position: relative;
}

.weather-widget::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #00f3ff, #6a6aff);
}

.weather-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.8rem;
    height: 100%;
}

.weather-item {
    padding: 0.8rem;
    border-radius: 10px;
    background: rgba(20, 20, 50, 0.5);
    transition: all 0.2s ease;
    border: 1px solid rgba(106, 106, 255, 0.2);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: row;
}

.weather-item::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 243, 255, 0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.weather-item:hover::before {
    transform: translateX(100%);
}

.weather-item:hover {
    background: rgba(30, 30, 70, 0.7);
    transform: translateY(-3px);
    box-shadow: 0 0 20px rgba(106, 106, 255, 0.3);
    border: 1px solid rgba(0, 243, 255, 0.3);
}

.weather-current {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem;
}

.weather-icon {
    font-size: 3rem;
    color: #00f3ff;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
}

.weather-temp {
    font-size: 2rem;
    font-weight: 700;
    color: #00f3ff;
    margin-bottom: 0.5rem;
    font-family: 'Orbitron', monospace;
}

.weather-desc {
    font-size: 1rem;
    color: #6a6aff;
    margin-bottom: 0.5rem;
}

.weather-location {
    font-size: 0.9rem;
    color: #4a4aff;
    font-weight: 500;
}

.weather-forecast {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(106, 106, 255, 0.2);
}

.forecast-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    border-radius: 8px;
    background: rgba(20, 20, 50, 0.3);
}

.forecast-day {
    font-size: 0.8rem;
    color: #6a6aff;
    font-weight: 500;
    margin-bottom: 0.3rem;
}

.forecast-icon {
    font-size: 1.2rem;
    color: #00f3ff;
    margin-bottom: 0.3rem;
}

.forecast-temp {
    font-size: 0.9rem;
    color: #00f3ff;
    font-weight: 600;
    font-family: 'Orbitron', monospace;
}

.weather-loading {
    text-align: center;
    color: #6a6aff;
    font-style: italic;
    padding: 2rem;
    font-family: 'Orbitron', monospace;
}

/* Weather and Map Section */
.weather-map-section {
    margin-top: 0.3rem;
}

.weather-map-container {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.weather-map-container .weather-widget,
.weather-map-container .map-widget {
    flex: 1;
    min-width: 300px;
    margin: 0;
}

/* Tools and Weather - Mobile */
.tools-weather-container {
    flex-direction: row;
}

.tools-widget,
.weather-widget {
    min-width: 100%;
}

.tools-widget .tools-container {
    flex-direction: row;
    align-items: center;
}

.tools-widget .tool-card {
    max-width: 100%;
    width: 100%;
    max-width: 250px;
}

/* Integrated Section */
.integrated-section {
    margin-top: 0.3rem;
}

.integrated-container {
    background: rgba(15, 15, 35, 0.7);
    border-radius: 15px;
    padding: 1rem;
    border: 1px solid rgba(106, 106, 255, 0.3);
    box-shadow: 0 0 20px rgba(106, 106, 255, 0.2);
    backdrop-filter: blur(10px);
    position: relative;
}

.integrated-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #00f3ff, #6a6aff);
}

.tools-weather-container {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.tools-widget,
.weather-widget {
    flex: 1;
    min-width: 300px;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    display: flex;
    justify-content: center;
}

.tools-widget::before,
.weather-widget::before {
    display: none;
}

/* Tools Widget Styles */
.tools-widget .tools-container {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.tools-widget .tool-card {
    flex: 1;
    min-width: 120px;
    max-width: 200px;
}

/* Weather Widget Styles */
.weather-widget .weather-container {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Map Widget */
.map-section {
    margin-top: 0.3rem;
}

.map-widget {
    background: rgba(15, 15, 35, 0.7);
    border-radius: 15px;
    padding: 1rem;
    border: 1px solid rgba(106, 106, 255, 0.3);
    box-shadow: 0 0 20px rgba(106, 106, 255, 0.2);
    backdrop-filter: blur(10px);
    position: relative;
}

.map-widget::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #00f3ff, #6a6aff);
}

.map-container {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.2);
}

.map-container iframe {
    width: 100%;
    height: 450px;
    border: none;
}

/* Privacy and Terms Pages */
.privacy-content,
.terms-content {
    background: rgba(15, 15, 35, 0.7);
    border-radius: 15px;
    padding: 2rem;
    border: 1px solid rgba(106, 106, 255, 0.3);
    box-shadow: 0 0 20px rgba(106, 106, 255, 0.2);
    backdrop-filter: blur(10px);
    margin-bottom: 2rem;
}

.privacy-content h2,
.terms-content h1 {
    font-family: 'Orbitron', monospace;
    color: #00f3ff;
    margin-bottom: 1.5rem;
    font-size: 2rem;
    text-align: center;
    text-shadow: 0 0 8px rgba(0, 243, 255, 0.5);
}

.privacy-content h3,
.terms-content h3 {
    font-family: 'Orbitron', monospace;
    color: #00f3ff;
    margin: 1.5rem 0 1rem;
    font-size: 1.3rem;
    text-shadow: 0 0 5px rgba(0, 243, 255, 0.5);
}

.privacy-content p,
.terms-content p {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: #6a6aff;
}

.privacy-content ul,
.terms-content ul {
    margin-left: 2rem;
    margin-bottom: 1rem;
    color: #6a6aff;
}

.privacy-content li,
.terms-content li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.privacy-content a,
.terms-content a {
    color: #00f3ff;
    text-decoration: none;
}

.privacy-content a:hover,
.terms-content a:hover {
    text-decoration: underline;
}

.privacy-content .title,
.terms-content .title {
    margin-bottom: 1.5rem;
}

.privacy-content .mm,
.terms-content .mm {
    color: #00f3ff;
    font-weight: 600;
}

.back-button {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

@media screen and (max-width: 1200px) {
        .weather-forecast {

        grid-template-columns: repeat(2, 1fr);

    }
}
/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0.8rem;
    }

    .top-bar {
        justify-content: center;
    }

    .logo {
        font-size: 2.8rem;
    }

    .search-box {
        padding: 1rem 1.2rem;
    }

    #search-input {
        font-size: 1rem;
    }

    .categories-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }

    .category-card {
        padding: 1.2rem;
    }

    .category-links {
        gap: 0.7rem;
    }

    .category-link {
        padding: 0.8rem 1rem;
    }

    .news-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .news-item {
        /* Remove fixed min-height to allow natural sizing */
        padding: 0.8rem;
    }

    .news-image-container {
        height: 120px;
        /* Keep consistent image container height */
        /* Ensure proper aspect ratio handling on mobile */
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .news-image {
        /* Ensure image stays sharp on mobile */
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }

    /* Ensure single news item displays properly on mobile */
    .news-container:has(.news-item:nth-child(1):last-child) {
        display: block;
    }

    .news-item:nth-child(1):last-child {
        width: 100%;
        margin: 0 auto;
        /* Remove max-width restriction to allow natural sizing */
    }

    .quick-links {
        gap: 1rem;
    }

    .quick-link {
        min-width: 80px;
        padding: 0.8rem;
    }

    .legal-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.7rem;
    }

    .privacy-content,
    .terms-content {
        padding: 1.5rem;
    }

    .privacy-content h2,
    .terms-content h1 {
        font-size: 1.5rem;
    }

    /* Header Search - Mobile */
    .search-container-header {
        max-width: 100%;
        margin: 0 0.5rem;
    }

    .search-box-header {
        padding: 0.5rem 0.8rem;
    }

    #search-input-header {
        font-size: 0.9rem;
        min-height: 40px;
        /* Ensure adequate touch target size */
    }

    .search-engines-header {
        gap: 0.2rem;
    }

    .engine-btn-header {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    /* Weather and Map - Mobile */
    .weather-map-container {
        flex-direction: column;
    }

    .weather-map-container .weather-widget,
    .weather-map-container .map-widget {
        min-width: 100%;
    }

    /* Integrated Widgets - Mobile */
    .widgets-container {
        flex-direction: column;
    }

    .widgets-container .weather-widget,
    .widgets-container .map-widget {
        min-width: 100%;
    }

    /* Tools and Weather - Mobile */
    .tools-weather-container {
        flex-direction: column;
    }

    .tools-widget,
    .weather-widget {
        min-width: 100%;
    }

    .tools-widget .tools-container {
        flex-direction: row;
        align-items: center;
        justify-content: space-around;
    }

    .tool-panel {
        min-width: 280px;
    }

    .currency-converter-container {
        min-width: 250px;
    }

    .currency-input-group {
        flex-direction: column;
    }

    .currency-input-group input,
    .currency-input-group select {
        width: 100%;
        min-width: 0;
    }

    .tools-widget .tool-card {
        max-width: 100%;
        width: 100%;
        max-width: 250px;
    }


}

@media (max-width: 698px) {
    .container {
        padding: 0.5rem;
    }

    .logo {
        font-size: 2.2rem;
    }

    .search-engines {
        display: none;
    }

    .engine-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .news-widget {
        padding: 1.2rem;
    }

    .news-item {
        padding: 0.6rem;
    }

    .news-image-container {
        height: 110px;
        /* Slightly reduced height for smaller screens */
        /* Ensure proper aspect ratio handling on small screens */
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .news-image {
        /* Ensure image stays sharp on small screens */
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }

    .news-title {
        font-size: 0.85rem;
    }

    .news-source {
        font-size: 0.8rem;
    }

    .news-time {
        font-size: 0.75rem;
    }

    .categories-grid {
        gap: 1rem;
    }

    .category-card {
        padding: 1rem;
    }

    .category-card h3 {
        font-size: 1.1rem;
    }

    .quick-links {
        gap: 0.5rem;
    }

    .quick-link {
        min-width: 70px;
        padding: 0.6rem;
        font-size: 0.8rem;
    }

    .quick-link i {
        font-size: 1.5rem;
    }

    .section-title {
        font-size: 1.3rem;
    }

    .privacy-content,
    .terms-content {
        padding: 1rem;
    }

    /* Header Search - Small Mobile */
    .header {
        flex-direction: column;
        gap: 0.8rem;
        align-items: stretch;
    }

    .logo-display {
        text-align: center;
    }

    .search-container-header {
        margin: 0;
    }

    .search-box-header {
        padding: 0.6rem;
        flex-wrap: wrap;
        /* Allow wrapping of search engines if needed */
    }

    #search-input-header {
        font-size: 1rem;
        padding: 0.2rem;
        /* Ensure the input field takes available space */
        min-width: 0;
        flex: 1;
    }

    .search-engines-header {
        display: flex;
        /* Keep engines visible on very small screens */
        gap: 0.3rem;
        /* Ensure engines don't overflow */
        flex-shrink: 0;
    }

    .engine-btn-header {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
        /* Ensure buttons don't shrink */
        flex-shrink: 0;
    }

    /* Integrated Widgets - Small Mobile */
    .widgets-container {
        flex-direction: column;
    }

    .widgets-container .weather-widget,
    .widgets-container .map-widget {
        min-width: 100%;
    }

    /* Tools and Weather - Small Mobile */
    .tools-weather-container {
        flex-direction: column;
    }

    .tools-widget,
    .weather-widget {
        min-width: 100%;
    }

    .tool-panel {
        min-width: 250px;
        margin: 0 auto;
    }

    .currency-converter-container {
        min-width: 220px;
    }

    .currency-input-group {
        flex-direction: column;
    }

    .currency-input-group input,
    .currency-input-group select {
        width: 100%;
        min-width: 0;
    }
}

/* Extra small devices (iPhone 5/SE and similar) */
@media (max-width: 320px) {
    .search-box-header {
        padding: 0.4rem;
    }

    #search-input-header {
        font-size: 0.85rem;
    }

    .engine-btn-header {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
    }

    .tool-panel {
        min-width: 200px;
        padding: 0.8rem;
    }

    .currency-converter-container {
        min-width: 180px;
        padding: 0.8rem;
    }

    .currency-input-group input,
    .currency-input-group select {
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    #convert-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    #swap-currencies {
        width: 35px;
        height: 35px;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-card,
.news-widget {
    animation: fadeInUp 0.6s ease forwards;
}

.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;
}

/* Floating particles */
.particle {
    position: fixed;
    background: rgba(106, 106, 255, 0.3);
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
    animation: float 15s infinite linear;
}

@keyframes float {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(-100vh) translateX(100px) rotate(360deg);
        opacity: 0;
    }
}