/* === Root Variables === */
:root {
    /* Farbpalette */
    --primary-green: #4a7c59;
    --primary-green-light: #6b9f7f;
    --primary-green-dark: #2d5436;
    --secondary-gray: #545454;
    --anthracite: #2c3e3e;
    --light-gray: #f5f5f5;
    --white: #ffffff;
    --black: #1a1a1a;
    
    /* Status Farben */
    --success: #52c41a;
    --warning: #faad14;
    --error: #f5222d;
    --info: #1890ff;
    
    /* Schatten */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.16);
    
    /* Animationen */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

/* === Global Styles === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8f0e8 100%);
    color: var(--black);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    touch-action: manipulation;
}

.app-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Header Mobile === */
.app-header {
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
    color: var(--white);
    padding: 0.75rem 1rem;
    box-shadow: var(--shadow-md);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 1.5rem;
}

.app-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.header-info {
    display: none; /* Versteckt auf Mobile */
}

/* === Main Content Mobile === */
.main-content {
    flex: 1;
    padding: 0.5rem;
    padding-top: 4rem; /* Platz für Fixed Header */
    padding-bottom: 4rem; /* Platz für FAB */
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 3.5rem);
}

/* === Dashboard Grid Mobile Optimiert === */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

/* === Dashboard Tiles Mobile === */
.dashboard-tile {
    background: var(--white);
    border-radius: 12px;
    padding: 0.75rem;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    position: relative;
    transition: all var(--transition-normal);
    overflow: hidden;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    -webkit-user-select: none;
    user-select: none;
}

.dashboard-tile:active {
    transform: scale(0.95);
    box-shadow: var(--shadow-md);
}

.tile-icon {
    font-size: 1.8rem;
    color: var(--primary-green);
    margin-bottom: 0.25rem;
}

.tile-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--anthracite);
    line-height: 1.2;
}

.tile-description {
    display: none; /* Versteckt auf Mobile */
}

.tile-badge {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: var(--primary-green);
    color: var(--white);
    padding: 0.1rem 0.3rem;
    border-radius: 10px;
    font-size: 0.6rem;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tile-badge.active {
    background: var(--success);
    animation: pulse 2s infinite;
}

.tile-badge.warning {
    background: var(--warning);
}

/* === Floating Action Button === */
.fab {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-green), var(--primary-green-dark));
    color: var(--white);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
    z-index: 90;
}

.fab:active {
    transform: scale(0.9);
}

/* === Quick Actions Mobile === */
.quick-actions {
    position: fixed;
    bottom: 5rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition-normal);
    z-index: 89;
}

.quick-actions.active {
    opacity: 1;
    pointer-events: all;
}

.quick-action-btn {
    background: var(--white);
    border: 1px solid var(--primary-green);
    color: var(--primary-green);
    padding: 0.6rem 1rem;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
    transform: translateX(20px);
    opacity: 0;
}

.quick-actions.active .quick-action-btn {
    transform: translateX(0);
    opacity: 1;
}

/* === Modal Mobile === */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: flex-end;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    animation: slideUp var(--transition-normal);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-green), var(--primary-green-dark));
    color: var(--white);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.25rem;
}

.modal-body {
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.modal-footer {
    padding: 1rem;
    background: var(--light-gray);
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

/* === Buttons Mobile === */
.btn {
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    border: none;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex: 1;
}

.btn-primary {
    background: var(--primary-green);
    color: var(--white);
}

.btn-secondary {
    background: var(--secondary-gray);
    color: var(--white);
}

/* === Notifications Mobile === */
.notification-container {
    position: fixed;
    top: 4rem;
    left: 0.5rem;
    right: 0.5rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.notification {
    background: var(--white);
    padding: 0.75rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInDown var(--transition-normal);
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* === Form Elements Mobile === */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 500;
    color: var(--anthracite);
    font-size: 0.9rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px; /* Verhindert Zoom auf iOS */
    transition: all var(--transition-fast);
}

/* === Landscape Mode === */
@media screen and (orientation: landscape) and (max-height: 500px) {
    .app-header {
        padding: 0.5rem 1rem;
    }
    
    .main-content {
        padding-top: 3rem;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 600px;
    }
    
    .tile-icon {
        font-size: 1.5rem;
    }
    
    .tile-title {
        font-size: 0.7rem;
    }
}

/* === Tablets und größere Phones === */
@media (min-width: 768px) {
    .header-info {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        font-size: 0.8rem;
    }
    
    .dashboard-grid {
        max-width: 500px;
        gap: 0.75rem;
    }
    
    .dashboard-tile {
        padding: 1rem;
    }
    
    .tile-icon {
        font-size: 2.2rem;
    }
    
    .tile-title {
        font-size: 0.9rem;
    }
    
    .tile-description {
        display: block;
        font-size: 0.7rem;
        color: var(--secondary-gray);
        opacity: 0.8;
        margin-top: 0.2rem;
    }
}

/* === Kleine Smartphones === */
@media (max-width: 360px) {
    .dashboard-grid {
        gap: 0.4rem;
    }
    
    .tile-icon {
        font-size: 1.5rem;
    }
    
    .tile-title {
        font-size: 0.65rem;
    }
}

/* === iOS Safe Areas === */
@supports (padding: max(0px)) {
    .app-header {
        padding-top: max(0.75rem, env(safe-area-inset-top));
    }
    
    .fab {
        bottom: max(1rem, env(safe-area-inset-bottom));
    }
    
    .modal-content {
        padding-bottom: env(safe-area-inset-bottom);
    }
}