/* =============================================
   EINSATZPLANUNGSTOOL - MOBILE FIRST FRONTEND
   ============================================= */

/* v5.17.3: DM Sans self-hosted (woff2, SIL OFL) — kein Google-CDN, DSGVO.
   Vier statische Schnitte (400/500/600/700), Latin-Subset (deckt DE/FR/EN/IT
   inkl. Umlaute/Akzente ab). Lizenz: assets/fonts/OFL-DM-Sans.txt */
@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/dm-sans-400.woff2') format('woff2');
}
@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/dm-sans-500.woff2') format('woff2');
}
@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/dm-sans-600.woff2') format('woff2');
}
@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/dm-sans-700.woff2') format('woff2');
}

:root {
    /* v5.17.3: Ökosystem-Grün (CRM hellblau, Messenger lila, EPT grün) —
       ersetzt das bisherige, undifferenzierte WP-Admin-Blau. Gilt für
       Login/Mitarbeiter/Team/Controlling. Planning-Portal behält bewusst
       seine eigene Navy-Akzentfarbe (analog CRM-Backoffice-Differenzierung). */
    --primary: #27AE60;
    --primary-dark: #1E8449;
    --success: #00a32a;
    --warning: #f39c12;
    --danger: #d63638;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-500: #6c757d;
    --gray-700: #495057;
    --gray-900: #212529;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.2s ease;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--gray-100);
    color: var(--gray-900);
    margin: 0;
    padding: 0;
    line-height: 1.5;
    font-size: 16px;
    min-height: 100vh;
    padding-bottom: 80px; /* Space for bottom nav */
}

/* Container */
.ept-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 15px;
}

@media (min-width: 768px) {
    .ept-container {
        max-width: 800px;
        padding: 20px;
    }
}

/* Header */
.ept-header {
    background: var(--primary);
    color: #fff;
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.ept-header h1 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.ept-header-sub {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 2px;
}

.ept-header-actions {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.ept-header-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}

.ept-header-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* Grüner Plus-Button (v5.11.6) */
.ept-header-btn-add {
    background: #27ae60;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    max-width: 44px;
    max-height: 44px;
    border-radius: 50%;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.ept-header-btn-add:hover,
.ept-header-btn-add:active {
    background: #219a52;
}

/* Bottom Navigation */
.ept-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 100;
}

.ept-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--gray-500);
    font-size: 0.7rem;
    padding: 5px 15px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    min-width: 60px;
}

.ept-nav-item.active {
    color: var(--primary);
}

.ept-nav-item:hover {
    background: var(--gray-100);
}

.ept-nav-icon {
    font-size: 1.4rem;
    margin-bottom: 2px;
}

/* Cards */
.ept-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 15px;
    overflow: hidden;
}

.ept-card-header {
    padding: 15px;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ept-card-body {
    padding: 15px;
}

.ept-card-footer {
    padding: 12px 15px;
    background: var(--gray-100);
    border-top: 1px solid var(--gray-200);
}

/* Shift Card (für Arbeitseinsätze) */
.ept-shift-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    border-left: 4px solid var(--primary);
    overflow: hidden;
}

.ept-shift-card.completed {
    border-left-color: var(--success);
    opacity: 0.8;
}

.ept-shift-card.cancelled {
    border-left-color: var(--gray-300);
    opacity: 0.5;
}

.ept-shift-main {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.ept-shift-time {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.ept-shift-time small {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--gray-500);
}

.ept-shift-info {
    flex: 1;
    margin-left: 15px;
}

.ept-shift-project {
    font-weight: 600;
    font-size: 1rem;
}

.ept-shift-details {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 3px;
}

.ept-shift-hours {
    text-align: right;
}

.ept-shift-hours-value {
    font-size: 1.3rem;
    font-weight: 700;
}

.ept-shift-hours-label {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.ept-shift-actions {
    display: flex;
    border-top: 1px solid var(--gray-200);
}

.ept-shift-action {
    flex: 1;
    padding: 12px;
    text-align: center;
    background: none;
    border: none;
    font-size: 0.85rem;
    color: var(--primary);
    cursor: pointer;
    transition: var(--transition);
}

.ept-shift-action:not(:last-child) {
    border-right: 1px solid var(--gray-200);
}

.ept-shift-action:hover {
    background: var(--gray-100);
}

/* KPI Cards */
.ept-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.ept-kpi {
    background: #fff;
    padding: 15px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.ept-kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
}

.ept-kpi-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 3px;
}

/* Buttons */
.ept-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    min-height: 48px; /* Touch target */
}

.ept-btn-primary {
    background: var(--primary);
    color: #fff;
}

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

.ept-btn-success {
    background: var(--success);
    color: #fff;
}

.ept-btn-danger {
    background: var(--danger);
    color: #fff;
}

.ept-btn-outline {
    background: #fff;
    color: var(--primary);
    border: 2px solid var(--primary);
}

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

.ept-btn-lg {
    padding: 16px 32px;
    font-size: 1.1rem;
}

.ept-btn-sm {
    padding: 10px 16px;
    font-size: 0.9rem;
    min-height: 40px;
}

/* Forms */
.ept-form-group {
    margin-bottom: 20px;
}

.ept-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.ept-input,
.ept-select,
.ept-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--gray-300);
    color: #2c3e50;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: var(--transition);
    background: #fff;
    -webkit-appearance: none;
}

.ept-input:focus,
.ept-select:focus,
.ept-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.15);
}

.ept-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236c757d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

/* Date/Time inputs */
.ept-input[type="date"],
.ept-input[type="time"] {
    min-height: 50px;
}

/* Lists */
.ept-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ept-list-item {
    padding: 15px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 12px;
}

