:root {
    --primary-color: #2979FF;
    --secondary-color: #D500F9;
    --background-dark: #1A1C38;
    --card-background-dark: #2A2C4A;
    --text-color-light: #E0E7FF;
    --text-color-dark: #A3A8D0;
    --border-radius-base: 12px;
    --box-shadow-base: 0 8px 18px rgba(0, 0, 0, 0.6);
    --input-focus-shadow: 0 0 0 3px rgba(41, 121, 255, 0.8);

    --current-bg-size: 500% 500%;
    --current-bg-animation: gradientAnimation 16s ease infinite;
    --current-bg-color: linear-gradient(-45deg, #1A1C38, #2A2C4A, #303F9F, #2A2C4A);

    --planner-danger-bg: #4a142b;
    --planner-danger-text: #ff8a80;
    --planner-warning-bg: #4b3b14;
    --planner-warning-text: #ffe082;
    --planner-success-bg: #1b5e20;
    --planner-success-text: #a5d6a7;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    overflow-y: scroll;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color-light);
    min-height: 100vh;
    transition: background-color 0.5s ease;
    background: var(--current-bg-color);
    background-size: var(--current-bg-size);
    animation: var(--current-bg-animation);
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

@keyframes gradientAnimation {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.light-mode {
    --primary-color: #1565C0;
    --secondary-color: #8E24AA;
    --background-dark: #F0F4F8;
    --card-background-dark: #ffffff;
    --text-color-light: #263238;
    --text-color-dark: #546E7A;
    --box-shadow-base: 0 4px 12px rgba(0, 0, 0, 0.1);
    --current-bg-color: linear-gradient(-45deg, #E0F7FA, #ffffff, #E8EAF6, #ffffff);
    --current-bg-size: 300% 300%;
    --current-bg-animation: gradientAnimation 18s ease infinite;
    background: var(--current-bg-color);
    background-size: var(--current-bg-size);
    animation: var(--current-bg-animation);
    --planner-danger-bg: #fff0f0;
    --planner-danger-text: #d32f2f;
    --planner-warning-bg: #fff8e1;
    --planner-warning-text: #ffc107;
    --planner-success-bg: #f1f8e9;
    --planner-success-text: #388e3c;
}

.light-mode header {
    border-bottom: 1px solid #ddd;
}

.light-mode .controls button {
    background-color: #f0f0f0;
    color: var(--text-color-light);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.light-mode .controls button:hover {
    background-color: #e0e0e0;
}

.light-mode .search-input,
.light-mode .date-input {
    background-color: #ffffff;
    border-color: #ddd;
    color: var(--text-color-light);
}

.light-mode .search-btn {
    color: #ffffff;
}

.light-mode .temperature {
    color: var(--primary-color);
}

.light-mode .detail-item {
    background-color: #f7f7f7;
    border-left-color: var(--primary-color);
}

.light-mode .detail-item div:last-child {
    color: var(--text-color-light);
}

.light-mode .favorite-city-item:hover {
    background-color: var(--secondary-color);
    color: white;
}

.light-mode footer {
    border-top: 1px solid #e0e0e0;
    color: var(--text-color-dark);
}

.light-mode .refresh-btn {
    background-color: #f0f0f0;
}

.light-mode .refresh-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.8em;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: 1px;
}

.team-logo {
    height: 90px;
    width: 90px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 15px;
    transition: filter 0.3s ease;
    border: 2px solid var(--primary-color);
}

.controls button {
    background-color: var(--card-background-dark);
    color: var(--text-color-light);
    border: none;
    padding: 10px 15px;
    margin-left: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s ease, transform 0.1s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.controls button:hover {
    background-color: #383852;
    transform: translateY(-2px);
}

.controls button:active {
    transform: translateY(0);
}

.search-container {
    display: flex;
    gap: 15px;
    margin-bottom: 40px;
}

.search-input,
.date-input {
    flex-grow: 1;
    padding: 12px 15px;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius-base);
    background-color: var(--card-background-dark);
    color: var(--text-color-light);
    font-size: 1em;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    min-width: 0;
}

.date-input {
    position: relative;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.date-input::-webkit-calendar-picker-indicator {
    background: none;
    z-index: 2;
    cursor: pointer;
    opacity: 0;
}

.date-input::after {
    content: '📅';
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    color: var(--primary-color);
    font-size: 1.2em;
    pointer-events: none;
    z-index: 1;
}

.date-input::-webkit-inner-spin-button,
.date-input::-webkit-clear-button {
    display: none;
}

.light-mode .date-input::after {
    color: var(--primary-color);
}

.search-input:focus,
.date-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: var(--input-focus-shadow);
}

.search-btn {
    padding: 12px 20px;
    background-color: var(--primary-color);
    color: var(--text-color-light);
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius-base);
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.1s ease;
    white-space: nowrap;
}

.search-btn:hover {
    background-color: #4C8EFF;
    border-color: var(--secondary-color);
    transform: translateY(-1px);
}

.search-btn:active {
    transform: translateY(0);
}

.refresh-btn {
    padding: 12px 16px;
    background-color: var(--card-background-dark);
    color: var(--text-color-light);
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius-base);
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.3s ease;
    white-space: nowrap;
    margin-left: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
}

.refresh-btn:hover {
    background-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(41, 121, 255, 0.3);
}

.refresh-btn:active {
    transform: translateY(0);
}

#cacheStatus {
    font-size: 0.85em;
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
    transition: all 0.3s ease;
}

.main-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
}

