* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl;
    overflow: hidden;
}

/* Login Page */
.login-page {
    background: #003366;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 400px;
}

.auth-box {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.auth-box h1 {
    text-align: center;
    color: #003366;
    margin-bottom: 30px;
    font-size: 2em;
}

.form-section {
    display: none;
}

.form-section.active {
    display: block;
}

.form-section h2 {
    margin-bottom: 20px;
    color: #333;
}

.form-section input,
.form-section textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-section input:focus,
.form-section textarea:focus {
    outline: none;
    border-color: #003366;
}

.form-section textarea {
    min-height: 80px;
    resize: vertical;
}

.form-section button {
    width: 100%;
    padding: 12px;
    background: #003366;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.form-section button:hover {
    background: #004080;
}

.form-section button:active {
    transform: scale(0.98);
}

.switch-form {
    text-align: center;
    margin-top: 15px;
    color: #666;
}

.switch-form a {
    color: #003366;
    text-decoration: none;
    font-weight: bold;
}

.message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    display: none;
}

.message.success {
    background: #e6f2ff;
    color: #003366;
    border: 1px solid #003366;
    display: block;
}

.message.error {
    background: #ffe6e6;
    color: #003366;
    border: 1px solid #003366;
    display: block;
}

/* Game Page */
.game-page {
    background: #000;
    position: relative;
}

#game-container {
    width: 100vw;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
}

.ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.ui-overlay > * {
    pointer-events: auto;
}

.top-bar {
    background: #003366;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.player-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#calories-display {
    font-size: 0.9em;
    color: #ffffff;
    opacity: 0.9;
}

.menu-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 24px;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.menu-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.side-menu {
    position: fixed;
    right: -300px;
    top: 0;
    width: 300px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.3);
    transition: right 0.3s;
    z-index: 200;
}

.side-menu.open {
    right: 0;
}

.menu-header {
    background: #003366;
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-header button {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

.menu-content {
    padding: 20px;
}

.menu-content button {
    width: 100%;
    padding: 15px;
    margin-bottom: 10px;
    background: white;
    border: 1px solid #003366;
    border-radius: 10px;
    font-size: 16px;
    text-align: right;
    cursor: pointer;
    transition: all 0.3s;
    color: #003366;
}

.menu-content button:hover {
    background: #003366;
    color: white;
}

.menu-content button:active {
    background: #004080;
    color: white;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 300;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-header {
    background: #003366;
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 20px 20px 0 0;
}

.modal-header button {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.add-food-section {
    background: #f8f9fa;
    border: 1px solid #003366;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.add-food-section input,
.add-food-section select {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #003366;
    border-radius: 5px;
}

.add-food-section input:focus,
.add-food-section select:focus {
    outline: none;
    border-color: #003366;
    border-width: 2px;
}

.add-food-section button {
    width: 100%;
    padding: 10px;
    background: #003366;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.add-food-section button:hover {
    background: #004080;
}

.food-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.food-item {
    background: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid #003366;
}

.food-item:hover {
    background: #003366;
    color: white;
    transform: translateY(-2px);
}

.food-item:active {
    transform: scale(0.95);
}

.food-item .food-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.food-item .food-calories {
    color: #003366;
    font-size: 0.9em;
}

.food-item:hover .food-calories {
    color: white;
}

#stats-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.stat-item {
    background: white;
    border: 1px solid #003366;
    padding: 15px;
    border-radius: 10px;
}

.stat-item label {
    font-weight: bold;
    color: #003366;
}

#players-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.player-card {
    background: white;
    padding: 15px;
    border-radius: 10px;
    border-right: 4px solid #003366;
}

.player-card.consultant {
    border-right-color: #003366;
    background: #e6f2ff;
}

.player-card h3 {
    margin-bottom: 10px;
}

.player-card .consultant-badge {
    background: #003366;
    color: white;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 0.8em;
    margin-right: 10px;
}

.chat-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: 400px;
    background: white;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
    max-height: 50vh;
    display: flex;
    flex-direction: column;
}

.chat-header {
    background: #003366;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-radius: 20px 20px 0 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    max-height: 300px;
    display: none;
}

.chat-messages.open {
    display: block;
}

.chat-message {
    margin-bottom: 10px;
    padding: 10px;
    background: white;
    border: 1px solid #003366;
    border-radius: 10px;
}

.chat-message .username {
    font-weight: bold;
    color: #003366;
    font-size: 0.9em;
}

.chat-input-container {
    display: none;
    padding: 10px;
    border-top: 1px solid #e0e0e0;
}

.chat-input-container.open {
    display: flex;
    gap: 10px;
}

.chat-input-container input {
    flex: 1;
    padding: 10px;
    border: 1px solid #003366;
    border-radius: 5px;
}

.chat-input-container input:focus {
    outline: none;
    border-width: 2px;
}

.chat-input-container button {
    padding: 10px 20px;
    background: #003366;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.chat-input-container button:hover {
    background: #004080;
}

.disclosure {
    position: fixed;
    bottom: 0;
    right: 0;
    background: #003366;
    color: white;
    padding: 10px;
    font-size: 0.7em;
    max-width: 300px;
    z-index: 50;
    border-radius: 10px 0 0 0;
    opacity: 0.9;
}

.plan-item {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    border-right: 4px solid #003366;
    border: 1px solid #003366;
}

.plan-item h4 {
    margin-bottom: 10px;
    color: #003366;
}

.plan-item small {
    color: #666;
    font-size: 0.8em;
}

.settings-section {
    background: white;
    border: 1px solid #003366;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.settings-section h3 {
    margin-bottom: 15px;
    color: #003366;
}

.settings-section label {
    display: block;
    margin-bottom: 10px;
    cursor: pointer;
}

.settings-section textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #003366;
    border-radius: 5px;
    min-height: 80px;
    margin-bottom: 10px;
}

.settings-section textarea:focus {
    outline: none;
    border-width: 2px;
}

.settings-section button {
    padding: 10px 20px;
    background: #003366;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.settings-section button:hover {
    background: #004080;
}

/* Mobile Touch Support */
@media (max-width: 768px) {
    .food-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .chat-container {
        max-width: 100%;
    }
    
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
}

/* Touch-friendly buttons */
button, .food-item {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Virtual Joystick */
#joystick-area {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 150px;
    height: 150px;
    background: rgba(0, 51, 102, 0.3);
    border: 3px solid #003366;
    border-radius: 50%;
    z-index: 1000;
    touch-action: none;
    pointer-events: auto;
    backdrop-filter: blur(5px);
}

#joystick-handle {
    position: absolute;
    width: 60px;
    height: 60px;
    background: #003366;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    border: 2px solid white;
}

