/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none; /* Prevent text selection globally */
    cursor: default; /* Default cursor to avoid text cursor */
}

body {
    font-family: 'Poppins', sans-serif;
    background: #0a0f1a;
    color: #e0e8f0;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

/* Allow selection in form inputs */
input, textarea {
    user-select: text; /* Re-enable text selection for inputs */
    cursor: text; /* Text cursor for inputs */
}

/* Prevent image dragging */
img {
    -webkit-user-drag: none; /* Prevent image dragging in WebKit browsers */
    pointer-events: none; /* Disable pointer events on images */
}

/* OS Container */
.os-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
}

/* Desktop */
.desktop {
    flex: 1;
    position: relative;
    padding: 15px;
    background: url('/static/img/background.jpg') no-repeat center center/cover;
    margin-bottom: 50px; /* Match taskbar height */
}

/* Desktop Icons */
.desktop-icons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 15px;
    max-width: 100%;
    padding: 20px 10px;
}

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.3s ease, transform 0.3s ease;
    min-height: 80px; /* Ensure touch target size */
}

.desktop-icon:hover,
.desktop-icon:active {
    background: rgba(147, 112, 219, 0.3);
    transform: scale(1.05);
}

.desktop-icon img {
    width: 40px;
    height: 40px;
    margin-bottom: 6px;
    filter: drop-shadow(0 2px 4px rgba(0, 212, 255, 0.4));
}

.desktop-icon span {
    font-size: 12px;
    color: #e0e8f0;
    text-shadow: 0 1px 2px rgba(0, 212, 255, 0.3);
    word-wrap: break-word;
    max-width: 80px;
}

/* App Window */
.app-window {
    position: absolute;
    background: linear-gradient(145deg, rgba(20, 25, 40, 0.9), rgba(30, 35, 50, 0.8));
    border-radius: 12px;
    border: 1px solid rgba(147, 112, 219, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); /* Lighter shadow for mobile */
    min-width: 280px;
    min-height: 180px;
    max-width: 95%;
    max-height: 85%;
    overflow: hidden;
    z-index: 10;
    transition: transform 0.2s ease-out, width 0.2s ease-out, height 0.2s ease-out;
    will-change: transform, width, height;
}

.app-window.active {
    z-index: 100;
}

.window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(10, 15, 26, 0.95);
    border-bottom: 1px solid rgba(0, 212, 255, 0.2);
    cursor: move;
    touch-action: none; /* Prevent scrolling while dragging on mobile */
}

.window-title {
    font-size: 14px;
    color: #00d4ff;
    text-shadow: 0 1px 2px rgba(0, 212, 255, 0.3);
}

.window-controls {
    display: flex;
    gap: 4px;
}

.window-control {
    background: none;
    border: none;
    color: #e0e8f0;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.3s ease;
    min-width: 28px; /* Larger touch target */
}

.window-control:hover,
.window-control:active {
    color: #9370db;
}

.window-content {
    padding: 15px;
    overflow: auto;
    max-height: calc(100% - 40px);
}

/* System Menu */
.system-menu-container {
    position: fixed;
    bottom: 60px; /* Above taskbar */
    left: 10px;
    z-index: 1000;
}

.system-menu {
    background: rgba(10, 15, 26, 0.95);
    border-radius: 10px;
    border: 1px solid rgba(147, 112, 219, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    width: 260px;
    padding: 12px;
    color: #e0e8f0;
}

.menu-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.menu-logo {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 2px 3px rgba(0, 212, 255, 0.4));
}

.menu-header h2 {
    font-size: 16px;
    color: #00d4ff;
}

.menu-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.menu-section h3 {
    font-size: 14px;
    color: #9370db;
    margin-bottom: 8px;
}

.menu-section ul {
    list-style: none;
}

.menu-section li {
    margin-bottom: 6px;
}

.menu-section a {
    color: #e0e8f0;
    text-decoration: none;
    font-size: 12px;
    transition: color 0.3s ease;
    cursor: pointer;
    display: block;
    padding: 6px; /* Larger touch target */
}

.menu-section a:hover,
.menu-section a:active {
    color: #00d4ff;
}

/* Taskbar */
.taskbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    background: rgba(10, 15, 26, 0.9);
    box-shadow: 0 -2px 8px rgba(0, 212, 255, 0.2);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 50px;
}

.taskbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.system-icon {
    padding: 6px;
    border-radius: 6px;
    transition: background 0.3s ease, transform 0.3s ease;
    cursor: pointer;
    min-width: 40px; /* Larger touch target */
}

.system-icon img {
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 2px 3px rgba(0, 212, 255, 0.4));
}

.system-icon:hover,
.system-icon:active {
    background: rgba(147, 112, 219, 0.3);
    transform: scale(1.1);
}

.pinned-apps {
    display: flex;
    gap: 8px;
}

.app-icon {
    padding: 6px;
    border-radius: 6px;
    transition: background 0.3s ease, transform 0.3s ease;
    cursor: pointer;
    min-width: 40px; /* Larger touch target */
}

.app-icon img {
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 2px 3px rgba(0, 212, 255, 0.4));
}

.app-icon:hover,
.app-icon:active {
    background: rgba(147, 112, 219, 0.3);
    transform: scale(1.1);
}

.social-menu {
    display: flex;
    gap: 10px;
}

.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(147, 112, 219, 0.2);
    border-radius: 50%;
    color: #00d4ff;
    text-decoration: none;
    transition: background 0.3s ease, transform 0.3s ease;
    cursor: pointer;
}

.social-icon:hover,
.social-icon:active {
    background: rgba(147, 112, 219, 0.5);
    transform: scale(1.1);
}

.social-icon i {
    font-size: 16px;
}

.system-tray {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tray-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(147, 112, 219, 0.2);
    border-radius: 6px;
    color: #e0e8f0;
    cursor: pointer;
    transition: background 0.3s ease;
}

.tray-icon:hover,
.tray-icon:active {
    background: rgba(147, 112, 219, 0.5);
}

.tray-icon i {
    font-size: 14px;
}

.tray-clock {
    font-size: 12px;
    color: #e0e8f0;
    text-shadow: 0 1px 2px rgba(0, 212, 255, 0.3);
}

/* About Section Styles */
.about-section {
    text-align: center;
}

.about-logo {
    width: 120px;
    margin-bottom: 15px;
    filter: drop-shadow(0 6px 12px rgba(147, 112, 219, 0.6));
}

.about-header h1 {
    font-size: 28px;
    color: #00d4ff;
    text-shadow: 0 4px 8px rgba(0, 212, 255, 0.7);
    margin-bottom: 8px;
}

.about-tagline {
    font-size: 16px;
    color: #d8e0f0;
    margin-bottom: 20px;
}

