/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #000033;
    color: #FFFFFF;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Keyframe Animations */
@keyframes backgroundPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes glow {
    from { text-shadow: 0 0 15px rgba(142, 169, 219, 0.5); }
    to { text-shadow: 0 0 25px rgba(142, 169, 219, 0.8); }
}

@keyframes smoothScroll {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-100%, 0, 0); }
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes flipDown {
    0% { transform: rotateX(0deg); }
    50% { transform: rotateX(-90deg); }
    100% { transform: rotateX(0deg); }
}

@keyframes flipUp {
    0% { transform: rotateX(0deg); }
    50% { transform: rotateX(90deg); }
    100% { transform: rotateX(0deg); }
}

/* Layout Containers */
.container {
    display: grid;
    grid-template-columns: 0.75fr 2.5fr 0.75fr;
    grid-template-rows: auto auto 1fr auto;
    height: 100vh;
    padding: 10px;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.left-panel, .right-panel {
    display: flex;
    flex-direction: column;
    gap: 6px;
    height: 100%;
}

.right-panel {
    display: grid;
    grid-template-rows: 200px 1fr;
}

.center-panel {
    display: flex;
    flex-direction: column;
    gap: 6px;
    height: 100%;
}

/* Header Section */
.header {
    grid-column: 1 / -1;
    text-align: left;
    background: rgba(142, 169, 219, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(142, 169, 219, 0.2);
    border-radius: 10px;
    padding: 18px 30px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Flip Clock Styles */
.flip-clock {
    display: flex;
    gap: 0;
    margin-bottom: 15px;
    justify-content: flex-start;
    align-items: center;
}

.flip-digit {
    position: relative;
    width: 87.5px;
    height: 87.5px;
    perspective: 625px;
}

.flip-card {
    position: absolute;
    width: 100%;
    height: 100%;
    background: #000033;
    border: 3.75px solid #333;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Impact', 'Arial Black', monospace;
    font-size: 3.6rem;
    font-weight: bold;
    color: #FFFFFF;
    text-shadow: 0 2.5px 5px rgba(0, 0, 0, 0.5);
    box-shadow: 
        0 10px 20px rgba(0, 0, 0, 0.4),
        inset 0 2.5px 5px rgba(255, 255, 255, 0.1),
        inset 0 -2.5px 5px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transform-style: preserve-3d;
}

.flip-card::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2.5px;
    background: #000;
    z-index: 10;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
}

.flip-card::after {
    content: '';
    position: absolute;
    inset: 3.75px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%, rgba(0, 0, 0, 0.2) 100%);
    border-radius: 6.25px;
    pointer-events: none;
}

.flip-card.flipping {
    animation: flipDown 0.6s ease-in-out;
}

.date {
    font-size: 3.6rem;
    font-weight: 700;
    opacity: 0.9;
    line-height: 1.2;
    color: #8EA9DB;
}

/* BBC Ticker */
.bbc-ticker {
    grid-column: 1 / -1;
    background: #bb1919;
    color: white;
    height: 45px;
    overflow: hidden;
    position: relative;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(187, 25, 25, 0.3);
}

.ticker-header {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: #8b0000;
    color: white;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 22.5px;
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 2;
    width: 100px;
}

.ticker-content {
    position: absolute;
    left: 100px;
    inset-block: 0;
    right: 0;
    overflow: hidden;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.ticker-content:hover {
    background: rgba(255, 255, 255, 0.05);
}

.ticker-text {
    display: inline-block;
    white-space: nowrap;
    line-height: 45px;
    font-size: 24.75px;
    font-weight: 500;
    padding-left: 100%;
    animation: smoothScroll 120s linear infinite;
    will-change: transform;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.ticker-item {
    margin-right: 60px;
    cursor: pointer;
    transition: color 0.2s ease;
    position: relative;
}

.ticker-item:hover {
    color: #ffdddd;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.ticker-breaking {
    background: #ff0000;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 18px;
    font-weight: bold;
    margin-right: 8px;
    transition: background-color 0.2s ease;
}

.ticker-category {
    background: #0066cc;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 18px;
    font-weight: bold;
    margin-right: 8px;
    transition: background-color 0.2s ease;
}

.no-connection-ticker {
    color: #ff6b6b;
    font-weight: 600;
    cursor: default;
}

/* Widget Base Styles */
.widget {
    background: rgba(142, 169, 219, 0.08);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(142, 169, 219, 0.2);
    border-radius: 10px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.widget:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.3);
    border-color: rgba(142, 169, 219, 0.4);
}

.widget-title {
    font-size: 1.6875rem;
    font-weight: 600;
    color: #8EA9DB;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 15px 18px 0 18px;
    flex-shrink: 0;
    line-height: 1.2;
}

.widget-title-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.3s ease;
}

.widget-title-link:hover {
    color: #FFFFFF;
}

.widget-content {
    flex: 1;
    padding: 9px 18px 15px 18px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Spotify Widget Specific */
.spotify-widget {
    flex: none !important;
}

/* Common Scrollbar Styles */
.stocks-container::-webkit-scrollbar,
.schedule-events::-webkit-scrollbar,
.news-container::-webkit-scrollbar {
    width: 3px;
}

.stocks-container::-webkit-scrollbar {
    width: 4px;
}

.stocks-container::-webkit-scrollbar-track,
.schedule-events::-webkit-scrollbar-track,
.news-container::-webkit-scrollbar-track {
    background: rgba(142, 169, 219, 0.1);
    border-radius: 1.5px;
}

.stocks-container::-webkit-scrollbar-track {
    border-radius: 2px;
}

.stocks-container::-webkit-scrollbar-thumb,
.schedule-events::-webkit-scrollbar-thumb,
.news-container::-webkit-scrollbar-thumb {
    background: rgba(142, 169, 219, 0.3);
    border-radius: 1.5px;
}

.stocks-container::-webkit-scrollbar-thumb {
    border-radius: 2px;
}

/* Common Interactive Elements */
.forecast-day,
.stock-item,
.schedule-day,
.news-item,
.calendar-event {
    transition: all 0.3s ease;
}

.forecast-day:hover,
.stock-item:hover,
.schedule-day:hover {
    background: rgba(142, 169, 219, 0.1);
    transform: translateY(-1px);
}

.news-item:hover {
    background: rgba(142, 169, 219, 0.1);
    border-radius: 5px;
    padding: 9px 7.5px;
}

.calendar-event:hover {
    background: rgba(142, 169, 219, 0.1);
    border-radius: 4px;
    padding: 3px;
}

/* Weather Widget */
.weather-widget {
    text-align: center;
}

.weather-location {
    font-size: 1.4625rem;
    color: #FFFFFF;
    opacity: 0.7;
    margin-bottom: 9px;
    text-align: center;
    line-height: 1.3;
}

.weather-current {
    margin-bottom: 9px;
    padding-bottom: 9px;
    border-bottom: 1px solid rgba(142, 169, 219, 0.2);
    flex-shrink: 0;
}

.weather-icon,
.forecast-icon {
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", sans-serif;
    text-rendering: optimizeQuality;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1;
    display: block;
    margin-bottom: 6px;
}

.weather-icon {
    font-size: 4.5rem;
}

.forecast-icon {
    font-size: 2.7rem;
    margin-bottom: 6px;
}

.temperature {
    font-size: 2.7rem;
    font-weight: 300;
    margin-bottom: 3px;
    line-height: 1.2;
    color: #8EA9DB;
}

.weather-desc {
    font-size: 1.4625rem;
    opacity: 0.8;
    margin-bottom: 6px;
    line-height: 1.3;
    text-transform: capitalize;
    color: #FFFFFF;
}

.weather-details {
    display: flex;
    justify-content: space-between;
    font-size: 1.35rem;
    opacity: 0.7;
    line-height: 1.3;
    color: #FFFFFF;
}

.forecast-days {
    display: flex;
    justify-content: space-between;
    gap: 4.5px;
    flex: 1;
}

.forecast-day {
    flex: 1;
    text-align: center;
    background: rgba(142, 169, 219, 0.05);
    border-radius: 5px;
    padding: 4.5px 3px;
    border: 1px solid rgba(142, 169, 219, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.forecast-day-name {
    font-size: 1.2375rem;
    font-weight: 600;
    margin-bottom: 4.5px;
    opacity: 0.9;
    text-transform: uppercase;
    line-height: 1.2;
    color: #FFFFFF;
}

.forecast-temp {
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1.2;
}

.forecast-temp-high {
    color: #8EA9DB;
}

.forecast-temp-low {
    opacity: 0.7;
    margin-left: 4.5px;
    color: #FFFFFF;
}

/* Stock Widget */
.stock-widget {
    text-align: center;
}

.stocks-container {
    display: flex;
    flex-direction: column;
    gap: 4.5px;
    flex: 1;
    overflow-y: auto;
    padding-right: 3px;
}

.stock-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(142, 169, 219, 0.05);
    border-radius: 5px;
    padding: 6px 9px;
    border: 1px solid rgba(142, 169, 219, 0.1);
}

.stock-symbol {
    font-size: 1.2375rem;
    font-weight: 600;
    color: #8EA9DB;
    text-transform: uppercase;
    line-height: 1.2;
}

.stock-info {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 1.5px;
}

.stock-price {
    font-size: 1.2375rem;
    font-weight: 600;
    color: #FFFFFF;
    line-height: 1.2;
}

.stock-change {
    font-size: 1.2375rem;
    font-weight: 600;
    line-height: 1.2;
}

.stock-positive {
    color: #00ff7f;
}

.stock-negative {
    color: #ff6b6b;
}

.stock-neutral {
    color: #FFFFFF;
    opacity: 0.7;
}

/* Schedule Widget */
.schedule-container {
    display: flex;
    gap: 7.5px;
    height: 100%;
    flex: 1;
}

.schedule-day {
    flex: 1;
    background: rgba(142, 169, 219, 0.05);
    border-radius: 6px;
    padding: 9px;
    border: 1px solid rgba(142, 169, 219, 0.1);
    display: flex;
    flex-direction: column;
}

.schedule-day-title {
    font-size: 1.4625rem;
    font-weight: 600;
    color: #8EA9DB;
    text-align: center;
    margin-bottom: 7.5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 4.5px;
    border-bottom: 1px solid rgba(142, 169, 219, 0.2);
    flex-shrink: 0;
    line-height: 1.2;
}

.schedule-events {
    flex: 1;
    overflow-y: auto;
    padding-right: 3px;
}

.calendar-event {
    display: flex;
    flex-direction: column;
    padding: 3px 0;
    border-bottom: 1px solid rgba(142, 169, 219, 0.2);
    margin-bottom: 1.5px;
}

.calendar-event:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.event-time {
    font-weight: 600;
    color: #8EA9DB;
    font-size: 1.35rem;
    margin-bottom: 1.5px;
    line-height: 1.2;
}

.event-title {
    font-size: 1.2375rem;
    line-height: 1.3;
    opacity: 0.9;
    color: #FFFFFF;
}

/* Spotify Widget */
.spotify-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
}

.spotify-player {
    display: flex;
    gap: 12px;
    align-items: center;
}

.album-art {
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(142, 169, 219, 0.1);
}

.album-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.song-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow: hidden;
}

.song-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #FFFFFF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-artist {
    font-size: 1.3125rem;
    color: #8EA9DB;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-album {
    font-size: 1.125rem;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spotify-controls {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 9px;
}

.progress-time {
    font-size: 1.125rem;
    opacity: 0.7;
    min-width: 35px;
}

.progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(142, 169, 219, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #1DB954;
    transition: width 0.3s ease;
}

.playback-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.125rem;
}

