/**
 * Base CSS - Reset & Grundstyles
 * Mobile-first Design
 */

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

/* CSS Custom Properties */
:root {
    /* Green Color Scheme - friendly and professional */
    --primary-green: #2d6a4f;
    --secondary-green: #52b788;
    --light-green: #d8f3dc;
    --dark-green: #1b4332;
    --accent-green: #40916c;
    --bg-color: #f1f8f4;
    
    /* UNO Card Colors (overlaid on green theme) */
    --color-red: #e53e3e;
    --color-blue: #3182ce;
    --color-green: #38a169;
    --color-yellow: #d69e2e;
    
    /* UI Colors */
    --color-bg: #f1f8f4;
    --color-surface: #e8f5e9;
    --color-text: #1b4332;
    --color-text-muted: #52b788;
    --color-border: #52b788;
    
    /* Status Colors */
    --color-success: #2d6a4f;
    --color-error: #e53e3e;
    --color-warning: #ed8936;
    --color-info: #52b788;
    
    /* Spacing */
    --spacing-unit: 8px;
    --spacing-xs: calc(var(--spacing-unit) * 0.5);
    --spacing-sm: var(--spacing-unit);
    --spacing-md: calc(var(--spacing-unit) * 2);
    --spacing-lg: calc(var(--spacing-unit) * 3);
    --spacing-xl: calc(var(--spacing-unit) * 4);
    
    /* Card sizing */
    --card-height: clamp(80px, 15vh, 150px);
    
    /* Mobile viewport fix */
    --vh: 1vh;
}

/* iOS Safari fixes */
html {
    height: -webkit-fill-available;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: var(--spacing-md);
    font-weight: 700;
    line-height: 1.2;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p {
    margin-bottom: var(--spacing-md);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-md);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 48px; /* Touch-friendly */
    touch-action: manipulation;
}

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

.btn-primary {
    background: var(--color-blue);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #2c5282;
    transform: translateY(-1px);
}

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

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border: 2px solid var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-border);
}

.btn-large {
    font-size: 1.25rem;
    padding: 16px 32px;
    min-height: 56px;
}

/* Forms */
.form-group {
    margin-bottom: var(--spacing-md);
}

label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
    color: var(--color-text);
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 1rem;
    min-height: 48px; /* Touch-friendly */
    transition: border-color 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-blue);
}

.form-input::placeholder {
    color: var(--color-text-muted);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-lobby {
    background: var(--color-warning);
    color: white;
}

.badge-started {
    background: var(--color-success);
    color: white;
}

.badge-finished {
    background: var(--color-text-muted);
    color: white;
}

.badge-you {
    background: var(--color-blue);
    color: white;
}

/* Flash Messages */
.flash-messages {
    position: fixed;
    top: var(--spacing-md);
    right: var(--spacing-md);
    z-index: 9998;
    max-width: 400px;
}

.flash {
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease;
}

.flash-success {
    background: var(--color-success);
    color: white;
}

.flash-error {
    background: var(--color-error);
    color: white;
}

.flash-warning {
    background: var(--color-warning);
    color: white;
}

.flash-info {
    background: var(--color-info);
    color: white;
}

.flash-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    margin-left: var(--spacing-md);
}

/* Toast Container */
#toast-container {
    position: fixed;
    top: var(--spacing-md);
    right: var(--spacing-md);
    z-index: 9999;
    pointer-events: none;
    max-width: 400px;
}

.toast {
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: var(--spacing-sm);
    animation: slideIn 0.3s ease;
    pointer-events: auto;
    transition: opacity 0.3s ease;
}

.toast-error {
    background: rgba(220, 38, 38, 0.9);
}

.toast-success {
    background: rgba(34, 197, 94, 0.9);
}

.toast-warning {
    background: rgba(237, 137, 54, 0.9);
}

.toast-info {
    background: rgba(66, 153, 225, 0.9);
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Touch Feedback */
button, .btn, .card {
    -webkit-tap-highlight-color: transparent;
}

button:active, .btn:active {
    transform: scale(0.95);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    :root {
        font-size: 14px;
    }
    
    .container {
        padding: var(--spacing-sm);
    }
    
    .flash-messages, #toast-container {
        left: var(--spacing-sm);
        right: var(--spacing-sm);
        max-width: none;
    }
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s;
}

.modal-content {
    background: var(--color-bg);
    border-radius: 16px;
    padding: var(--spacing-xl);
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    color: var(--color-text);
}

.modal-content h1 {
    font-size: 2rem;
    margin-bottom: var(--spacing-lg);
}

.modal-content button {
    display: block;
    width: 100%;
    padding: var(--spacing-md);
    margin-top: var(--spacing-md);
    border: none;
    border-radius: 8px;
    background: var(--color-info);
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-content button:first-of-type {
    margin-top: var(--spacing-lg);
}

.modal-content button:active {
    transform: scale(0.95);
    opacity: 0.8;
}

/* Toast Container */
.toast-container {
    position: fixed;
    bottom: var(--spacing-lg);
    left: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: 999;
    pointer-events: none;
    max-width: 500px;
}

/* Toast Styles */
.toast {
    background: var(--color-bg);
    border-left: 4px solid var(--color-info);
    color: var(--color-text);
    padding: var(--spacing-md);
    border-radius: 8px;
    margin-bottom: var(--spacing-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
    pointer-events: auto;
}

.toast.success {
    border-left-color: var(--color-success);
}

.toast.error {
    border-left-color: var(--color-error);
}

.toast.warning {
    border-left-color: var(--color-warning);
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Desktop Responsive */
@media (min-width: 1024px) {
    :root {
        font-size: 16px;
    }
}
