/* styles.css - Enhanced with fixes for overlays and modals */

/* Base Styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f8e8;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    min-height: 100vh;
}

h1 {
    color: #4CAF50;
    text-align: center;
    margin-bottom: 20px;
}

/* Game Layout */
.game-layout {
    display: flex;
    flex-direction: row;
    gap: 20px;
    margin-bottom: 20px;
}

.side-panel {
    flex: 1;
    padding: 15px;
    background-color: #f5f5f5;
    border-radius: 10px;
    max-width: 300px;
}

.canvas-container {
    flex: 2;
    position: relative;
    max-width: 800px;
}

canvas {
    display: block;
    border: 1px solid #ccc;
    background-color: #eaeaea;
    max-width: 100%;
}

/* Status Displays */
.status-container {
    margin-bottom: 15px;
    border-radius: 10px;
    overflow: hidden;
}

.status-item {
    padding: 10px 15px;
    background-color: #e0f7fa;
    border-bottom: 1px solid #b2ebf2;
}

.status-item:last-child {
    border-bottom: none;
}

.status-item.clickable {
    cursor: pointer;
    position: relative;
}

.toggle-indicator {
    position: absolute;
    right: 15px;
    transition: transform 0.3s;
}

/* Chicken Status */
#chickenStatusContainer {
    margin-bottom: 15px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 10px;
}

.status-bars {
    margin-bottom: 10px;
}

.bar-container {
    margin-bottom: 8px;
}

.status-bar {
    background-color: #e0e0e0;
    border-radius: 5px;
    height: 20px;
    width: 100%;
    overflow: hidden;
}

.status-bar-inner {
    height: 100%;
    text-align: center;
    line-height: 20px;
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
    transition: width 0.3s;
}

.food-bar {
    background-color: #4CAF50;
}

.water-bar {
    background-color: #2196F3;
}

/* Buttons and Controls */
.action-button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 8px 12px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    margin: 4px 2px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.action-button:hover {
    background-color: #45a049;
}

.action-button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.action-button.warning {
    background-color: #f44336;
}

.action-button.warning:hover {
    background-color: #d32f2f;
}

.action-button.small {
    padding: 5px 10px;
    font-size: 12px;
}

.planting-on {
    background-color: #8BC34A;
}

.planting-off {
    background-color: #607D8B;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.buy-chicken-container {
    display: flex;
    gap: 5px;
}

.buy-chicken-container .action-button:first-child {
    flex-grow: 1;
}

/* Character Info */
.character-info {
    background-color: #f5f5f5;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
}

/* Auth Controls */
.auth-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

/* Save Controls */
.save-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

/* Game Instructions */
.game-instructions {
    background-color: #f5f5f5;
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px 15px;
    border-radius: 5px;
    color: white;
    opacity: 0;
    transition: opacity 0.3s;
    max-width: 300px;
    z-index: 2000;
}

.notification.show {
    opacity: 1;
}

.notification.success {
    background-color: #4CAF50;
}

.notification.error {
    background-color: #f44336;
}

.notification.warning {
    background-color: #ff9800;
}

.notification.info {
    background-color: #2196F3;
}

/* Auth Form Styles */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.auth-form {
    background-color: white;
    padding: 25px;
    border-radius: 10px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.auth-form h2 {
    margin-top: 0;
    color: #4CAF50;
    text-align: center;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.form-error {
    color: #f44336;
    margin-bottom: 15px;
    min-height: 20px;
}

.form-buttons {
    display: flex;
    justify-content: space-between;
}

.cancel-button {
    background-color: #f44336;
}

.cancel-button:hover {
    background-color: #d32f2f;
}

/* Helper Classes */
.hidden {
    display: none !important;
}

/* Multiplayer Components */
.chat-ui,
.trade-ui,
.leaderboard-ui,
.visiting-ui {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.chat-panel,
.trade-panel,
.leaderboard-panel,
.visiting-panel {
    background-color: #ffffff;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Chat UI */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #4caf50;
    color: white;
}

.chat-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: white;
}

.chat-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    max-height: 60vh;
    background-color: #f8f8f8;
}

.chat-message {
    margin-bottom: 12px;
    padding: 10px 15px;
    border-radius: 10px;
    background-color: #e9e9e9;
    max-width: 80%;
}

.chat-message.self-message {
    background-color: #d6f5d6;
    align-self: flex-end;
    margin-left: auto;
}

.chat-message.global-message {
    background-color: #e3f2fd;
}

.chat-message.private-message {
    background-color: #fff8e1;
}

.chat-sender {
    font-weight: bold;
    margin-right: 8px;
}

.chat-time {
    font-size: 0.8rem;
    color: #888;
    margin-left: 10px;
}

.chat-input {
    display: flex;
    padding: 15px;
    background-color: white;
    border-top: 1px solid #ddd;
}

.chat-input input {
    flex-grow: 1;
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 20px;
    margin-right: 10px;
}

.chat-input button {
    width: auto;
}

/* Trade UI */
.trade-columns {
    display: flex;
    gap: 20px;
    padding: 20px;
}

.trade-column {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 15px;
}

.trade-column h3 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.trade-items {
    min-height: 200px;
    max-height: 300px;
    overflow-y: auto;
}

.trade-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin-bottom: 8px;
    background-color: #f5f5f5;
    border-radius: 5px;
}