.about-button {
    display: inline-block;
    padding: 12px 30px;
    background: linear-gradient(90deg, #9370db, #00d4ff);
    color: #fff;
    text-decoration: none;
    border-radius: 30px;
    font-weight: bold;
    box-shadow: 0 6px 15px rgba(0, 212, 255, 0.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.about-button:hover,
.about-button:active {
    transform: translateY(-6px);
    box-shadow: 0 8px 20px rgba(0, 212, 255, 0.7);
}

/* Auth Container */
.auth-container {
    max-width: 360px;
    margin: 20px auto;
    text-align: center;
}

.auth-container h1 {
    font-size: 24px;
    color: #00d4ff;
    margin-bottom: 15px;
}

.auth-container form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-container label {
    font-size: 14px;
    color: #e0e8f0;
    text-align: left;
}

.auth-container input {
    padding: 8px;
    font-size: 14px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 6px;
    background: rgba(20, 25, 40, 0.8);
    color: #e0e8f0;
}

.auth-btn {
    padding: 10px;
    background: linear-gradient(90deg, #9370db, #00d4ff);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.3s ease;
    min-height: 44px; /* Accessible touch target */
}

.auth-btn:hover,
.auth-btn:active {
    transform: translateY(-3px);
}

.oauth-buttons {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.oauth-btn {
    padding: 10px;
    font-size: 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px; /* Accessible touch target */
}

.oauth-btn.wax {
    background: #1da1f2;
}

.oauth-btn.discord {
    background: #7289da;
}

.popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(10, 15, 26, 0.95);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
    z-index: 1000;
    width: 90%;
    max-width: 320px;
}

.popup-content {
    text-align: center;
}

.popup-content h2 {
    color: #00d4ff;
    font-size: 18px;
    margin-bottom: 15px;
}

.popup-content form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Wallet Widget */
.wallet-widget {
    position: fixed;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 220px;
    background: linear-gradient(145deg, rgba(20, 25, 40, 0.9), rgba(30, 35, 50, 0.8));
    border-radius: 10px;
    border: 1px solid rgba(147, 112, 219, 0.3);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
    padding: 12px;
    z-index: 50;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.wallet-widget:hover,
.wallet-widget:active {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 6px 15px rgba(0, 212, 255, 0.5);
}

.widget-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.widget-header h3 {
    font-size: 16px;
    color: #00d4ff;
    text-shadow: 0 1px 2px rgba(0, 212, 255, 0.3);
}

.widget-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.balance-info, .wallet-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.balance-info .label, .wallet-info .label {
    font-size: 12px;
    color: #e0e8f0;
}

.balance-info .value, .wallet-info .value {
    font-size: 12px;
    color: #9370db;
    font-weight: 500;
}

.wallet-info .value {
    cursor: pointer;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.3s ease;
}

.wallet-info .value:hover,
.wallet-info .value:active {
    color: #00d4ff;
}

.widget-message {
    margin-top: 8px;
    padding: 6px;
    font-size: 11px;
    border-radius: 5px;
    text-align: center;
    transition: opacity 0.3s ease;
}

.widget-message.alert-success {
    background: rgba(0, 255, 128, 0.2);
    color: #00ff80;
}

.widget-message.alert-danger {
    background: rgba(255, 85, 85, 0.2);
    color: #ff5555;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .desktop {
        padding: 10px;
        margin-bottom: 50px;
    }

    .desktop-icons {
        grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
        gap: 12px;
        padding: 15px 8px;
    }

    .desktop-icon {
        padding: 6px;
        min-height: 70px;
    }

    .desktop-icon img {
        width: 36px;
        height: 36px;
    }

    .desktop-icon span {
        font-size: 11px;
        max-width: 70px;
    }

    .app-window {
        min-width: 90%;
        min-height: 160px;
        max-width: 98%;
        max-height: 90%;
    }

    .window-header {
        padding: 6px 10px;
    }

    .window-title {
        font-size: 13px;
    }

    .window-control {
        padding: 3px 6px;
        font-size: 11px;
        min-width: 24px;
    }

    .window-content {
        padding: 12px;
        max-height: calc(100% - 36px);
    }

    .system-menu-container {
        bottom: 55px;
        left: 8px;
    }

    .system-menu {
        width: 240px;
        padding: 10px;
    }

    .menu-logo {
        width: 28px;
        height: 28px;
    }

    .menu-header h2 {
        font-size: 14px;
    }

    .menu-section h3 {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .menu-section a {
        font-size: 11px;
        padding: 5px;
    }

    .taskbar {
        padding: 6px 10px;
        height: 50px;
    }

    .taskbar-content {
        max-width: 100%;
    }

    .system-icon {
        padding: 5px;
        min-width: 36px;
    }

    .system-icon img {
        width: 24px;
        height: 24px;
    }

    .app-icon {
        padding: 5px;
        min-width: 36px;
    }

    .app-icon img {
        width: 24px;
        height: 24px;
    }

    .social-icon {
        width: 28px;
        height: 28px;
    }

    .social-icon i {
        font-size: 14px;
    }

    .tray-icon {
        width: 24px;
        height: 24px;
    }

    .tray-icon i {
        font-size: 13px;
    }

    .tray-clock {
        font-size: 11px;
    }

    .about-logo {
        width: 100px;
        margin-bottom: 12px;
    }

    .about-header h1 {
        font-size: 24px;
    }

    .about-tagline {
        font-size: 14px;
        margin-bottom: 15px;
    }

    .about-button {
        padding: 10px 25px;
        border-radius: 25px;
    }

    .auth-container {
        max-width: 90%;
        margin: 15px auto;
    }

    .auth-container h1 {
        font-size: 20px;
        margin-bottom: 12px;
    }

    .auth-container label {
        font-size: 13px;
    }

    .auth-container input {
        padding: 7px;
        font-size: 13px;
    }

    .auth-btn {
        padding: 8px;
        font-size: 13px;
        min-height: 40px;
    }

    .oauth-btn {
        padding: 8px;
        font-size: 13px;
        min-height: 40px;
    }

    .popup {
        width: 85%;
        max-width: 280px;
        padding: 12px;
    }

    .popup-content h2 {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .wallet-widget {
        width: 200px;
        right: 8px;
        padding: 10px;
    }

    .widget-header h3 {
        font-size: 14px;
    }

    .balance-info .label, .wallet-info .label {
        font-size: 11px;
    }

    .balance-info .value, .wallet-info .value {
        font-size: 11px;
    }

    .wallet-info .value {
        max-width: 90px;
    }

    .widget-message {
        font-size: 10px;
        padding: 5px;
    }
}

/* Extra small screens (below 480px) */
@media screen and (max-width: 480px) {
    .desktop {
        padding: 8px;
        margin-bottom: 45px;
    }

    .desktop-icons {
        grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
        gap: 10px;
        padding: 10px 5px;
    }

    .desktop-icon {
        padding: 5px;
        min-height: 60px;
    }

    .desktop-icon img {
        width: 32px;
        height: 32px;
    }

    .desktop-icon span {
        font-size: 10px;
        max-width: 60px;
    }

    .app-window {
        min-width: 95%;
        min-height: 140px;
        max-height: 92%;
    }

    .window-header {
        padding: 5px 8px;
    }

    .window-title {
        font-size: 12px;
    }

    .window-control {
        padding: 2px 5px;
        font-size: 10px;
        min-width: 22px;
    }

    .window-content {
        padding: 10px;
        max-height: calc(100% - 32px);
    }

    .system-menu-container {
        bottom: 50px;
        left: 5px;
    }

    .system-menu {
        width: 220px;
        padding: 8px;
    }

    .menu-logo {
        width: 24px;
        height: 24px;
    }

    .menu-header h2 {
        font-size: 13px;
    }

    .menu-section h3 {
        font-size: 12px;
        margin-bottom: 5px;
    }

    .menu-section a {
        font-size: 10px;
        padding: 4px;
    }

    .taskbar {
        padding: 5px 8px;
        height: 45px;
    }

    .system-icon {
        padding: 4px;
        min-width: 32px;
    }

    .system-icon img {
        width: 22px;
        height: 22px;
    }

    .app-icon {
        padding: 4px;
        min-width: 32px;
    }

    .app-icon img {
        width: 22px;
        height: 22px;
    }

    .social-icon {
        width: 26px;
        height: 26px;
    }

    .social-icon i {
        font-size: 13px;
    }

    .tray-icon {
        width: 22px;
        height: 22px;
    }

    .tray-icon i {
        font-size: 12px;
    }

    .tray-clock {
        font-size: 10px;
    }

    .about-logo {
        width: 80px;
        margin-bottom: 10px;
    }

    .about-header h1 {
        font-size: 20px;
    }

    .about-tagline {
        font-size: 12px;
        margin-bottom: 12px;
    }

    .about-button {
        padding: 8px 20px;
        border-radius: 20px;
        font-size: 12px;
    }

    .auth-container {
        max-width: 95%;
        margin: 10px auto;
    }

    .auth-container h1 {
        font-size: 18px;
        margin-bottom: 10px;
    }

    .auth-container label {
        font-size: 12px;
    }

    .auth-container input {
        padding: 6px;
        font-size: 12px;
    }

    .auth-btn {
        padding: 7px;
        font-size: 12px;
        min-height: 36px;
    }

    .oauth-btn {
        padding: 7px;
        font-size: 12px;
        min-height: 36px;
    }

    .popup {
        width: 90%;
        max-width: 260px;
        padding: 10px;
    }

    .popup-content h2 {
        font-size: 14px;
        margin-bottom: 10px;
    }

    .wallet-widget {
        width: 180px;
        right: 5px;
        padding: 8px;
    }

    .widget-header h3 {
        font-size: 13px;
    }

    .balance-info .label, .wallet-info .label {
        font-size: 10px;
    }

    .balance-info .value, .wallet-info .value {
        font-size: 10px;
    }

    .wallet-info .value {
        max-width: 80px;
    }

    .widget-message {
        font-size: 9px;
        padding: 4px;
    }
}