/* =====================================================
   Schafherde - Stylesheet
   ===================================================== */

/* Variables */
:root {
    --color-primary: #2d5016;
    --color-primary-dark: #1e3a0f;
    --color-primary-light: #4a7c2a;
    --color-secondary: #8b7355;
    --color-accent: #e8b84a;
    
    --color-success: #28a745;
    --color-warning: #ffc107;
    --color-danger: #dc3545;
    --color-info: #17a2b8;
    
    --color-bg: #f5f5f0;
    --color-bg-card: #ffffff;
    --color-text: #333333;
    --color-text-light: #666666;
    --color-border: #ddd;
    
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
    --radius: 8px;
    --radius-sm: 4px;
    
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

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

html {
    font-size: 16px;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.25;
    margin-bottom: 0.5em;
}

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

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Layout */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* Header */
.header {
    background: var(--color-primary);
    color: white;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    height: 60px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Hamburger Menu Button */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.nav-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: white;
    border-radius: 1px;
    transition: transform 0.3s, opacity 0.3s;
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* User Profile Icon (mobile) */
.user-profile-icon {
    display: none;
    font-size: 1.25rem;
    text-decoration: none;
}

.header-brand h1 {
    font-size: 1.25rem;
    margin: 0;
}

.header-brand a {
    color: white;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 600;
}

.header-brand a:hover {
    text-decoration: none;
    opacity: 0.9;
}

.nav {
    display: flex;
    gap: 0.5rem;
    flex: 1;
}

.nav a {
    color: rgba(255,255,255,0.85);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s, color 0.2s;
}

.nav a:hover,
.nav a.active {
    background: rgba(255,255,255,0.15);
    color: white;
    text-decoration: none;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-user span {
    opacity: 0.9;
}

/* Main */
.main {
    flex: 1;
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Footer */
.footer {
    background: var(--color-primary-dark);
    color: rgba(255,255,255,0.7);
    text-align: center;
    padding: 1rem;
    font-size: 0.875rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

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

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

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

.btn-primary:hover {
    background: var(--color-primary-dark);
}

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

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

.btn-small {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* Forms */
.form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-group label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--color-text-light);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(45, 80, 22, 0.15);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-error {
    color: var(--color-danger);
    font-size: 0.875rem;
    min-height: 1.25rem;
}

/* Auth */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 60px);
    padding: 1rem;
}

.auth-box {
    background: var(--color-bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.auth-box h2 {
    text-align: center;
    color: var(--color-primary);
    margin-bottom: 0.25rem;
}

.auth-subtitle {
    text-align: center;
    color: var(--color-text-light);
    margin-bottom: 1.5rem;
}

.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--color-text-light);
}

/* Dashboard */
.dashboard {
    max-width: 1000px;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat-card {
    background: var(--color-bg-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
}

.stat-label {
    color: var(--color-text-light);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.quick-btn {
    background: var(--color-bg-card);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--color-primary);
    font-weight: 500;
    transition: box-shadow 0.2s, transform 0.2s;
}

.quick-btn:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    text-decoration: none;
}

/* Cards */
.card {
    background: var(--color-bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

th {
    background: var(--color-bg);
    font-weight: 600;
    white-space: nowrap;
}

tr:hover {
    background: rgba(45, 80, 22, 0.03);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-info { background: #d1ecf1; color: #0c5460; }

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* Loading */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    /* Header - Mobile */
    .header {
        flex-wrap: wrap;
        height: auto;
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }
    
    /* Hamburger Button anzeigen */
    .nav-toggle {
        display: flex;
    }
    
    .header-brand {
        flex: 1;
    }
    
    .header-brand a {
        font-size: 1.1rem;
    }
    
    /* Navigation verstecken und als Dropdown */
    .nav {
        order: 3;
        width: 100%;
        flex-direction: column;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        padding-top: 0;
    }
    
    .nav.nav-open {
        max-height: 300px;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(255,255,255,0.2);
        margin-top: 0.5rem;
    }
    
    .nav a {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
        border-radius: 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    .nav a:last-child {
        border-bottom: none;
    }
    
    .header-user {
        gap: 0.5rem;
    }
    
    /* Benutzername verstecken, Icon zeigen */
    .user-name-link {
        display: none;
    }
    
    .user-profile-icon {
        display: block;
    }
    
    .btn-small {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    /* Main Content */
    .main {
        padding: 0.75rem;
    }
    
    /* Page Header */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .page-header h2 {
        font-size: 1.25rem;
    }
    
    .page-actions {
        width: 100%;
        display: flex;
        gap: 0.5rem;
    }
    
    .page-actions .btn {
        flex: 1;
        text-align: center;
    }
    
    /* Forms */
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-group label {
        font-size: 0.875rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Verhindert Zoom auf iOS */
    }
    
    /* Buttons */
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.875rem;
    }
    
    .btn-block {
        width: 100%;
    }
    
    /* Cards */
    .card {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .card h3 {
        font-size: 1.1rem;
    }
    
    /* Dashboard */
    .dashboard h2 {
        font-size: 1.25rem;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .stat-card {
        padding: 0.75rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .dashboard-sections {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .quick-btn {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }
    
    /* Tables */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -0.75rem;
        padding: 0 0.75rem;
    }
    
    .data-table {
        font-size: 0.8rem;
        min-width: 600px;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem 0.4rem;
    }
    
    /* Filter Bar */
    .filter-bar {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-group input,
    .filter-group select {
        width: 100%;
        min-width: unset;
    }
    
    /* Herden Grid */
    .herden-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .herde-card {
        padding: 1rem;
    }
    
    /* Detail Grid */
    .detail-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .detail-section {
        padding: 1rem;
    }
    
    /* Profil Grid */
    .profil-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Stats Row */
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .stat-box {
        padding: 0.75rem;
    }
    
    /* Modal */
    .modal-overlay {
        padding: 0.5rem;
        align-items: flex-end;
    }
    
    .modal {
        max-height: 85vh;
        border-radius: var(--radius) var(--radius) 0 0;
    }
    
    .modal-header {
        padding: 0.75rem 1rem;
    }
    
    .modal-content {
        padding: 1rem;
    }
    
    .modal-actions {
        flex-direction: column-reverse;
        gap: 0.5rem;
    }
    
    .modal-actions .btn {
        width: 100%;
    }
    
    /* Toast */
    .toast-container {
        left: 0.5rem;
        right: 0.5rem;
        bottom: 0.5rem;
    }
    
    .toast {
        width: 100%;
        font-size: 0.875rem;
    }
    
    /* Auth */
    .auth-container {
        padding: 1rem;
    }
    
    .auth-box {
        padding: 1.5rem;
    }
    
    .auth-box h2 {
        font-size: 1.5rem;
    }
    
    /* Selection Actions */
    .selection-actions {
        flex-wrap: wrap;
        font-size: 0.8rem;
    }
    
    /* Tier Select List */
    .tier-select-list {
        max-height: 250px;
    }
    
    .tier-select-item {
        padding: 0.6rem 0.75rem;
    }
    
    /* Timeline */
    .timeline {
        margin-left: 0.75rem;
    }
    
    /* Detail List */
    .detail-list dt {
        font-size: 0.8rem;
    }
    
    .detail-list dd {
        font-size: 0.9rem;
    }
}

/* Extra kleine Geräte */
@media (max-width: 400px) {
    .header-brand a {
        font-size: 1rem;
    }
    
    .nav a {
        padding: 0.35rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
    }
    
    .stats-row {
        grid-template-columns: 1fr;
    }
    
    h1 { font-size: 1.4rem; }
    h2 { font-size: 1.2rem; }
    h3 { font-size: 1.05rem; }
}

/* =====================================================
   Erweiterte Komponenten
   ===================================================== */

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal {
    background: var(--color-bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text-light);
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--color-text);
}

.modal-content {
    padding: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

/* Toast */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: var(--color-bg-card);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 250px;
    max-width: 400px;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    border-left: 4px solid var(--color-info);
}

.toast.show {
    transform: translateX(0);
}

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

.toast-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--color-text-light);
    margin-left: auto;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.page-header-left h2 {
    margin: 0;
}

.page-header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Herden Grid */
.herden-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.herde-card {
    background: var(--color-bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.2s;
    border: 2px solid transparent;
}

.herde-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--color-primary-light);
}

.herde-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.herde-card-header h3 {
    margin: 0;
    color: var(--color-primary);
}

.herde-card-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.75rem;
}

.herde-stat {
    text-align: center;
}

.herde-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

.herde-stat-label {
    font-size: 0.75rem;
    color: var(--color-text-light);
    text-transform: uppercase;
}

.herde-card-desc {
    color: var(--color-text-light);
    font-size: 0.875rem;
    margin: 0;
}

/* Stats Row & Box */
.stats-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.stat-box {
    background: var(--color-bg-card);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    min-width: 100px;
}

.stat-box-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

.stat-box-label {
    font-size: 0.75rem;
    color: var(--color-text-light);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card.highlight {
    background: var(--color-primary);
    color: white;
}

.stat-card.highlight .stat-value {
    color: white;
}

/* Detail Grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.detail-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1rem;
}

.detail-list dt {
    color: var(--color-text-light);
    font-size: 0.875rem;
}

.detail-list dd {
    font-weight: 500;
}

/* Timeline */
.timeline {
    list-style: none;
    padding-left: 1.5rem;
    border-left: 2px solid var(--color-border);
}

.timeline-item {
    position: relative;
    padding-bottom: 1rem;
    padding-left: 1rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 0.25rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-border);
    border: 2px solid var(--color-bg);
}

.timeline-item.timeline-current::before {
    background: var(--color-primary);
}

.timeline-date {
    font-size: 0.75rem;
    color: var(--color-text-light);
}

.timeline-content {
    margin-top: 0.25rem;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    padding: 1rem;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
}

.filter-group input,
.filter-group select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.filter-group input {
    min-width: 200px;
}

/* Selection Actions */
.selection-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--color-primary-light);
    color: white;
    border-radius: var(--radius-sm);
}

.selection-count {
    font-weight: 500;
}

/* Tier Select List (Modal) */
.tier-select-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    margin: 1rem 0;
}

.tier-select-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
}

.tier-select-item:last-child {
    border-bottom: none;
}

.tier-select-item:hover {
    background: var(--color-bg);
}

.tier-select-info {
    display: flex;
    flex-direction: column;
}

.tier-select-info span {
    font-size: 0.875rem;
    color: var(--color-text-light);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-light);
}

.empty-state p {
    margin-bottom: 1rem;
}

/* Table Info */
.table-info {
    padding: 0.5rem 0;
    font-size: 0.875rem;
    color: var(--color-text-light);
}

/* Text Utilities */
.text-muted {
    color: var(--color-text-light);
}

/* Dashboard Sections */
.dashboard-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.dashboard-section {
    background: var(--color-bg-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.dashboard-section h3 {
    margin-bottom: 1rem;
    color: var(--color-primary);
}

/* Dashboard Herden Widget */
.dashboard-herden-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dashboard-herde-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--color-text);
    transition: background 0.2s;
}

.dashboard-herde-item:hover {
    background: var(--color-border);
    text-decoration: none;
}

.dashboard-herde-name {
    font-weight: 500;
}

.dashboard-herde-count {
    color: var(--color-text-light);
    font-size: 0.875rem;
}

/* Progress Bar */
.progress-bar-container {
    margin-top: 1rem;
}

.progress-bar {
    height: 24px;
    background: var(--color-info);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.progress-bar-fill.female {
    height: 100%;
    background: var(--color-accent);
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

/* Checkbox in Tables */
.row-checkbox,
.select-all-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Header Actions */
.header-actions {
    display: flex;
    gap: 0.5rem;
}

/* User Name Link in Header */
.user-name-link {
    color: white;
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.user-name-link:hover {
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

/* Profil Grid */
.profil-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.profil-grid .card {
    margin: 0;
}

.profil-grid .card h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

/* Card Danger Variant */
.card-danger {
    border: 1px solid var(--color-danger);
    border-left: 4px solid var(--color-danger);
}

.card-danger h3 {
    color: var(--color-danger);
}

/* Alert in Modal */
.alert {
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Liste in Modals */
.modal-content ul {
    margin: 0.5rem 0 1rem 1.5rem;
}

.modal-content ul li {
    margin-bottom: 0.25rem;
}

/* =====================================================
   PWA - Offline Indicator & Install Button
   ===================================================== */

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--color-warning);
    color: #333;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 9999;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.offline-indicator:not(.hidden) {
    transform: translateY(0);
}

/* Body Offset wenn Offline */
body.is-offline .header {
    top: 36px;
}

body.is-offline #app {
    padding-top: 36px;
}

/* Install Button */
.install-btn {
    position: fixed;
    bottom: 80px;
    right: 1rem;
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: transform 0.2s, background 0.2s;
}

.install-btn:hover {
    background: var(--color-primary-dark);
    transform: scale(1.05);
}

.install-btn.hidden {
    display: none;
}

/* Offline Mode Styles */
body.is-offline .btn-primary:not([disabled]) {
    opacity: 0.7;
}

body.is-offline .btn-primary:not([disabled])::after {
    content: ' (offline)';
    font-size: 0.75em;
}

/* Sync Indicator */
.sync-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: var(--color-info);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

.sync-indicator .spinner {
    width: 14px;
    height: 14px;
    border-width: 2px;
}

/* Toast Offline Variant */
.toast-offline {
    border-left-color: var(--color-warning);
}

/* Mobile Adjustments for PWA */
@media (max-width: 768px) {
    .install-btn {
        bottom: 70px;
        right: 0.5rem;
        left: 0.5rem;
        text-align: center;
    }
    
    .offline-indicator {
        font-size: 0.8rem;
        padding: 0.4rem;
    }
}

/* Standalone Mode (installed PWA) */
@media (display-mode: standalone) {
    /* Zusätzliche Styles für installierte App */
    .install-btn {
        display: none !important;
    }
}
