* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
    background-color: #000;
    color: white;
    height: 100vh;
    width: 100vw;
}

/* --- Orientation Lock --- */
#orientation-lock {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 10000;
    display: none; /* Hidden by default */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

#orientation-lock h1 {
    font-size: 2rem;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

#orientation-lock .icon {
    font-size: 4rem;
    animation: rotate-phone 2s infinite;
}

/* Show only on portrait */
@media screen and (orientation: portrait) {
    #orientation-lock {
        display: flex;
    }
}

/* --- Login Screen --- */
#login-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Default Mac-like background */
    background: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)), url('/assets/img/sfondologin.webp');
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 1s ease;
}

.user-avatar {
    width: 100px;
    height: 100px;
    background-color: #f0f0f0;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.user-name {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.input-group {
    position: relative;
    width: 280px;
    max-width: 90%;
}

.password-input {
    width: 100%;
    padding: 10px 40px 10px 40px; /* Balanced padding */
    border-radius: 20px;
    border: none;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 14px;
    outline: none;
    transition: background 0.3s;
    text-align: center; /* Centered text */
}

.password-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.password-input:focus {
    background: rgba(255, 255, 255, 0.5);
}

.submit-arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.submit-arrow:hover {
    opacity: 1;
}

.hint-text {
    margin-top: 15px;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.8);
    font-style: italic;
    background: rgba(0,0,0,0.2);
    padding: 5px 10px;
    border-radius: 10px;
}

/* --- Desktop --- */
#desktop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none; /* Hidden until logged in */
    /* Background Image with Dark Overlay */
    background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), url('/assets/img/sfondo.jpg');
    background-size: cover;
    background-position: center;
    animation: scale-in 0.5s ease-out forwards;
    padding: 20px;
    overflow: hidden; /* Prevent scrolling */
}

.desktop-grid {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-content: flex-start;
    height: calc(100% - 80px); /* Leave space for taskbar */
    gap: 20px;
    padding-top: 20px;
}

.desktop-icon {
    width: 140px; /* Extended width for longer names */
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    text-align: center;
    transition: transform 0.2s, background 0.2s;
    padding: 10px;
    border-radius: 5px;
}

/* Special positioning for Trash */
.desktop-icon.trash-icon {
    position: absolute;
    bottom: 90px; /* Above taskbar */
    right: 20px;
    margin: 0;
}

.desktop-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.desktop-icon .icon-img {
    font-size: 3rem;
    margin-bottom: 5px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.desktop-icon .icon-label {
    color: white;
    font-size: 0.8rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    word-break: break-word;
    line-height: 1.2;
    background: rgba(0,0,0,0.2);
    padding: 2px 5px;
    border-radius: 4px;
}

/* --- Taskbar (Pink Glass) --- */
.taskbar {
    position: absolute;
    bottom: 15px; /* Floating from bottom */
    left: 50%;
    transform: translateX(-50%);
    width: 90%; /* Shorter width (Dock style) */
    max-width: 800px;
    height: 60px; /* Slightly taller for date */
    background: rgba(255, 182, 193, 0.4); /* Pink tint */
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px; /* Rounded corners */
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.start-menu-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1.5rem;
    transition: background 0.2s;
}

.start-menu-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

.taskbar-spacer {
    flex-grow: 1;
}

.system-tray {
    display: flex;
    align-items: center;
    gap: 15px;
}

.tray-icon {
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.9;
    transition: transform 0.2s;
}

.tray-icon:hover {
    transform: scale(1.1);
    opacity: 1;
}

.clock {
    font-size: 0.9rem;
    font-weight: 500;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    margin-left: 10px;
    text-align: right;
    line-height: 1.1;
}

.clock-time {
    font-size: 1rem;
    font-weight: bold;
}

.clock-date {
    font-size: 0.7rem;
    opacity: 0.9;
}

@keyframes scale-in {
    0% { transform: scale(0.95); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* --- Animations --- */
@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

@keyframes rotate-phone {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(90deg); }
    75% { transform: rotate(90deg); }
    100% { transform: rotate(0deg); }
}

.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* --- Glitch Effect --- */
@keyframes glitch-skew {
    0% { transform: skew(0deg); }
    10% { transform: skew(-5deg); }
    20% { transform: skew(5deg); }
    30% { transform: skew(-5deg); }
    40% { transform: skew(5deg); }
    50% { transform: skew(0deg); }
    100% { transform: skew(0deg); }
}

@keyframes glitch-color {
    0% { filter: hue-rotate(0deg); }
    10% { filter: hue-rotate(90deg) contrast(200%); }
    20% { filter: hue-rotate(-90deg) contrast(200%); }
    30% { filter: hue-rotate(90deg) contrast(200%); }
    40% { filter: hue-rotate(-90deg) contrast(200%); }
    50% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(0deg); }
}

body.glitch-active {
    animation: glitch-skew 0.3s infinite, glitch-color 0.2s infinite;
}

body.glitch-active .desktop-icon,
body.glitch-active .taskbar {
    display: none !important;
}

/* --- Slideshow Overlay --- */
#slideshow-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: black;
    z-index: 9999; /* Max Z-Index to ensure visibility */
    display: none; /* Hidden by default */
    overflow: hidden;
}

#slideshow-content {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10000; /* Ensure content is above overlay bg */
}

#slide-img, #slide-video {
    max-width: 100vw;
    max-height: 100vh;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- Scrolling Text --- */
#slideshow-text-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none; /* Shown at the end */
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.7); /* Dark patina */
    z-index: 2001;
    overflow: hidden;
}

#slideshow-text {
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    width: 90%; /* Wider width */
    left: 50%; /* Center horizontally */
    transform: translateX(-50%); /* Center horizontally */
    line-height: 1.6;
    position: absolute;
    bottom: -100%; /* Start below screen */
    animation: scrollText 60s linear forwards; /* Matches JS, just in case */
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    white-space: pre-wrap; /* Preserve line breaks */
}

@keyframes scrollText {
    0% { bottom: -100%; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { bottom: 120%; opacity: 0; }
}
#notification-banner {
    position: fixed;
    top: -100px; /* Hidden by default */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    color: white;
    padding: 15px 30px;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: top 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#notification-banner.show {
    top: 20px;
}
