/* --- Preloader Styles --- */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #1c1e21; /* Dark background */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    flex-direction: column;
    gap: 20px;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.preloader img {
    width: 150px;
    height: 150px;
    animation: pulse 2s infinite ease-in-out;
}

.preloader .loading-text {
    color: #f5f5f7;
    font-size: 18px;
    font-weight: 500;
    text-shadow: 0 0 5px rgba(255,255,255,0.2);
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}


/* --- General Styles --- */


body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    overflow: hidden;
    font-family: 'Vazirmatn', sans-serif;
    /* Soft dark text for light theme */
    color: #1d1d1f;
    cursor: default;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.desktop {
    height: 100%;
    width: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    background: #c9cdd1; /* A slightly darker, neutral gray */
    /* Initially hidden */
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.desktop.loaded {
    visibility: visible;
    opacity: 1;
}

/* --- Background Logo --- */
.background-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 450px;
    height: 450px;
    background-image: url('../ritmo.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.08;
    z-index: 0;
}

/* --- Top Bar --- */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 28px;
    /* Lighter, translucent top bar */
    background-color: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    color: #333; /* Dark text on light bar */
    font-size: 14px;
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08); /* Softer border */
    direction: ltr;
}

.notification-bell {
    position: relative;
    margin-right: 15px; /* Space from datetime */
    margin-left: -32px; /* Moved further to the left */
    text-decoration: none;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    top: 3px; /* Move down a few pixels */
}

.notification-bell img {
    width: 24px; /* Adjust size as needed */
    height: 24px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

.notification-bell #notification-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #ff3b30; /* Red badge */
    color: white;
    font-size: 10px;
    font-weight: bold;
    border-radius: 50%;
    padding: 3px 6px;
    min-width: 10px;
    text-align: center;
    line-height: 1;
}

.notification-bell #notification-count.hidden {
    display: none;
}

.left-menu, .right-menu {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 29px; /* Moved 20 pixels to the right */
}

.apple-logo {
    font-size: 18px;
    font-weight: 500;
    color: #333; /* Dark logo */
    text-decoration: none;
}

#datetime {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

/* --- Desktop Icons --- */
.icons {
    position: absolute;
    top: 60px;
    right: 30px;
    display: flex;
    flex-direction: row;
    gap: 15px;
    align-items: flex-start;
    z-index: 1; /* Ensure icons are above the background logo */
}

.main-icons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.secondary-icons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: #1d1d1f; /* Dark text for icons */
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
    text-decoration: none;
}

.icon:hover {
    transform: scale(1.1);
}

.icon img {
    width: 72px;
    height: 72px;
    margin-bottom: 8px;
    /* Softer shadow for light background */
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.icon span {
    font-size: 13px;
    font-weight: 500;
    /* No text shadow needed for dark text on light bg */
}

#vocabulary-icon {
    position: relative;
    left: -1px;
}

#notes-icon {
    position: relative;
    right: -6px;
}

#notes-icon span {
    position: relative;
    right: 6px;
}

#vocabulary-icon span {
    position: relative;
    left: 1px;
}

.back-btn {
    display: inline-block;
    background-color: #e9e9ed;
    color: #333;
    padding: 10px 25px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.3s;
}

.back-btn:hover {
    background-color: #dfe1e5;
}



/* --- Base for Content Windows (Stats, Help, etc.) --- */
.content-window {
    background-color: #ffffff;
    width: 100%;
    padding: 30px;
    border-radius: 24px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
    border: 1px solid #e0e0e0;
    box-sizing: border-box; /* CRITICAL for responsive layout */
}

/* --- Scrollable Page Override --- */
.scrollable-page {
    overflow-y: auto; /* Allow vertical scrolling */
}

.scrollable-page .desktop {
    height: auto; /* Allow the container to grow with content */
    min-height: 100%;
    align-items: flex-start; /* Align content to the top */
    padding-top: 60px; /* Space for the top bar */
    padding-bottom: 40px;
}

/* --- Landscape Mode Adjustments for Mobile --- */
@media (max-height: 500px) and (orientation: landscape) {
    body, html {
        overflow-y: auto; /* Allow scrolling in landscape */
    }

    .desktop {
        height: auto;
        min-height: 100vh;
        align-items: flex-start; /* Align icons to top */
        padding-top: 50px;
    }

    .icons {
        position: static; /* Remove absolute positioning */
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center; /* Center the icons */
        gap: 25px;
        padding: 20px; /* Add some padding */
        width: 100%;
    }

    .main-icons,
    .secondary-icons {
        flex-direction: row;
        gap: 25px;
        justify-content: center;
    }

    .icon {
        width: auto; /* Let it size naturally */
    }

    .background-logo {
        display: none; /* Hide logo in landscape to save space */
    }
}
