/**
 * Personalverwaltung - Stylesheet
 * Mobile-First Responsive Design
 */

/* === Reset & Base === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;

    --text-color: #1f2937;
    --text-muted: #6b7280;
    --border-color: #d1d5db;
    --bg-color: #f9fafb;
    --bg-white: #ffffff;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    --radius: 0.5rem;
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

/* === Login Page === */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-box {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    margin-bottom: 1rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.login-footer {
    margin-top: 1.5rem;
    text-align: center;
}

.login-page-footer {
    text-align: center;
    color: white;
    opacity: 0.9;
}

.login-page-footer p {
    font-size: 0.875rem;
}

/* === Forms === */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-color);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group select,
.form-group textarea,
.form-control,
select.form-control,
input.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: var(--transition);
    background-color: var(--bg-white);
}

.form-group select,
select.form-control {
    cursor: pointer;
}

.form-group input:hover,
.form-group select:hover,
.form-control:hover,
select.form-control:hover {
    border-color: var(--primary-color);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.form-control:focus,
input.form-control:focus,
select.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

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

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

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

.btn-success:hover {
    background-color: #059669;
}

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

.btn-error:hover {
    background-color: #dc2626;
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

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

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

/* === Alerts === */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert .icon {
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* === Utilities === */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

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

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

/* === Container & Layout === */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

/* === Responsive === */
@media (max-width: 640px) {
    .login-box {
        padding: 1.5rem;
    }

    .login-header h1 {
        font-size: 1.5rem;
    }
}

@media (min-width: 768px) {
    .container {
        padding: 0 2rem;
    }
}

/* === Checkbox Group === */
.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.checkbox-label:hover {
    background: var(--bg-color);
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
}

/* === Badge Variations === */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-secondary {
    background: #e5e7eb;
    color: #374151;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Badge Status (Mitgliedsstatus) */
.badge-status-aktiv {
    background: #d1fae5;
    color: #065f46;
}

.badge-status-inaktiv {
    background: #fee2e2;
    color: #991b1b;
}

.badge-status-passiv {
    background: #fef3c7;
    color: #92400e;
}

.badge-status-ehrenmitglied {
    background: #fce7f3;
    color: #831843;
}

.detail-item .badge {
    margin-right: 0.5rem;
    margin-bottom: 0.25rem;
    display: inline-block;
}

/* === Team Badge Display === */
.team-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 0.75rem;
    margin-bottom: 0.5rem;
}

.team-rolle {
    color: #6b7280;
    font-style: italic;
}

/* ========================================
   MOBILE OPTIMIZATION (Phase 7)
   ======================================== */

/* === Mobile Navigation === */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1000;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: var(--radius);
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.mobile-menu-toggle:hover {
    background: var(--primary-hover);
}

/* === Responsive Tables === */
@media (max-width: 768px) {
    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: block;
    }

    /* Sidebar mobile behavior */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        transition: left 0.3s ease;
        z-index: 999;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.open {
        left: 0;
    }

    /* Overlay when sidebar is open */
    .mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
    }

    .mobile-overlay.active {
        display: block;
    }

    /* Main content adjustment */
    .main-content {
        margin-left: 0;
        padding-top: 60px;
    }

    /* Container padding for mobile */
    .container {
        padding: 1rem;
    }

    /* Responsive tables - stack layout */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Stack table for mobile */
    .table-mobile-stack {
        display: block;
        width: 100%;
    }

    .table-mobile-stack thead {
        display: none;
    }

    .table-mobile-stack tbody {
        display: block;
    }

    .table-mobile-stack tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: var(--radius);
        background: white;
        padding: 1rem;
    }

    .table-mobile-stack td {
        display: block;
        text-align: right;
        padding: 0.5rem 0;
        border: none;
        position: relative;
        padding-left: 50%;
    }

    .table-mobile-stack td:before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 45%;
        padding-right: 10px;
        text-align: left;
        font-weight: bold;
        color: var(--text-muted);
    }

    /* Grid layouts - single column on mobile */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    /* Form rows - stack on mobile */
    .form-row {
        flex-direction: column;
    }

    .form-row .form-group {
        width: 100%;
    }

    /* Cards - full width on mobile */
    .card {
        margin-bottom: 1rem;
    }

    /* Buttons - full width on mobile */
    .btn-block-mobile {
        display: block;
        width: 100%;
        margin-bottom: 0.5rem;
    }

    /* Page header - stack on mobile */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .header-actions {
        width: 100%;
        flex-direction: column;
    }

    .header-actions .btn {
        width: 100%;
    }
}