.device-info {
    opacity: 0.7;
}

.playback-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #888;
}

.status-dot.playing {
    background: #1DB954;
    animation: statusPulse 2s ease-in-out infinite;
}

.status-dot.paused {
    background: #FFA500;
}

.status-dot.stopped {
    background: #888;
}

.volume-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.7;
}

/* News Widget */
.news-container {
    display: flex;
    flex-direction: column;
    gap: 9px;
    flex: 1;
    overflow-y: auto;
    padding-right: 3px;
}

.news-item {
    cursor: pointer;
    padding: 6px 4.5px;
    border-radius: 4px;
}

.news-title {
    font-size: 1.35rem;
    font-weight: 500;
    margin-bottom: 3px;
    line-height: 1.3;
    color: #FFFFFF;
}

.news-source {
    font-size: 1.125rem;
    opacity: 0.6;
    color: #8EA9DB;
}

/* No Connection State */
.no-connection {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #ff6b6b;
    font-weight: 600;
    font-size: 1.35rem;
}

/* Footer */
.footer {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 15px;
    background: rgba(142, 169, 219, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(142, 169, 219, 0.1);
    border-radius: 6px;
    font-size: 1.2375rem;
    opacity: 0.7;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-indicator .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00ff7f;
    animation: statusPulse 2s ease-in-out infinite;
}
