/* style.css */

:root {

    --dot-color: rgba(125, 211, 252, 0.2); 
    --glow-color: rgba(2, 132, 199, 0.2);
}

body.theme-day {
    --bg-main: #f0f9ff;
    --bg-sidebar: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --accent: #0284c7;
    --danger: #ef4444;
    --border-color: rgba(14, 165, 233, 0.15);
    --hover-color: #e0f2fe;
    --active-color: #bae6fd;
    --btn-bg: rgba(2, 132, 199, 0.1);

    --card-bg: linear-gradient(135deg, #bae6fd, #e0f2fe);
    --card-text: #0c4a6e;
    --dot-color: rgba(14, 165, 233, 0.1);
}

body.theme-night {
    --bg-main: #020617;
    --bg-sidebar: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #38bdf8;
    --danger: #f87171;
    --border-color: rgba(255, 255, 255, 0.1);
    --hover-color: #1e293b;
    --active-color: #334155;
    --btn-bg: rgba(56, 189, 248, 0.15);

    --card-bg: linear-gradient(135deg, #0f172a, #1e3a8a);
    --card-text: #f1f5f9;
    --dot-color: rgba(255, 255, 255, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    color: var(--text-main);
    background-color: var(--bg-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    height: 100vh;
    overflow: hidden;
    transition: background-color 0.5s ease, color 0.5s ease;
}

#loadingScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-main);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loadingScreen h1 {
    font-size: 46px;
    font-weight: 700;
    letter-spacing: -1px;
    position: relative;
    z-index: 2;
    opacity: 0;
    animation: charmFade 2.2s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 1;
    opacity: 0;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.4), rgba(59, 130, 246, 0.3));
    margin-right: 150px;
    margin-bottom: 100px;
    animation: blobFloat1 2.2s ease forwards;
}

.blob-2 {
    width: 350px;
    height: 350px;
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.3), rgba(125, 211, 252, 0.3));
    margin-left: 200px;
    margin-top: 150px;
    animation: blobFloat2 2.2s ease forwards;
}

@keyframes charmFade {
    0% { opacity: 0; transform: translateY(20px) scale(0.95); }
    20% { opacity: 1; transform: translateY(0) scale(1); }
    80% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-10px) scale(1.05); }
}

@keyframes blobFloat1 {
    0% { opacity: 0; transform: scale(0.8) translate(-20px, -20px); }
    30% { opacity: 1; transform: scale(1.1) translate(0, 0); }
    80% { opacity: 1; transform: scale(1) translate(10px, 10px); }
    100% { opacity: 0; transform: scale(1.2) translate(20px, 20px); }
}

@keyframes blobFloat2 {
    0% { opacity: 0; transform: scale(0.8) translate(20px, 20px); }
    30% { opacity: 1; transform: scale(1.1) translate(0, 0); }
    80% { opacity: 1; transform: scale(1) translate(-10px, -10px); }
    100% { opacity: 0; transform: scale(1.2) translate(-20px, -20px); }
}

.hide-loader {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

.sidebar {
    width: 280px;
    min-width: 250px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: background-color 0.5s ease;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 20px 15px 20px;
}

.sidebar h2 {
    font-size: 20px;
    font-weight: 600;
}

.nav-menu {
    padding: 0 10px 10px 10px;
}

.nav-item {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-item:hover {
    background: var(--hover-color);
}

.nav-item.active {
    background: var(--active-color);
    color: var(--accent);
}

.search-container {
    padding: 0 20px 15px 20px;
    position: relative;
}

#search {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-main);
    color: var(--text-main);
    outline: none;
    font-size: 14px;
    transition: border-color 0.2s ease, background-color 0.5s ease;
}

#search:focus {
    border-color: var(--accent);
}