.ept-list-item:last-child {
    border-bottom: none;
}

.ept-list-item-icon {
    font-size: 1.5rem;
}

.ept-list-item-content {
    flex: 1;
}

.ept-list-item-title {
    font-weight: 600;
}

.ept-list-item-sub {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.ept-list-item-action {
    color: var(--gray-500);
}

/* Badges */
.ept-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.ept-badge-primary { background: var(--primary); color: #fff; }
.ept-badge-success { background: var(--success); color: #fff; }
.ept-badge-warning { background: var(--warning); color: #fff; }
.ept-badge-danger { background: var(--danger); color: #fff; }
.ept-badge-gray { background: var(--gray-200); color: var(--gray-700); }

/* Empty State */
.ept-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
}

.ept-empty-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.ept-empty-text {
    font-size: 1rem;
}

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

.ept-modal.active {
    display: flex;
}

.ept-modal-content {
    background: #fff;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    border-radius: var(--radius) var(--radius) 0 0;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.ept-modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: #fff;
}

.ept-modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.ept-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-500);
    padding: 5px;
}

.ept-modal-body {
    padding: 20px;
}

/* Calendar */
.ept-calendar-day {
    background: #fff;
    border-radius: var(--radius);
    margin-bottom: 15px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.ept-calendar-day-header {
    background: var(--gray-100);
    padding: 12px 15px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
}

.ept-calendar-day-date {
    color: var(--primary);
}

.ept-calendar-day-count {
    color: var(--gray-500);
    font-size: 0.85rem;
}

/* Quick Actions */
.ept-quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.ept-quick-action {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px 15px;
    text-align: center;
    text-decoration: none;
    color: var(--gray-700);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.ept-quick-action:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.ept-quick-action-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.ept-quick-action-label {
    font-weight: 600;
    font-size: 0.9rem;
}

/* Section Headers */
.ept-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 0 5px;
}

.ept-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.ept-section-action {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
}

/* Status Indicator */
.ept-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.ept-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.ept-status-dot.online { background: var(--success); }
.ept-status-dot.offline { background: var(--gray-300); }
.ept-status-dot.busy { background: var(--danger); }

/* Tabs */
.ept-tabs {
    display: flex;
    background: #fff;
    border-radius: var(--radius);
    padding: 5px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.ept-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    transition: var(--transition);
}

.ept-tab.active {
    background: var(--primary);
    color: #fff;
}

/* Alert */
.ept-alert {
    padding: 15px;
    border-radius: var(--radius-sm);
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

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

/* Login Page */
.ept-login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.ept-login-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 30px 25px;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
}

.ept-login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.ept-login-logo img {
    max-width: 180px;
    height: auto;
}

.ept-login-logo h1 {
    font-size: 1.5rem;
    color: var(--primary);
    margin: 15px 0 5px;
}

.ept-login-logo p {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin: 0;
}

/* Pull to Refresh */
.ept-ptr {
    text-align: center;
    padding: 15px;
    color: var(--gray-500);
    font-size: 0.85rem;
}

/* Loading */
.ept-loading {
    display: flex;
    justify-content: center;
    padding: 40px;
}

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

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

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.hidden { display: none !important; }

/* Desktop Enhancements */
@media (min-width: 768px) {
    .ept-bottom-nav {
        position: static;
        max-width: 800px;
        margin: 0 auto 20px;
        border-radius: var(--radius);
        box-shadow: var(--shadow);
    }
    
    body {
        padding-bottom: 20px;
    }
    
    .ept-kpi-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .ept-quick-actions {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .ept-modal-content {
        border-radius: var(--radius);
        margin: auto;
    }
    
    .ept-modal {
        align-items: center;
    }
}

/* Drucken-Button auf Mobilgeräten ausblenden (v5.11.5) */
@media (max-width: 600px) {
    .ept-hide-mobile { display: none !important; }
}

/* Druckansicht: nur Inhalt zeigen (v5.11.6) */
@media print {
    .ept-header, .ept-top-nav, .ept-bottom-nav, .ept-nav-bottom,
    #hours-month, #hours-year,
    .ept-btn-sm, .ept-btn,
    select[onchange="updateHoursFilter()"],
    button[onclick="window.print()"],
    button[onclick="exportHoursCSV()"],
    a[href*="ept_action=pdf_hours"] {
        display: none !important;
    }
    .ept-card { box-shadow: none !important; border: none !important; padding: 0 !important; }
    .hours-print-header { display: flex !important; }
    body { background: #fff !important; }
}

/* Dark Mode: deaktiviert (v5.11.5) – wird nicht korrekt unterstützt */

/* ============================================================
   GLOBALE SCHRIFTFARBE FÜR ALLE FORMULARFELDER (v5.12.4)
   Gilt für alle Portale: Login, Mitarbeiter, Team, Planung, Controlling
   ============================================================ */
input,
select,
textarea,
.ept-input,
.ept-select,
.ept-textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="search"] {
    color: #2c3e50 !important;
    -webkit-text-fill-color: #2c3e50 !important;
}

/* Browser-Autofill (Chrome/Safari/Edge) */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
select:-webkit-autofill,
textarea:-webkit-autofill {
    -webkit-text-fill-color: #2c3e50 !important;
    color: #2c3e50 !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Placeholder bleibt grau */
input::placeholder,
textarea::placeholder,
.ept-input::placeholder {
    color: #8a95a5 !important;
    -webkit-text-fill-color: #8a95a5 !important;
}

/* Focus-Zustand */
input:focus,
select:focus,
textarea:focus {
    color: #2c3e50 !important;
    -webkit-text-fill-color: #2c3e50 !important;
}
