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

body {
    background: #000 url('/media/images/background.jpg') repeat; /* Black background with image overlay */
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Changed from center to shift layout lower */
    overflow: hidden;
    background-size: cover;
    background-position: center;
    touch-action: none;
    background-attachment: fixed;
    transition: background-image 0.5s ease;
    color: #fff;
}

/* Home Screen */
.home-screen {
    width: 100%;
    max-width: 400px;
    height: auto;
    display: flex;
    flex-direction: column;
    padding: 20px;
    min-height: 100vh;
    margin-top: 20px; /* Added to lower the layout slightly */
}

/* Widgets (General Styling) */
.widget {
    background: #000;
    border-radius: 20px;
    color: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.picture-widget {
    width: 160px; /* Increased from 150px for larger appearance */
    height: 160px;
    background: #000;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-size: cover;
    background-position: center;
}

/* Widget 1 */
#widget1 {
    background-image: url('/media/images/widget1.jpeg');
}

/* Widget 2 */
#widget2 {
    background-image: url('/media/images/widget2.jpeg');
}

/* Calendar Widget */
.calendar-widget {
    width: 100%;
    max-width: 360px; /* Increased from 350px for larger appearance */
    height: 220px; /* Increased from 200px for larger appearance */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    margin: 10px auto;
    background: #000; /* Changed to black */
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    overflow: hidden;
}

.current-date {
    display: flex;
    align-items: center;
    gap: 10px;
}

.current-date p {
    font-size: 26px; /* Increased from 24px for larger appearance */
    font-weight: bold;
}

.calendar {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.month {
    font-size: 20px; /* Increased from 18px for larger appearance */
    font-weight: bold;
    margin-bottom: 5px;
    text-align: center;
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    font-size: 14px; /* Increased from 12px for larger appearance */
    font-weight: bold;
    color: #aaa;
    margin-bottom: 5px;
}

.days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    flex-grow: 1;
    max-height: 110px; /* Increased from 100px for larger appearance */
    overflow-y: auto;
}

.days div {
    padding: 4px;
    text-align: center;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px; /* Increased from 12px for larger appearance */
}

.days div.today {
    background-color: #fff;
    color: #000;
    font-weight: bold;
}

/* Widgets and App Layout */
.widgets-app-layout {
    width: 95%;
    max-width: 360px; /* Increased from 350px for larger appearance */
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    margin: 0 auto 20px; /* Increased margin-bottom to 20px for more space above dock */
}

/* Left Column */
.left-column {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

/* Right Column */
.right-column {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Changed from flex-end to align with left-column */
    gap: 10px;
}

/* App Groups */
.app-group {
    display: grid;
    grid-template-columns: repeat(2, 75px); /* Increased from 70px for larger appearance */
    grid-template-rows: repeat(2, 75px);
    gap: 10px;
}

.app {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    background: #000;
    border-radius: 15px;
    width: 75px;
    height: 75px;
}

.app img {
    width: 75px;
    height: 75px;
    border-radius: 15px;
}

/* Dock */
.dock {
    width: 95%;
    max-width: 360px; /* Increased from 350px for larger appearance */
    background: rgba(0, 0, 0, 0.8);
    border-radius: 15px;
    display: flex;
    justify-content: space-around;
    padding: 10px;
    margin: 0 auto 10px;
}

.dock .app {
    width: 65px; /* Increased from 60px for larger appearance */
    height: 65px;
}

.dock .app img {
    width: 65px;
    height: 65px;
}

/* Spacer */
.spacer {
    height: 0;
    visibility: hidden;
}

/* Remove unused styles */
.content-wrapper,
.content-row,
.app-groups,
.app-container {
    display: none;
}

/* Ensure home-screen is positioned relatively */
.home-screen {
    position: relative;
    z-index: 1;
}

/* Glowing Effect with Bottom Under Dock */
.home-screen.glow-trace::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: 30px; /* Pulled up to sit slightly under the dock */
    border: 4px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8), 0 0 30px rgba(255, 255, 255, 0.5);
    border-radius: 30px;
    opacity: 0;
    animation: traceGlow 4s ease-in-out infinite;
    z-index: 9998;
    pointer-events: none;
}

/* Ensure interactive elements stay above glow */
.app, .widget, .dock, .calendar-widget {
    position: relative;
    z-index: 9999;
}

@keyframes traceGlow {
    0% { opacity: 0; transform: scale(0.97); }
    50% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.97); }
}

/* Mobile Optimization */
@media (max-width: 400px) {
    .home-screen {
        padding: 10px;
        max-width: 320px;
        margin-top: 15px; /* Slightly smaller margin for smaller screens */
    }
    .calendar-widget, .widgets-app-layout, .dock {
        width: 95%;
        max-width: 320px;
    }
    .calendar-widget {
        height: 200px; /* Adjusted for smaller screens */
    }
    .picture-widget {
        width: 130px; /* Adjusted for smaller screens, still square */
        height: 130px;
    }
    .app-group {
        grid-template-columns: repeat(2, 65px);
        grid-template-rows: repeat(2, 65px);
        gap: 8px;
    }
    .app, .app img {
        width: 65px;
        height: 65px;
    }
    .dock .app, .dock .app img {
        width: 55px;
        height: 55px;
    }
    .left-column, .right-column {
        gap: 8px;
    }
    .current-date p {
        font-size: 22px;
    }
    .month {
        font-size: 16px;
    }
    .weekdays {
        font-size: 12px;
    }
    .days {
        max-height: 100px;
    }
    .days div {
        font-size: 12px;
    }
}