.suggestions-dropdown {
    position: absolute;
    top: calc(100% - 10px);
    left: 20px;
    right: 20px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.suggestions-dropdown.show {
    display: block;
}

.suggestion-item {
    padding: 10px 14px;
    font-size: 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.1s;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: var(--hover-color);
}

.recent-container {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    flex: 1;
}

.recent-item {
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 500;
    border-radius: 12px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.15s ease;
}

.recent-item:hover {
    background: var(--hover-color);
}

.recent-item.active {
    background: var(--active-color);
    font-weight: 600;
    color: var(--accent);
}


.editor {
    flex: 1;
    display: flex;
    padding: 40px;
    background-color: var(--bg-main);
    background-image: radial-gradient(var(--dot-color) 1.5px, transparent 1.5px);
    background-size: 32px 32px;
    transition: background-color 0.5s ease;
}

.display-card {
    background: var(--card-bg);
    color: var(--card-text);
    border: 1px solid var(--border-color);
    padding: 40px 50px;
    border-radius: 28px;
    width: 100%;
    height: 100%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: background 0.5s ease, color 0.5s ease;
    position: relative;
}

.mobile-menu-btn {
    display: none;
    align-self: flex-start;
    margin-bottom: 16px;
    padding: 0;
    background: transparent;
    border: none;
    font-size: 15px;
    font-weight: 600;
    color: var(--card-text);
    cursor: pointer;
}

.dashboard-header h1 {
    font-size: 36px;
    font-weight: 700;
}

.dashboard-header p {
    font-size: 16px;
    opacity: 0.8;
    margin-bottom: 24px;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 12px;
    opacity: 0.75;
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-section-title {
    margin-bottom: 16px;
}

.dashboard-section-title h3 {
    font-size: 20px;
    font-weight: 700;
}

.frequent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    z-index: 2;
}

.frequent-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 18px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.frequent-card:hover {
    transform: translateY(-6px);
    background: rgba(255, 255, 255, 0.22);
}

.frequent-city {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.frequent-temp {
    font-size: 20px;
    font-weight: 700;
}

.no-dashboard-data {
    font-size: 14px;
    opacity: 0.7;
    font-style: italic;
    grid-column: 1 / -1;
}

.dashboard-illustration {
    position: absolute;
    bottom: 25px;
    right: 35px;
    width: 480px;
    max-width: 55%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.9;
}

.dashboard-illustration svg {
    width: 100%;
    height: auto;
}

.animate-spin-slow {
    transform-origin: 210px 80px;
    animation: slowSpin 25s linear infinite;
}

.animate-float-delayed {
    animation: float 4s ease-in-out 1s infinite;
}

.editor-header {
    display: flex;
    justify-content: space-between; 
    margin-bottom: 24px;
}

.editor-header button {
    background: transparent;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    padding: 10px 18px;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.back-btn {
    color: var(--card-text);
    display: block;
    padding: 0;
}

.back-btn:hover {
    background: transparent;
    opacity: 0.8;
}

.delete-btn {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.delete-btn:hover {
    background: var(--danger);
    color: white;
    border-color: transparent;
    transform: translateY(-1px);
}


.weather-info {
    margin-bottom: 40px;
}

#city {
    font-size: 42px;
    font-weight: 700;
    letter-spacing: -1px;
}

.temp-wrapper {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 10px;
}

.weather-icon {
    font-size: 72px;
    line-height: 1;
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.2));
}

#temp {
    font-size: 80px;
    font-weight: 700;
    margin-top: 0;
    line-height: 1;
}

#desc {
    font-size: 18px;
    margin-top: 15px;
    font-weight: 500;
    opacity: 0.9;
}

#forecast {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: auto;
}

.forecast-day {
    flex: 1;
    min-width: 120px;
    padding: 16px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    cursor: default;
}

.forecast-day:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.1);
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.4);
}

.forecast-day div:first-child {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
    opacity: 0.8;
}

.forecast-day div:last-child {
    font-weight: 700;
    font-size: 18px;
}

.animate-float { animation: float 3s ease-in-out infinite; }
.animate-spin { animation: slowSpin 8s linear infinite; }
.animate-pulse { animation: gentlePulse 2s ease-in-out infinite; }

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}
@keyframes slowSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
@keyframes gentlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@media (max-width: 768px) {
    #loadingScreen h1 { font-size: 32px; }
    .blob-1, .blob-2 { width: 250px; height: 250px; }
    
    .sidebar {
        width: 100vw;
        min-width: 100vw;
        border-right: none;
    }

    .editor {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        padding: 0;
        transform: translateX(100%);
        transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
        z-index: 10;
    }

    .container.weather-open .editor { transform: translateX(0); }

    .display-card {
        border-radius: 0;
        border: none;
        padding: 40px 24px;
    }

    .mobile-menu-btn {
        display: block;
    }

    .dashboard-illustration {
        width: 220px;
        max-width: 60%;
        bottom: 15px;
        right: 15px;
        opacity: 0.5;
    }

    .editor-header { justify-content: space-between; }
    .back-btn { display: block; }
    #city { font-size: 36px; }
    .weather-icon { font-size: 54px; }
    #temp { font-size: 64px; }
}