/* Notifications */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 10px;
    z-index: 10000;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease-out;
    max-width: 300px;
}

.notification.success {
    background: #003366;
    color: white;
    border: 2px solid white;
}

.notification.info {
    background: #003366;
    color: white;
    border: 2px solid white;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Movement Instructions */
.movement-instructions {
    position: fixed;
    top: 50%;
    right: 50%;
    transform: translate(50%, -50%);
    background: white;
    color: #003366;
    padding: 30px;
    border-radius: 20px;
    z-index: 10000;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: fadeIn 0.3s ease-out;
    border: 3px solid #003366;
}

.movement-instructions.hidden {
    display: none;
}

.instructions-content h3 {
    margin-bottom: 15px;
    color: #003366;
    text-align: center;
}

.instructions-content p {
    margin-bottom: 10px;
    line-height: 1.6;
}

.instructions-content button {
    width: 100%;
    padding: 12px;
    background: #003366;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
    transition: background 0.3s;
}

.instructions-content button:hover {
    background: #004080;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(50%, -50%) scale(1);
    }
}

/* Context Menu */
#context-menu {
    position: fixed;
    background: white;
    border: 2px solid #003366;
    border-radius: 10px;
    padding: 10px;
    z-index: 10000;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    min-width: 150px;
    direction: rtl;
}

#context-menu > div {
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 5px;
    color: #003366;
    font-weight: bold;
    transition: background 0.2s;
    margin-bottom: 5px;
}

#context-menu > div:last-child {
    margin-bottom: 0;
}

#context-menu > div:hover {
    background: #003366;
    color: white;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    #joystick-area {
        width: 120px;
        height: 120px;
        bottom: 15px;
        left: 15px;
    }
    
    #joystick-handle {
        width: 50px;
        height: 50px;
    }
    
    .notification {
        right: 10px;
        top: 70px;
        font-size: 14px;
        padding: 12px 16px;
    }
    
    .movement-instructions {
        max-width: 90%;
        padding: 20px;
    }
}