.weather-card {
    backdrop-filter: blur(5px);
    background-color: var(--card-background-dark);
    padding: 25px;
    border-radius: var(--border-radius-base);
    color: var(--text-color-light);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--primary-color);
    box-shadow: var(--box-shadow-base), 0 0 10px rgba(41, 121, 255, 0.4);
}

.weather-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.6), 0 0 15px rgba(213, 0, 249, 0.6);
}

.weather-card h3 {
    color: var(--secondary-color);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
    margin-bottom: 15px;
    font-weight: 600;
}

.location-info {
    margin-bottom: 20px;
}

.city-name {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--primary-color);
}

.date-display {
    font-size: 1.1em;
    color: var(--text-color-dark);
    margin-top: 5px;
}

.weather-main {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 30px;
    padding: 20px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.temperature {
    font-size: 4.5em;
    font-weight: 300;
    line-height: 1;
    color: var(--text-color-light);
}

.weather-description {
    font-size: 2em;
    text-transform: capitalize;
    color: #ffffff;
    /* Professional White */
    font-weight: 600;
    /* Bold and clean */
    letter-spacing: 0.5px;
    margin-left: 25px;
    /* Better spacing/centering relative to temp */
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    /* Subtle depth */
    display: flex;
    align-items: center;
}

.weather-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.detail-item {
    background-color: rgba(0, 0, 0, 0.1);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    border-left: 3px solid var(--primary-color);
}

.detail-item div:first-child {
    font-size: 0.9em;
    color: var(--text-color-dark);
    margin-bottom: 5px;
}

.detail-item div:last-child {
    font-size: 1.4em;
    font-weight: bold;
    color: var(--text-color-light);
}

.favorite-cities {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 100px;
}

.favorite-city-item {
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.favorite-city-item span {
    flex-grow: 1;
    padding-right: 10px;
    cursor: pointer;
}

.favorite-city-item .remove-btn {
    background: none;
    border: none;
    color: var(--text-color-dark);
    font-weight: bold;
    cursor: pointer;
    font-size: 1.2em;
    padding: 0 5px;
    transition: color 0.2s ease;
}

.favorite-city-item .remove-btn:hover {
    color: var(--secondary-color);
}

.favorite-city-item:hover {
    background-color: var(--primary-color);
    color: var(--background-dark);
}

.favorite-city-item:hover .remove-btn {
    color: var(--background-dark);
}

.no-favorites {
    text-align: center;
    color: var(--text-color-dark);
    font-style: italic;
    padding: 20px 0;
}

.planner-warnings {
    background-color: var(--card-background-dark);
    padding: 20px;
    border-radius: var(--border-radius-base);
    box-shadow: var(--box-shadow-base);
    color: var(--text-color-light);
    margin-top: 30px;
    max-height: 1000px;
    opacity: 1;
    overflow: hidden;
    transition: max-height 0.5s ease, opacity 0.4s ease, margin-top 0.5s ease, padding 0.5s ease;
}

.planner-warnings h3 {
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.planner-warnings.hidden {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.warning-item {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    border-left: 4px solid var(--secondary-color);
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-color-light);
}

.warning-title {
    font-weight: bold;
    color: var(--secondary-color);
    margin-bottom: 4px;
    font-size: 0.9em;
}

.warning-level-danger {
    background-color: var(--planner-danger-bg);
    border-left-color: var(--planner-danger-text);
    color: var(--planner-danger-text);
}

.warning-level-danger .warning-title {
    color: var(--planner-danger-text);
}

.warning-level-warning {
    background-color: var(--planner-warning-bg);
    border-left-color: var(--planner-warning-text);
    color: var(--planner-warning-text);
}

.warning-level-warning .warning-title {
    color: var(--planner-warning-text);
}

.warning-level-success {
    background-color: var(--planner-success-bg);
    border-left-color: var(--planner-success-text);
    color: var(--planner-success-text);
}

.warning-level-success .warning-title {
    color: var(--planner-success-text);
}

.no-warning {
    font-size: 0.95em;
    padding: 5px 0;
    color: var(--text-color-dark);
}

footer {
    padding: 20px 20px;
    margin-top: 50px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
    font-size: 0.8em;
    color: var(--text-color-dark);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.footer-content .version {
    font-weight: 600;
    color: var(--secondary-color);
}

.space-apps-logo img {
    height: 35px;
    width: auto;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.space-apps-logo .light-logo {
    display: none;
}

.space-apps-logo .dark-logo {
    display: block;
}

.light-mode .space-apps-logo .light-logo {
    display: block;
}

.light-mode .space-apps-logo .dark-logo {
    display: none;
}

.space-apps-logo img:hover {
    opacity: 1;
}

@media (max-width: 600px) {
    .container {
        padding: 0 10px;
    }

    .main-content {
        grid-template-columns: 1fr;
    }

    .weather-details {
        grid-template-columns: 1fr;
    }

    header {
        flex-direction: column;
        align-items: center;
        padding: 15px 0;
        gap: 15px;
    }

    .team-logo {
        height: 60px;
        width: auto;
        margin-right: 0;
        margin-bottom: 5px;
    }

    .logo {
        font-size: 1.5em;
        margin-bottom: 0;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .space-apps-logo img {
        height: 40px;
        width: auto;
        margin: 5px;
    }

    .search-input,
    .date-input,
    .search-btn {
        width: 100%;
        box-sizing: border-box;
        font-size: 1em;
    }

    .controls {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        margin-left: 0;
        justify-content: center;
    }

    .controls button {
        font-size: 0.85em;
    }

    .search-container {
        flex-direction: column;
        gap: 10px;
    }

    .refresh-btn {
        width: 100% !important;
        margin-left: 0 !important;
        margin-top: 10px;
    }

    footer {
        padding: 15px 10px;
    }

    .footer-content {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }

    .footer-content div {
        order: 2;
    }

    .footer-content .version {
        order: 1;
    }

    #cacheStatus {
        font-size: 11px;
        padding: 6px 12px;
    }
}

.empty-state-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-color-light);
    animation: fadeIn 0.5s ease-out;
}

.empty-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.9;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.empty-state-message h3 {
    font-size: 1.8em;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.empty-state-message p {
    font-size: 1.1em;
    color: var(--text-color-dark);
    max-width: 300px;
    margin: 0 auto;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.weather-data-container {
    animation: fadeIn 0.5s ease-out;
}

#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background-color: var(--card-background-dark);
    color: var(--text-color-light);
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-left: 4px solid var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 300px;
    max-width: 400px;
    animation: slideIn 0.3s ease-out forwards;
    backdrop-filter: blur(10px);
}

.toast.error {
    border-left-color: #ff5252;
}

.toast.success {
    border-left-color: #00e676;
}

.toast.info {
    border-left-color: #2979ff;
}

.toast-message {
    font-size: 0.95em;
    margin-right: 10px;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-color-dark);
    cursor: pointer;
    font-size: 1.2em;
    padding: 0;
    line-height: 1;
}

.toast-close:hover {
    color: var(--text-color-light);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

@media (max-width: 600px) {
    #toast-container {
        top: auto;
        bottom: 20px;
        right: 20px;
        left: 20px;
    }

    .toast {
        min-width: auto;
        width: 100%;
    }

    #cacheStatus {
        font-size: 11px;
        padding: 6px 12px;
    }

    .weather-main {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .temperature {
        font-size: 3.5em;
    }

    .weather-description {
        font-size: 1.5em;
        margin-left: 0;
        justify-content: center;
    }
}

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 100000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
}

.popup-content {
    background-color: var(--card-background-dark);
    color: var(--text-color-light);
    padding: 30px;
    border-radius: 16px;
    max-width: 90%;
    width: 400px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--primary-color);
    animation: scaleIn 0.3s ease-out;
    position: relative;
}

.popup-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.popup-title {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.popup-text {
    margin-bottom: 25px;
    line-height: 1.5;
    color: var(--text-color-dark);
}

.popup-close-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.popup-close-btn:hover {
    background-color: var(--secondary-color);
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}