/* === Touch-Friendly Elements === */
@media (max-width: 768px) {
    /* Larger tap targets (min 44x44px) */
    .btn,
    button,
    a.btn,
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
        padding: 12px 20px;
    }

    /* Larger form inputs */
    .form-control,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="date"],
    select,
    textarea {
        min-height: 44px;
        font-size: 16px; /* Prevent iOS zoom */
        padding: 10px 12px;
    }

    /* Checkbox and radio - larger touch area */
    .checkbox-label,
    .radio-label {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .checkbox-label input[type="checkbox"],
    .radio-label input[type="radio"] {
        width: 20px;
        height: 20px;
    }

    /* Navigation links - larger */
    .sidebar nav a {
        padding: 15px 20px;
        font-size: 1rem;
    }

    /* Table action buttons */
    .table .btn-sm {
        min-height: 36px;
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}

/* === Small Mobile (< 480px) === */
@media (max-width: 480px) {
    /* Even smaller stats grid */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* Smaller font sizes */
    body {
        font-size: 14px;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    /* Compact cards */
    .card {
        padding: 1rem;
    }

    .card-header {
        padding: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* Smaller stat values */
    .stat-value {
        font-size: 2rem;
    }

    /* Container - minimal padding */
    .container {
        padding: 0.75rem;
    }
}

/* === Tablet (481px - 768px) === */
@media (min-width: 481px) and (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* === Landscape Mobile === */
@media (max-height: 600px) and (orientation: landscape) {
    /* Compact header */
    .page-header {
        margin-bottom: 1rem;
    }

    /* Smaller cards */
    .card {
        margin-bottom: 0.75rem;
    }

    /* Compact sidebar */
    .sidebar {
        padding-top: 1rem;
    }

    .sidebar nav a {
        padding: 10px 20px;
    }
}

/* === Print Styles === */
@media print {
    /* Hide navigation and non-essential elements */
    .sidebar,
    .mobile-menu-toggle,
    .header-actions,
    .btn,
    .alert,
    .mobile-overlay {
        display: none !important;
    }

    /* Full width for printing */
    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    /* Clean tables for print */
    .table {
        border: 1px solid #000;
    }

    .table th,
    .table td {
        border: 1px solid #000;
        padding: 8px;
    }

    /* Page breaks */
    .card {
        page-break-inside: avoid;
    }

    /* Black and white */
    body {
        background: white;
        color: black;
    }

    .stat-card,
    .card {
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* === Accessibility Improvements === */
/* Focus states */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* === Utility Classes === */
/* Hide on mobile */
.hide-mobile {
    display: block;
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Show only on mobile */
.show-mobile {
    display: none;
}

@media (max-width: 768px) {
    .show-mobile {
        display: block !important;
    }
}

/* Text alignment utilities */
@media (max-width: 768px) {
    .text-center-mobile {
        text-align: center !important;
    }

    .text-left-mobile {
        text-align: left !important;
    }
}

/* Spacing utilities for mobile */
@media (max-width: 768px) {
    .mt-mobile-1 { margin-top: 0.5rem !important; }
    .mt-mobile-2 { margin-top: 1rem !important; }
    .mt-mobile-3 { margin-top: 1.5rem !important; }

    .mb-mobile-1 { margin-bottom: 0.5rem !important; }
    .mb-mobile-2 { margin-bottom: 1rem !important; }
    .mb-mobile-3 { margin-bottom: 1.5rem !important; }

    .p-mobile-1 { padding: 0.5rem !important; }
    .p-mobile-2 { padding: 1rem !important; }
    .p-mobile-3 { padding: 1.5rem !important; }
}
