@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --bg-color: #f8f9fa;
    --text-color: #2d3436;
    --card-bg: #ffffff;
    --primary-color: #4361ee;
    --secondary-color: #f8f9fa;
    --accent-color: #7209b7;
    --border-color: #e0e0e0;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1);
    --gradient: linear-gradient(135deg, #4361ee 0%, #3a0ca3 100%);
}

.dark-mode {
    --bg-color: #121212;
    --text-color: #f8f9fa;
    --card-bg: #1e1e1e;
    --primary-color: #4cc9f0;
    --secondary-color: #2d2d2d;
    --accent-color: #b5179e;
    --border-color: #333333;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    --gradient: linear-gradient(135deg, #4cc9f0 0%, #3a0ca3 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    transition: var(--transition);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    animation: fadeInDown 0.8s ease-out;
}

.app-title {
    font-size: 1.8rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
}

.toggle-container {
    display: flex;
    gap: 1rem;
}

.toggle-btn {
    background-color: var(--secondary-color);
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 2rem;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-color);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.toggle-btn.active {
    background-color: var(--primary-color);
    color: white;
}

.search-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    animation: fadeIn 0.8s ease-out 0.2s both;
}

.search-bar {
    flex: 1;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 0.8rem 1.2rem;
    border-radius: 2rem;
    border: none;
    background-color: var(--secondary-color);
    color: var(--text-color);
    font-size: 1rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    padding-left: 3rem;
}

.search-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-color);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color);
}

.location-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0 1.5rem;
    border-radius: 2rem;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    white-space: nowrap;
}

.location-btn:hover {
    transform: translateY(-2px);
    background-color: var(--accent-color);
}

.temp-toggle {
    font-size: 1rem;
    margin-left: 0.5rem;
    display: inline-flex;
    align-items: baseline;
    gap: 0.2rem;
}

.unit {
    cursor: pointer;
    color: #aaa;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.unit.active {
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--text-color);
}

.current-weather {
    background-color: var(--card-bg);
    border-radius: 1.5rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    animation: fadeIn 0.8s ease-out 0.2s both;
    position: relative;
    overflow: hidden;
}

.current-weather::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 8px;
    background: var(--gradient);
}

