/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    height: 100vh;
    width: 100%;
    background: url('../images/8.jpg') no-repeat center center fixed;
    background-size: cover;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: white;
}

/* ===== STATUSBAR ===== */
.statusbar {
    height: 30px;
    width: 100%;
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.statusbar marquee {
    color: #ffffff;
    font-size: 18px;
    line-height: 30px;
}

/* ===== MAIN CONTENT ===== */
.main {
    flex: 1;
    display: flex;
    width: 100%;
    min-height: 0;
    padding: 15px 25px;
    gap: 20px;
}

/* ===== LEFT SECTION ===== */
.main .left {
    width: 24%; /* ลดลงจาก 30% เหลือ 24% (ลดลง 20%) */
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding-right: 5px;
}

.main .left::-webkit-scrollbar {
    width: 4px;
}
.main .left::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}

/* Time Widget */
.time {
    color: white;
    text-align: left;
    padding: 0 5px;
    margin-bottom: 2px;
}
.time h1 {
    font-size: 2.8em; /* ลดขนาดลง */
    font-weight: 300;
    line-height: 1.2;
}
.time p {
    font-size: 0.9em;
    opacity: 0.9;
    letter-spacing: 0.5px;
}

/* Tomorrow Widget */
.tomorrow {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 8px 12px;
    color: white;
    font-size: 0.75em;
}
.tomorrow a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
}
.tomorrow a:hover {
    text-decoration: underline;
}

/* Weather Widget - Amphoe Phan Thong */
.weather-widget {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 12px;
    color: white;
}
.location {
    font-size: 0.85em;
    margin-bottom: 5px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}
.weather-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px;
}
.weather-temp {
    font-size: 2.2em;
    font-weight: 300;
}
.weather-condition {
    font-size: 0.85em;
}
.feels-like {
    display: flex;
    gap: 12px;
    font-size: 0.8em;
    opacity: 0.9;
    margin: 5px 0;
}
.weather-details {
    display: flex;
    gap: 12px;
    font-size: 0.8em;
    opacity: 0.9;
}

/* Air Quality */
.air-quality {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.2);
}
.aqi-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    margin-bottom: 5px;
}
.aqi-bar-container {
    margin: 5px 0;
}
.aqi-bar {
    height: 3px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    position: relative;
    margin: 3px 0;
}
.aqi-fill {
    height: 100%;
    width: 60%;
    background: linear-gradient(90deg, #4caf50, #ffc107, #f44336);
    border-radius: 2px;
}
.aqi-scale {
    display: flex;
    justify-content: space-between;
    font-size: 0.6em;
    opacity: 0.7;
    margin-top: 3px;
}

/* Weather Duplicate - Kurashiki */
.weather-duplicate {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 12px;
    color: white;
}
.weather-duplicate .location {
    font-size: 0.85em;
    margin-bottom: 5px;
}
.weather-duplicate .weather-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px;
}
.weather-duplicate .weather-temp {
    font-size: 2em;
    font-weight: 300;
}
.weather-duplicate .weather-condition {
    font-size: 0.8em;
}
.weather-duplicate .weather-details {
    display: flex;
    gap: 12px;
    font-size: 0.8em;
    opacity: 0.9;
    margin: 5px 0;
}
.weather-duplicate .air-quality {
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid rgba(255,255,255,0.2);
}

/* Heading Apps */
.all {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 8px;
}
.heading {
    display: flex;
    align-items: center;
    gap: 6px;
}
.heading img {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    object-fit: cover;
}
.headingText {
    color: white;
    font-size: 0.85em;
    flex: 1;
}
.button-85 {
    padding: 4px 10px;
    background: #222;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.75em;
    cursor: pointer;
    position: relative;
    z-index: 0;
    white-space: nowrap;
}
.button-85:before {
    content: "";
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000);
    background-size: 400%;
    border-radius: 8px;
    filter: blur(5px);
    z-index: -1;
    animation: glowing 20s linear infinite;
}
@keyframes glowing {
    0% { background-position: 0 0; }
    50% { background-position: 400% 0; }
    100% { background-position: 0 0; }
}
.button-85:after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #222;
    border-radius: 6px;
    z-index: -1;
}

/* Download Section */
.download-section {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 10px;
    margin-top: 5px;
}
.download-title {
    color: white;
    font-size: 0.85em;
    margin-bottom: 8px;
    opacity: 0.9;
}
.download-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.download-item img {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    object-fit: cover;
}
.download-item span {
    color: white;
    font-size: 0.85em;
    flex: 1;
}

/* ===== RIGHT SECTION ===== */
.main .right {
    width: 76%; /* เพิ่มจาก 70% เป็น 76% */
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    padding-left: 5px;
}

.main .right::-webkit-scrollbar {
    width: 4px;
}
.main .right::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}

