/* Apple-style Dashboard CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #f5f5f7;
    color: #1d1d1f;
    line-height: 1.5;
    position: relative;
    overflow: hidden;
    height: 100%;
    margin: 0;
    padding: 0;
}

/* Light Leak Background Animation */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(125deg, rgba(255,0,150,0.05), rgba(0,150,255,0), rgba(0,255,200,0.05));
    z-index: -1;
    opacity: 0.5;
    animation: lightLeak 15s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes lightLeak {
    0% {
        background-position: 0% 0%;
        filter: hue-rotate(0deg);
    }
    50% {
        background-position: 100% 100%;
        filter: hue-rotate(180deg);
    }
    100% {
        background-position: 0% 0%;
        filter: hue-rotate(360deg);
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.theme-toggle {
    margin-left: 15px;
}

.theme-toggle button {
    background: none;
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.theme-toggle button:hover {
    background-color: rgba(255, 255, 255, 0.9);
    transform: scale(1.05);
}

.theme-toggle svg {
    fill: #1d1d1f;
    transition: all 0.3s ease;
}

.sun-icon {
    display: none;
}

.moon-icon {
    display: block;
}

.logo svg {
    width: 160px;
    height: 32px;
    transition: all 0.3s ease;
}

.city-selector select {
    font-family: 'SF Pro Display', sans-serif;
    font-size: 16px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #1d1d1f;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.city-selector select:hover {
    background-color: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.2);
}

/* Main Content Styles */
main {
    flex: 1;
    padding: 15px 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    overflow: hidden;
}

/* Time Section */
.time-section {
    text-align: center;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.time {
    font-size: 3.5rem;
    font-weight: 300;
    letter-spacing: -1px;
    margin-bottom: 5px;
}

.date {
    font-size: 1.2rem;
    color: #86868b;
}

/* Weather Section */
.weather-section {
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.weather-card {
    display: flex;
    align-items: center;
    gap: 15px;
}

.weather-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.weather-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.temperature {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 2px;
}

.condition {
    font-size: 1.1rem;
    margin-bottom: 2px;
}

.location {
    font-size: 1rem;
    color: #86868b;
}

/* News Section */
.news-section {
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 100%;
}

.news-section h2 {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 10px;
}

.news-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    overflow-y: auto;
    flex: 1;
}

.news-item {
    display: flex;
    gap: 10px;
    padding: 10px;
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.05);
    min-height: 0;
}

.news-item:hover {
    background-color: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.news-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.news-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.news-title {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 5px;
    line-height: 1.3;
}

.news-description {
    font-size: 0.85rem;
    color: #515154;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.news-source {
    font-size: 0.75rem;
    color: #86868b;
    margin-top: auto;
}

.loading-news {
    text-align: center;
    padding: 10px;
    color: #86868b;
}

/* Footer Styles */
footer {
    text-align: center;
    padding: 10px 0;
    color: #86868b;
    font-size: 0.8rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

/* Dark Mode Styles */
body.dark-mode {
    background-color: #000;
    color: #f5f5f7;
}

body.dark-mode::before {
    background: linear-gradient(125deg, rgba(100,0,150,0.1), rgba(0,50,100,0), rgba(0,100,150,0.1));
    opacity: 0.3;
}

body.dark-mode .logo svg .cls-2 {
    fill: #4a5ca8;
}

body.dark-mode .logo svg .cls-1 {
    fill: #ff8b5a;
}

body.dark-mode .time-section,
body.dark-mode .weather-section,
body.dark-mode .news-section {
    background-color: rgba(30, 30, 30, 0.8);
}

body.dark-mode .city-selector select {
    background-color: rgba(30, 30, 30, 0.8);
    color: #f5f5f7;
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .city-selector select:hover {
    background-color: rgba(40, 40, 40, 0.9);
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .news-item {
    background-color: rgba(40, 40, 40, 0.5);
    border-color: rgba(255, 255, 255, 0.05);
}

body.dark-mode .news-item:hover {
    background-color: rgba(50, 50, 50, 0.9);
}

body.dark-mode .theme-toggle button {
    background-color: rgba(40, 40, 40, 0.8);
}

body.dark-mode .theme-toggle button:hover {
    background-color: rgba(50, 50, 50, 0.9);
}

body.dark-mode .theme-toggle svg {
    fill: #f5f5f7;
}

body.dark-mode .sun-icon {
    display: block;
}

body.dark-mode .moon-icon {
    display: none;
}

/* System Dark Mode Support (fallback) */
@media (prefers-color-scheme: dark) {
    body:not(.light-mode):not(.dark-mode) {
        background-color: #000;
        color: #f5f5f7;
    }
    
    body:not(.light-mode):not(.dark-mode) .logo svg {
        fill: #f5f5f7;
    }
    
    body:not(.light-mode):not(.dark-mode) .time-section,
    body:not(.light-mode):not(.dark-mode) .weather-section,
    body:not(.light-mode):not(.dark-mode) .news-section {
        background-color: rgba(30, 30, 30, 0.8);
    }
    
    body:not(.light-mode):not(.dark-mode) .city-selector select {
        background-color: rgba(30, 30, 30, 0.8);
        color: #f5f5f7;
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    body:not(.light-mode):not(.dark-mode) .city-selector select:hover {
        background-color: rgba(40, 40, 40, 0.9);
        border-color: rgba(255, 255, 255, 0.2);
    }
    
    body:not(.light-mode):not(.dark-mode) .news-item {
        background-color: rgba(40, 40, 40, 0.5);
        border-color: rgba(255, 255, 255, 0.05);
    }
    
    body:not(.light-mode):not(.dark-mode) .news-item:hover {
        background-color: rgba(50, 50, 50, 0.9);
    }
    
    body:not(.light-mode):not(.dark-mode) .theme-toggle .sun-icon {
        display: block;
    }
    
    body:not(.light-mode):not(.dark-mode) .theme-toggle .moon-icon {
        display: none;
    }
}

/* Responsive Design */
@media (min-width: 768px) {
    main {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto 1fr;
        grid-template-areas: 
            "time weather"
            "news news";
    }
    
    .time-section {
        grid-area: time;
    }
    
    .weather-section {
        grid-area: weather;
    }
    
    .news-section {
        grid-area: news;
    }
    
    .news-container {
        grid-template-columns: repeat(2, 1fr);
        max-height: 100%;
    }
}

@media (min-width: 1024px) {
    .news-container {
        grid-template-columns: repeat(3, 1fr);
    }
}