.trade-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 15px;
    border-top: 1px solid #eee;
}

.trade-add-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

/* Leaderboard UI */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 10px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.leaderboard-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

.leaderboard-table .current-user-row {
    background-color: #e8f5e9;
}

/* Visiting Farm UI */
.visiting-farm-info {
    padding: 15px;
    background-color: #f5f5f5;
    margin: 15px;
    border-radius: 10px;
}

.visiting-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 15px;
}

/* Prompt Overlay */
.prompt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1100;
}

.prompt-panel {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    padding: 20px;
    width: 90%;
    max-width: 400px;
}

.prompt-panel h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

.prompt-panel input,
.prompt-panel select {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.prompt-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.loading-content {
    text-align: center;
    padding: 30px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.loading-spinner {
    font-size: 48px;
    margin-bottom: 15px;
    animation: spin 2s infinite linear;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Weather Display */
.weather-display {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    margin-bottom: 10px;
}

.weather-icon {
    font-size: 24px;
}

/* Event Container */
.event-container {
    background-color: #fff8e1;
    border: 2px solid #ffd54f;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

.event-info h3 {
    margin-top: 0;
    color: #f57c00;
}

.event-effects {
    list-style-type: none;
    padding-left: 10px;
}

.event-effects li {
    margin-bottom: 5px;
    position: relative;
    padding-left: 20px;
}

.event-effects li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #f57c00;
    font-weight: bold;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 213, 79, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 213, 79, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 213, 79, 0);
    }
}

/* Visitors Container */
.visitors-container {
    margin-top: 20px;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 10px;
}

.visitors-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.visitors-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    margin-bottom: 5px;
    background-color: #f5f5f5;
    border-radius: 5px;
}

/* Multiplayer Controls */
.multiplayer-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 10px;
}

/* Dialog */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1200;
}

.dialog-panel {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    padding: 20px;
    width: 90%;
    max-width: 400px;
}

.dialog-content {
    margin-bottom: 20px;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Fix for overlay displays */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    .game-layout {
        flex-direction: column;
    }
    
    .side-panel {
        max-width: 100%;
    }
    
    .auth-form,
    .chat-panel,
    .trade-panel,
    .leaderboard-panel,
    .visiting-panel {
        width: 95%;
        max-height: 95vh;
    }
    
    .trade-columns {
        flex-direction: column;
    }
    
    .chat-message {
        max-width: 90%;
    }
}

/* Important login and not-logged-in styles */
.game-container.not-logged-in .logged-in-only {
    display: none;
}

.game-container.logged-in .not-logged-in-only {
    display: none;
}

/* Auth Form Styles - Enhanced for popup look */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.popup-window {
    background-color: white;
    border-radius: 10px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: slideDown 0.3s ease-out;
}

.popup-header {
    background-color: #4CAF50;
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

.popup-header h2 {
    margin: 0;
    font-size: 1.4rem;
    color: white;
}

.close-button {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 5px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.close-button:hover {
    opacity: 1;
}

.popup-content {
    padding: 20px;
}

/* Form Styles - Enhanced */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    transition: border-color 0.2s;
    font-size: 14px;
}

.form-group input:focus {
    border-color: #4CAF50;
    outline: none;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.form-error {
    color: #f44336;
    margin-bottom: 15px;
    min-height: 20px;
    font-size: 14px;
}

.form-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

/* Add transition effects to buttons */
.action-button {
    transition: transform 0.1s, box-shadow 0.1s;
}

.action-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.action-button:active {
    transform: translateY(1px);
}
/* Add these styles to your styles.css file */

/* Tab styling for auth form */
.auth-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
}

.tab-button {
    background: none;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.7;
    position: relative;
    transition: all 0.2s;
}

.tab-button:hover {
    opacity: 1;
}

.tab-button.active {
    opacity: 1;
    font-weight: bold;
    color: #4CAF50;
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #4CAF50;
}

/* Tab content styling */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}