/* Mobile-First CSS for SmartSim Life */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    overflow-x: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    height: 100vh;
    position: fixed;
    width: 100%;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-logo {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounce 2s infinite;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* Screen Management */
.screen {
    width: 100%;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    transition: all 0.3s ease-in-out;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}

/* Character Creation */
#character-creation {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.character-form {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.character-form h1 {
    color: #667eea;
    margin-bottom: 30px;
    font-size: 1.8rem;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.primary-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s ease;
    width: 100%;
    margin-top: 10px;
}

.primary-btn:hover {
    transform: translateY(-2px);
}

/* Main Game Interface */
#main-game {
    background: #f8f9fa;
    overflow-y: auto;
    padding-bottom: 20px;
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 15px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.status-left,
.status-center,
.status-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.clock {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #667eea;
}

.day-display {
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.money-display {
    font-size: 1.2rem;
    font-weight: bold;
    color: #28a745;
}

.level-display {
    background: #ffc107;
    color: #212529;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.notification-dot {
    width: 8px;
    height: 8px;
    background: #dc3545;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.notification-dot.show {
    opacity: 1;
}

.settings-gear {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: transform 0.2s ease;
}

.settings-gear:active {
    transform: scale(0.9);
}

/* Wellness Bar */
.wellness-bar {
    display: flex;
    gap: 10px;
    padding: 8px 15px;
    background: #2c3e50;
    border-bottom: 1px solid #34495e;
}

.wellness-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.wellness-display {
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    color: #ecf0f1;
}

.wellness-progress {
    height: 6px;
    background: #34495e;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.progress-fill.health {
    background: linear-gradient(90deg, #dc3545, #28a745);
}

.progress-fill.happiness {
    background: linear-gradient(90deg, #6c757d, #ffc107);
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    margin-bottom: 5px;
}

.quick-btn {
    flex: 1;
    background: white;
    border: none;
    padding: 15px 10px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.3s ease;
    text-align: center;
}

.quick-btn:active {
    transform: scale(0.95);
}

.quick-btn i {
    display: block;
    font-size: 1.2rem;
    margin-bottom: 5px;
    color: #667eea;
}

.quick-btn span {
    font-size: 12px;
    font-weight: 600;
    color: #555;
}

/* App Grid */
.app-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    padding: 2px 2px;
}

.app-item {
    background: white;
    border-radius: 15px;
    padding: 20px 10px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.3s ease;
    position: relative;
}

.app-item:active {
    transform: scale(0.95);
}

.app-icon {
    font-size: 2.5rem; /* 25% bigger than 2rem */
    margin-bottom: 8px;
}

/* Custom SVG icons for all apps */
.app-icon svg {
    width: 2.5rem;
    height: 2.5rem;
    display: block;
    margin: 0 auto;
}

.app-name {
    font-size: 12px;
    font-weight: 600;
    color: #555;
}

.app-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    z-index: 1000;
    padding: 20px;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    transform: translateY(0);
    transition: transform 0.3s ease;
    margin-top: 40px;
}

.modal.hidden .modal-content {
    transform: translateY(-50px);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    background: #667eea;
    color: white;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

/* Dark Mode */
body.dark-mode {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

body.dark-mode #main-game {
    background: #2c3e50;
}

body.dark-mode .status-bar,
body.dark-mode .wellness-bar,
body.dark-mode .quick-btn,
body.dark-mode .app-item {
    background: #34495e;
    color: #ecf0f1;
}

body.dark-mode .modal-content {
    background: #34495e;
    color: #ecf0f1;
}

body.dark-mode .modal-header {
    background: #2c3e50;
}

/* Market Styles */
.market-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    justify-content: center;
}

.category-btn {
    background: #e9ecef;
    border: none;
    padding: 6px 8px;
    border-radius: 16px;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.3s ease;
    font-size: 12px;
    flex: 1;
    min-width: 70px;
    max-width: 90px;
    text-align: center;
}

.category-btn.active {
    background: #667eea;
    color: white;
}

.market-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.market-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
}

.market-item:hover {
    border-color: #667eea;
}

.market-item-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.market-item-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.market-item-price {
    color: #28a745;
    font-weight: bold;
    margin-bottom: 10px;
}

.buy-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
}

.buy-btn:hover {
    background: #218838;
}

.buy-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Inventory Styles */
.inventory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.inventory-value {
    font-weight: bold;
    color: #28a745;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.inventory-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    position: relative;
}

.inventory-item-icon {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.inventory-item-name {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
}

.inventory-item-value {
    font-size: 11px;
    color: #28a745;
    margin-bottom: 8px;
}

.sell-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    cursor: pointer;
}

.inventory-empty {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

/* Events Styles */
.event-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
    cursor: pointer;
    transition: background 0.3s ease;
}

.event-item.unread {
    background: #fff3cd;
    border-left-color: #ffc107;
}

.event-item:hover {
    background: #e9ecef;
}

/* Daily Event Styles */
.daily-event-container {
    text-align: center;
    padding: 20px;
}

.daily-event-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.daily-event-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: #667eea;
}

.daily-event-description {
    margin-bottom: 20px;
    color: #6c757d;
    line-height: 1.5;
}

.daily-event-reward {
    background: #e7f3ff;
    border: 2px solid #007bff;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

.daily-event-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.action-btn:active {
    transform: scale(0.95);
}

.action-btn.accept {
    background: #28a745;
    color: white;
}

.action-btn.decline {
    background: #6c757d;
    color: white;
}

/* Achievements Styles */
.achievement-category {
    margin-bottom: 25px;
}

.achievement-category h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.achievement-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.achievement-item.unlocked {
    background: #d4edda;
    border: 2px solid #28a745;
}

.achievement-icon {
    font-size: 2rem;
    width: 50px;
    text-align: center;
}

.achievement-info {
    flex: 1;
}

.achievement-title {
    font-weight: bold;
    margin-bottom: 5px;
}

.achievement-progress {
    font-size: 12px;
    color: #6c757d;
}

.achievement-reward {
    background: #007bff;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
}

/* Bank Styles */
.bank-section {
    margin-bottom: 25px;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
}

.bank-section h3 {
    color: #667eea;
    margin-bottom: 15px;
}

.bank-balance {
    font-size: 1.5rem;
    font-weight: bold;
    color: #28a745;
    margin-bottom: 10px;
}

.bank-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.bank-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.loan-input {
    width: 100%;
    padding: 10px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    margin-bottom: 10px;
}

/* Responsive Design */
@media (max-width: 360px) {
    .app-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .quick-actions {
        flex-wrap: wrap;
    }
    
    .quick-btn {
        min-width: 80px;
    }
}

@media (orientation: landscape) {
    body {
        overflow: hidden;
    }
    
    .screen {
        overflow-y: auto;
    }
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Addiction Status Bar */
.addiction-bar {
    display: flex;
    gap: 10px;
    padding: 8px 15px;
    background: #1a252f;
    border-bottom: 1px solid #34495e;
}

.addiction-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.addiction-display {
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    color: #ecf0f1;
}

.addiction-progress {
    height: 6px;
    background: #34495e;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill.food-addiction {
    background: linear-gradient(90deg, #e74c3c, #f39c12);
    height: 100%;
    transition: width 0.3s ease;
}

.progress-fill.gambling-addiction {
    background: linear-gradient(90deg, #9b59b6, #8e44ad);
    height: 100%;
    transition: width 0.3s ease;
}