/* Inception Section */
.inception-section {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    width: 100%;
}
.inception-title {
    color: white;
    font-size: 1.5em;
    margin-bottom: 20px;
    font-weight: 400;
    letter-spacing: 0.5px;
}
.wallpapers-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* เปลี่ยนเป็น 5 คอลัมน์ให้ใหญ่ขึ้น */
    gap: 15px;
    width: 100%;
}
.wallpaper-item {
    aspect-ratio: 16/9;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.2);
    transition: all 0.2s;
    width: 100%;
}
.wallpaper-item:hover {
    transform: scale(1.03);
    border-color: rgba(255,255,255,0.5);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.wallpaper-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.wallpaper-item.selected {
    border-color: #007bff;
    box-shadow: 0 0 15px rgba(0,123,255,0.7);
}

/* ===== BOTTOM SECTION ===== */
.bottom {
    min-height: 90px;
    height: auto;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    padding: 8px 0;
}
.bottom .container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    max-width: 95vw;
    backdrop-filter: blur(15px);
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 18px;
    border-radius: 40px;
    gap: 8px;
}
.bottom .container .icon {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    transition: transform 0.2s;
}
.bottom .container .icon:hover {
    transform: translateY(-5px) scale(1.05);
}
.bottom .container .calender {
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.bottom .container .calender p {
    font-size: 9px;
    color: red;
    margin: 0;
    line-height: 1.2;
}
.bottom .container .calender h1 {
    font-size: 18px;
    margin: 0;
    font-weight: 400;
    color: #333;
}

/* Tooltip */
.tooltip {
    position: relative;
}
.tooltip .tooltiptext {
    visibility: hidden;
    width: 65px;
    background: rgba(0,0,0,0.8);
    color: white;
    text-align: center;
    border-radius: 4px;
    padding: 4px 0;
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    z-index: 10;
    white-space: nowrap;
}
.tooltip:hover .tooltiptext {
    visibility: visible;
}

/* Stack Container */
.stack-container {
    position: relative;
    width: 45px;
    height: 45px;
}
.fan-item {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 45px;
    height: 45px;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s;
}
.stack-container.open .fan-item {
    opacity: 1;
    pointer-events: auto;
}
.stack-container.open .fan-item:nth-child(1)  { transform: translateY(-55px); }
.stack-container.open .fan-item:nth-child(2)  { transform: translateY(-110px); }
.stack-container.open .fan-item:nth-child(3)  { transform: translateY(-165px); }
.stack-container.open .fan-item:nth-child(4)  { transform: translateY(-220px); }
.stack-container.open .fan-item:nth-child(5)  { transform: translateY(-275px); }
.stack-container.open .fan-item:nth-child(6)  { transform: translateY(-330px); }
.stack-container.open .fan-item:nth-child(7)  { transform: translateY(-385px); }
.stack-container.open .fan-item:nth-child(8)  { transform: translateY(-440px); }
.stack-container.open .fan-item:nth-child(9)  { transform: translateY(-495px); }
.stack-container.open .fan-item:nth-child(10) { transform: translateY(-550px); }
.stack-container.open .fan-item:nth-child(11) { transform: translateY(-605px); }
.stack-container.open .fan-item:nth-child(12) { transform: translateY(-660px); }

/* Admin Button */
.admin-btn {
    position: fixed;
    bottom: 15px;
    right: 15px;
    padding: 8px 15px;
    background: #333;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    z-index: 1000;
    font-size: 14px;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.admin-btn:hover {
    opacity: 1;
}

/* App Frame */
.appFrame {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1200px;
    height: 700px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(30px);
    border-radius: 10px;
    display: none;
    z-index: 2000;
    resize: both;
    overflow: hidden;
    box-shadow: 0 5px 30px rgba(0,0,0,0.3);
}
.appFrame .bar {
    height: 40px;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
}
.appFrame .control {
    display: flex;
    gap: 8px;
    padding-left: 15px;
}
.appFrame .control div {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
}
.appFrame .appName {
    flex: 1;
    text-align: center;
    color: white;
    font-weight: 500;
}
.appFrame iframe {
    width: 100%;
    height: calc(100% - 40px);
    border: none;
}

/* Responsive */
@media (max-width: 1400px) {
    .main .left {
        width: 26%;
    }
    .main .right {
        width: 74%;
    }
    .wallpapers-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1200px) {
    .main {
        padding: 10px 15px;
    }
    .main .left {
        width: 28%;
    }
    .main .right {
        width: 72%;
    }
    .wallpapers-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .main {
        flex-direction: column;
    }
    .main .left,
    .main .right {
        width: 100%;
    }
    .wallpapers-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .tomorrow {
        zoom: 0.85;
    }
}

@media (max-width: 600px) {
    body {
        overflow-y: auto;
        height: auto;
        min-height: 100vh;
    }
    .main {
        padding: 10px;
        gap: 10px;
    }
    .main .left,
    .main .right {
        overflow-y: visible;
    }
    .time h1 {
        font-size: 2em;
    }
    /* Weather widget renders as a tall fixed-size card on narrow
       screens - scale it down as a whole so it stays proportional
       instead of dominating the viewport. */
    .tomorrow {
        zoom: 0.65;
    }
    .wallpapers-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    .inception-section {
        padding: 12px;
    }
    .bottom .container {
        gap: 4px;
        padding: 8px 12px;
    }
    .bottom .container .icon {
        width: 38px;
        height: 38px;
    }
    .appFrame {
        width: 95vw;
        height: 85vh;
    }
}