/* ============================================================================
   CORE.CSS - Universal styles loaded on ALL pages
   ============================================================================ */

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

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 15px;
}

/* Typography */
h1 {
    margin-bottom: 20px;
    font-size: 2em;
    color: #333;
    text-align: center;
}

h3 {
    font-size: 1.3em;
    color: #333;
    margin-bottom: 15px;
}

h4 {
    font-size: 1.1em;
    color: #555;
    margin-bottom: 12px;
    font-weight: 600;
}

.help-text {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

.btn-green {
    background: linear-gradient(135deg, #52c41a 0%, #45a017 100%);
}

.btn-red {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff5252 100%);
}

.btn-orange {
    background: linear-gradient(135deg, #ff9500 0%, #e6850e 100%);
}

.btn-purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.btn-large {
    padding: 16px 32px;
    font-size: 16px;
    border-radius: 16px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
    border-radius: 8px;
}

.button-row {
    display: flex;
    gap: 10px;
    flex-direction: column;
    margin: 10px 0;
}

/* Forms */
.edit-textarea,
.depot-textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 12px;
    font-family: inherit;
    resize: vertical;
    min-height: 70px;
    transition: border-color 0.2s;
}

.edit-textarea:focus,
.depot-textarea:focus {
    outline: none;
    border-color: #8b5cf6;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideIn 0.3s ease;
    border-left: 4px solid #667eea;
}

.toast.success {
    border-left-color: #52c41a;
}

.toast.error {
    border-left-color: #ff6b6b;
}

.toast.warning {
    border-left-color: #ff9500;
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
    line-height: 1;
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: #333;
}

.toast-message {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    white-space: pre-line;
}

.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    background: #f0f0f0;
    color: #666;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.removing {
    animation: slideOut 0.3s ease;
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Processing Overlay */
.processing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.processing-overlay.show {
    display: flex;
}

.processing-content {
    background: white;
    border-radius: 15px;
    padding: 30px 25px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 90%;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Error Messages */
.error-message {
    background: #ff6b6b;
    color: white;
    padding: 12px;
    border-radius: 8px;
    margin: 12px 0;
    display: none;
    font-size: 13px;
}

.error-message.show {
    display: block;
}

/* Bottom Nav - Universal for arrival & colony */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 max(8px, env(safe-area-inset-bottom));
    z-index: 1000;
    transform: translateZ(0);
    will-change: transform;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 8px;
    text-decoration: none;
    color: #666;
    transition: all 0.2s;
    border-radius: 10px;
    min-width: 60px;
    position: relative;
    min-height: 55px;
    justify-content: center;
}

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

.nav-icon {
    font-size: 20px;
    line-height: 1;
    transition: transform 0.2s;
}

.nav-label {
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
}

.nav-badge {
    position: absolute;
    top: 4px;
    right: 8px;
    background: #e0e0e0;
    color: #666;
    padding: 2px 5px;
    border-radius: 8px;
    font-size: 8px;
    font-weight: 700;
    min-width: 16px;
    text-align: center;
}

.nav-item.active {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.nav-item.active .nav-icon {
    transform: scale(1.15);
}

.nav-item.active .nav-badge {
    background: #667eea;
    color: white;
}

.nav-item.completed .nav-badge {
    background: #52c41a;
    color: white;
}

/* Stats - Universal for arrival & colony */
.stats-container {
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    padding: 18px;
    margin: 15px 0;
}

.stat-row {
    display: flex;
    align-items: center;
    margin-bottom: 14px;
    font-size: 13px;
}

.stat-label {
    min-width: 90px;
    font-weight: 600;
    font-size: 13px;
}

.stat-bar {
    flex: 1;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    margin: 0 8px;
}

.stat-fill {
    height: 100%;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 10px;
    transition: width 0.8s ease;
}

.stat-value {
    min-width: 30px;
    font-weight: bold;
    text-align: right;
    font-size: 13px;
}

.stat-total {
    margin-top: 10px;
    font-size: 14px;
    color: #666;
}

/* Story Panel - Universal */
.story-panel {
    background: #f8f9fa;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.story-text {
    font-size: 16px;
    line-height: 1.6;
    color: #555;
    margin-bottom: 15px;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive */
@media (min-width: 480px) {
    body {
        padding-bottom: 15px;
    }

    h1 {
        font-size: 2.5em;
    }

    .button-row {
        flex-direction: row;
    }

    .button-row .btn {
        width: auto;
        flex: 1;
    }
}

@media (max-width: 480px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .toast {
        padding: 14px 16px;
    }

    .toast-icon {
        font-size: 20px;
    }

    .toast-title {
        font-size: 13px;
    }

    .toast-message {
        font-size: 12px;
    }
}