/* ======================================
   MOBILE-FIRST GLOBAL STYLES
   Bienenwaage Anwendung
   ====================================== */

/* Globales Reset und Box-Sizing */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Custom Properties für konsistente Farben */
:root {
    --primary-color: #d4a017;
    --primary-hover: #b08e12;
    --secondary-color: #b08e23;
    --accent-color: #ffd700;
    --background-color: #fffbe6;
    --card-background: #fff;
    --text-color: #333;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.2);
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
}

/* Body Grundstyles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container Styles */
.container-custom {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-md);
}

/* ======================================
   MOBILE-OPTIMIERTE KOMPONENTEN
   ====================================== */

/* Touch-freundliche Buttons */
.btn-touch {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 500;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    -webkit-tap-highlight-color: transparent;
}

.btn-primary-custom {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary-custom:hover, .btn-primary-custom:focus {
    background-color: var(--primary-hover);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary-custom {
    background-color: var(--secondary-color);
    color: white;
}

.btn-accent-custom {
    background-color: var(--accent-color);
    color: var(--text-color);
}

/* Mobile Navigation */
.mobile-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--card-background);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-sm) 0;
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
}

/* Cards und Containers */
.card-custom {
    background: var(--card-background);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    border: 1px solid var(--border-color);
}

.card-header-custom {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

/* Form Styles */
.form-custom {
    background: var(--card-background);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-lg);
}

.form-group-custom {
    margin-bottom: var(--spacing-lg);
}

.form-label-custom {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: 500;
    color: var(--text-color);
}

.form-control-custom {
    width: 100%;
    min-height: 44px;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--card-background);
    transition: border-color 0.2s ease;
}

.form-control-custom:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.1);
}

/* Responsive Tables */
.table-responsive-custom {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-background);
}

.table-custom th,
.table-custom td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table-custom th {
    background-color: var(--background-color);
    font-weight: 600;
    color: var(--text-color);
}

/* Mobile Card Layout für Tabellen */
.mobile-card-table {
    display: none;
}

/* Liste Styles */
.list-custom {
    list-style: none;
    padding: 0;
}

.list-item-custom {
    background: var(--card-background);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }
.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.p-1 { padding: var(--spacing-sm); }
.p-2 { padding: var(--spacing-md); }
.p-3 { padding: var(--spacing-lg); }

.d-flex { display: flex; }
.d-grid { display: grid; }
.d-block { display: block; }
.d-none { display: none; }

.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.align-items-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: var(--spacing-sm); }
.gap-2 { gap: var(--spacing-md); }

.w-100 { width: 100%; }

/* ======================================
   RESPONSIVE BREAKPOINTS
   ====================================== */

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
    .container-custom {
        padding: var(--spacing-lg);
    }
    
    .nav-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
    body {
        font-size: 16px;
    }
    
    .container-custom {
        padding: var(--spacing-xl);
    }
    
    .nav-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: var(--spacing-md);
    }
    
    .form-custom {
        padding: var(--spacing-xl);
    }
    
    .table-responsive-custom {
        overflow-x: visible;
    }
    
    /* Desktop Tabellen anzeigen */
    .desktop-table {
        display: table;
    }
    
    .mobile-card-table {
        display: none;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .container-custom {
        max-width: 1140px;
    }
    
    .nav-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .container-custom {
        max-width: 1200px;
    }
}

/* ======================================
   MOBILE-SPECIFIC STYLES
   ====================================== */

@media (max-width: 767px) {
    /* Mobile Tables als Cards */
    .table-responsive-custom .table-custom {
        display: none;
    }
    
    .mobile-card-table {
        display: block;
    }
    
    /* Mobile Navigation */
    .nav-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-xs);
    }
    
    .btn-touch {
        font-size: 14px;
        padding: 10px 16px;
    }
    
    /* Kleinere Margins und Paddings */
    .card-custom {
        padding: var(--spacing-md);
        margin-bottom: var(--spacing-md);
    }
    
    .form-custom {
        padding: var(--spacing-md);
    }
    
    /* Touch-optimierte Inputs */
    .form-control-custom {
        font-size: 16px; /* Verhindert Zoom auf iOS */
    }
    
    /* Mobile Headers */
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.1rem; }
    h4 { font-size: 1rem; }
    h5 { font-size: 0.9rem; }
}

/* Extra small devices (portrait phones, 480px and down) */
@media (max-width: 480px) {
    .container-custom {
        padding: var(--spacing-sm);
    }
    
    .nav-grid {
        grid-template-columns: 1fr;
    }
    
    .btn-touch {
        width: 100%;
        margin-bottom: var(--spacing-sm);
    }
    
    .card-custom {
        padding: var(--spacing-sm);
        border-radius: var(--border-radius);
    }
    
    .form-control-custom {
        padding: 14px 16px;
        font-size: 16px;
    }
}

/* ======================================
   ACCESSIBILITY & TOUCH IMPROVEMENTS
   ====================================== */

/* Focus styles */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Touch target improvements */
@media (pointer: coarse) {
    .btn-touch {
        min-height: 48px;
        min-width: 48px;
    }
    
    .form-control-custom {
        min-height: 48px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000;
        --shadow-sm: none;
        --shadow-md: none;
        --shadow-lg: none;
    }
}

/* ======================================
   LEGACY COMPATIBILITY
   ====================================== */

/* Alte Klassen für Rückwärtskompatibilität */
.container {
    @extend .container-custom;
}

form {
    @extend .form-custom;
}

form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="number"],
form input[type="date"] {
    @extend .form-control-custom;
}

form button {
    @extend .btn-touch;
    @extend .btn-primary-custom;
}

ul.user-list {
    @extend .list-custom;
}

ul.user-list li {
    @extend .list-item-custom;
}