.location-date {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.location {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.date {
    font-size: 1rem;
    color: #666;
}

.weather-condition {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 1.5rem 0;
    opacity: 0.5;
}

.weather-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.temperature-container {
    display: flex;
    align-items: flex-start;
    position: relative;
}

.temperature {
    font-size: 4.5rem;
    font-weight: 600;
    line-height: 1;
    position: relative;
    transition: var(--transition);
}

.temperature-unit {
    position: absolute;
    top: 0;
    right: -1.5rem;
    font-size: 1.5rem;
    font-weight: 400;
}

.weather-icon {
    width: 100px;
    height: 100px;
    margin-right: 1rem;
    animation: float 6s ease-in-out infinite;
}

.weather-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.detail-item {
    background-color: var(--secondary-color);
    border-radius: 1rem;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.detail-item:hover {
    transform: translateY(-5px);
}

.detail-value {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-label {
    font-size: 0.9rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.weather-graph-section {
    background-color: var(--card-bg);
    border-radius: 1.5rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    animation: fadeIn 0.8s ease-out 0.4s both;
}

.graph-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.graph-tabs::-webkit-scrollbar {
    height: 4px;
}

.graph-tabs::-webkit-scrollbar-track {
    background: var(--secondary-color);
}

.graph-tabs::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 10px;
}

.graph-tab {
    background-color: var(--secondary-color);
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 2rem;
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
    transition: var(--transition);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.graph-tab:hover {
    background-color: var(--primary-color);
    color: white;
}

.graph-tab.active {
    background-color: var(--primary-color);
    color: white;
}

.graph-container {
    position: relative;
    height: 300px;
}

.graph {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.4s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.graph.active {
    opacity: 1;
}

.graph-values {
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    height: 20px;
}

.graph-value {
    width: 12.5%;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
}

.graph-bars {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: calc(100% - 60px);
    padding: 0 10px;
    gap: 5px;
}

.graph-bar {
    width: 12.5%;
    border-radius: 5px 5px 0 0;
    transition: height 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.1);
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.graph-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 10px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 5px 5px 0 0;
}

.graph-labels {
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    height: 40px;
}

.graph-label {
    width: 12.5%;
    text-align: center;
    font-size: 0.8rem;
    color: #666;
}

.wind-unit {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 0.8rem;
    color: #666;
    padding: 5px;
}

.forecast-section {
    background-color: var(--card-bg);
    border-radius: 1.5rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    animation: fadeIn 0.8s ease-out 0.4s both;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hourly-forecast {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--secondary-color);
    animation: fadeIn 0.8s ease-out 0.5s both;
}

.hourly-forecast::-webkit-scrollbar {
    height: 6px;
}

.hourly-forecast::-webkit-scrollbar-track {
    background: var(--secondary-color);
    border-radius: 10px;
}

.hourly-forecast::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 10px;
}

.hourly-item {
    min-width: 90px;
    text-align: center;
    background-color: var(--secondary-color);
    border-radius: 1rem;
    padding: 1rem;
    transition: var(--transition);
    box-shadow: var(--shadow);
    flex-shrink: 0;
}

.hourly-item:hover {
    transform: translateY(-5px);
    background-color: var(--primary-color);
    color: white;
}

.hourly-item:hover .hour {
    color: rgba(255, 255, 255, 0.8);
}

.hour {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: #666;
    transition: var(--transition);
}

.hour-temp {
    font-weight: 600;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.hour-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto;
}

.daily-forecast {
    margin-top: 2rem;
    animation: fadeIn 0.8s ease-out 0.6s both;
}

.daily-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.8rem;
}

.daily-table th {
    font-weight: 500;
    color: #666;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.9rem;
}

.daily-table td {
    font-weight: 600;
    text-align: center;
    padding: 1rem 0.5rem;
    background-color: var(--secondary-color);
    border-radius: 0.8rem;
    transition: var(--transition);
    box-shadow: var(--shadow);
    cursor: pointer;
}

.daily-table td:hover {
    transform: translateY(-5px);
    background-color: var(--primary-color);
    color: white;
}

.daily-table td:hover .daily-high {
    color: white;
}

.daily-high {
    color: var(--primary-color);
    font-weight: 700;
    transition: var(--transition);
}

.astronomy {
    background-color: var(--card-bg);
    border-radius: 1.5rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    animation: fadeIn 0.8s ease-out 0.7s both;
}

.astronomy-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.astronomy-item {
    background-color: var(--secondary-color);
    border-radius: 1rem;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.astronomy-item:hover {
    transform: translateY(-5px);
    background-color: var(--primary-color);
    color: white;
}

.astronomy-item:hover .astronomy-label {
    color: rgba(255, 255, 255, 0.8);
}

.astronomy-value {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.astronomy-label {
    font-size: 0.9rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: var(--transition);
}

.moon-phase {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 1rem;
}

.moon-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.additional-info {
    background-color: var(--card-bg);
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    animation: fadeIn 0.8s ease-out 0.8s both;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.info-item {
    background-color: var(--secondary-color);
    border-radius: 1rem;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.info-item:hover {
    transform: translateY(-5px);
    background-color: var(--primary-color);
    color: white;
}

.info-item:hover .info-label {
    color: rgba(255, 255, 255, 0.8);
}

.info-value {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-label {
    font-size: 0.9rem;
    color: #666;
    transition: var(--transition);
}

.tips-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tips-list {
    list-style-type: none;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.tips-list li {
    background-color: var(--secondary-color);
    border-radius: 0.8rem;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.tips-list li:hover {
    transform: translateY(-3px);
    background-color: var(--primary-color);
    color: white;
}

.tips-list li i {
    font-size: 1.2rem;
    color: var(--primary-color);
    transition: var(--transition);
}

.tips-list li:hover i {
    color: white;
}

@media (max-width: 768px) {

    .weather-details,
    .astronomy-grid,
    .info-grid {
        grid-template-columns: 1fr;
    }

    .weather-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }

    .tips-list {
        grid-template-columns: 1fr;
    }

    .astronomy-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .search-container {
        flex-direction: column;
    }

    .location-btn {
        width: 100%;
        justify-content: center;
    }

    .graph-container {
        height: 250px;
    }

    .graph-value,
    .graph-label {
        font-size: 0.7rem;
    }

    /* New header and toggle button styles */
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .toggle-container {
        width: 100%;
        margin-left: 128px;
    }

    .toggle-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* Loading animation */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.loader {
    width: 50px;
    height: 50px;
    border: 5px solid var(--primary-color);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error message */
.error-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #ff4444;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.error-message.show {
    opacity: 1;
}

/* Add these styles to your existing styles.css */

/* For both desktop and mobile */
.temperature-container {
    position: relative;
    /* Make this the positioning context */
    display: flex;
    align-items: flex-start;
}

.temp-toggle {
    position: absolute;
    top: 0;
    right: 0;
    transform: translateX(100%);
    /* Move it to the right of the temperature */
    font-size: 1rem;
    display: inline-flex;
    align-items: baseline;
    gap: 0.2rem;
    margin-left: 0.5rem;
}

.temperature {
    position: relative;
    font-size: 4.5rem;
    font-weight: 600;
    line-height: 1;
    padding-right: 1rem;
    /* Add space for the toggle */
}

/* Adjust for mobile */
@media (max-width: 768px) {
    .temperature {
        font-size: 3.5rem;
        /* Slightly smaller on mobile */
        padding-right: 0.5rem;
        /* Less space needed on mobile */
    }

    .temp-toggle {
        font-size: 0.9rem;
        /* Slightly smaller on mobile */
    }
}