/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

/* Tabs */
.tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 2px solid #e0e0e0;
    overflow-x: auto;
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.tab-btn.active {
    background: white;
    color: #667eea;
    border-bottom: 3px solid #667eea;
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 30px;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card */
.card {
    background: white;
}

.card h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.card h3 {
    color: #333;
    margin: 20px 0 10px;
    font-size: 1.2rem;
}

/* Card header (used by Bild-Import button) */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
    flex-wrap: wrap;
}

.card-header h2 {
    margin-bottom: 0;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="file"],
.form-group select {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.month-selector {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 10px;
}

.input-group {
    display: flex;
    gap: 10px;
}

.input-group input {
    flex: 1;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    margin-right: 10px;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
    margin-right: 10px;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.875rem;
}

/* Duties List */
.duties-list {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.duty-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.duty-item.qualifying {
    border-left-color: #28a745;
    background: #f0f9f4;
}

.duty-info {
    flex: 1;
}

.duty-date {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.duty-meta {
    font-size: 0.875rem;
    color: #666;
}

.duty-share {
    font-weight: 500;
    margin-right: 15px;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 8px;
}

.badge-qualifying {
    background: #28a745;
    color: white;
}

.badge-normal {
    background: #6c757d;
    color: white;
}

/* Employee List */
.employee-list {
    margin-top: 20px;
}

.employee-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.employee-name {
    font-weight: 500;
    color: #333;
}

/* Calculation Results */
#calculation-results {
    margin-top: 30px;
}

.result-card {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 5px solid #667eea;
}

.result-card h3 {
    color: #667eea;
    margin-bottom: 15px;
}

.result-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.result-item {
    background: white;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.result-label {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 5px;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.result-value.success {
    color: #28a745;
}

.result-value.warning {
    color: #ffc107;
}

.result-value.danger {
    color: #dc3545;
}

.bonus-total {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin-top: 20px;
}

.bonus-total h4 {
    font-size: 1rem;
    margin-bottom: 10px;
    opacity: 0.9;
}

.bonus-total .amount {
    font-size: 2.5rem;
    font-weight: 700;
}

.threshold-warning {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 6px;
    padding: 15px;
    margin: 20px 0;
}

.threshold-warning h4 {
    color: #856404;
    margin-bottom: 5px;
}

.threshold-warning p {
    color: #856404;
    margin: 0;
}

/* Settings */
.settings-section {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.settings-section:last-child {
    border-bottom: none;
}

.info-box {
    background: #e7f3ff;
    border-left: 4px solid #2196f3;
    padding: 20px;
    border-radius: 6px;
    margin-top: 15px;
}

.info-box h4 {
    color: #1976d2;
    margin: 15px 0 10px;
}

.info-box h4:first-child {
    margin-top: 0;
}

.info-box ul {
    margin-left: 20px;
}

.info-box li {
    margin-bottom: 5px;
}

.info-box p {
    margin-top: 10px;
}

/* Utility Classes */
.text-muted {
    color: #6c757d;
    font-style: italic;
}

.text-warning {
    color: #856404;
    font-weight: 500;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #333;
    color: white;
    padding: 15px 25px;
    border-radius: 6px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background: #28a745;
}

.toast.error {
    background: #dc3545;
}

.toast.info {
    background: #17a2b8;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .tab-content {
        padding: 20px;
    }

    .month-selector {
        grid-template-columns: 1fr;
    }

    .result-summary {
        grid-template-columns: 1fr;
    }

    .input-group {
        flex-direction: column;
    }

    .tabs {
        overflow-x: auto;
    }

    .tab-btn {
        font-size: 0.875rem;
        padding: 12px 15px;
    }

    .bonus-total .amount {
        font-size: 2rem;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .container {
        box-shadow: none;
    }

    .tabs,
    .btn,
    .form-group {
        display: none;
    }

    .tab-content {
        display: block !important;
        padding: 20px 0;
    }
}

/* ============================================================
   Bild-Import Modal (Feature A)
   ============================================================ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal[hidden] { display: none; }

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    padding: 30px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.modal-stage {
    animation: fadeIn 0.2s ease;
}

.modal-stage[hidden] { display: none; }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.privacy-notice {
    font-size: 0.875rem;
    color: #6c757d;
    margin-bottom: 15px;
    font-style: italic;
}

.drag-drop-zone {
    border: 2px dashed #c0c0c8;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    transition: all 0.2s ease;
    margin-bottom: 15px;
}

.drag-drop-zone.drag-over {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.drag-drop-zone p {
    margin-bottom: 15px;
    color: #555;
}

.thumbnail-preview {
    display: flex;
    gap: 15px;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 15px;
}

.thumbnail-preview img {
    max-width: 240px;
    max-height: 240px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.thumbnail-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.875rem;
    color: #555;
}

.spinner {
    width: 48px;
    height: 48px;
    margin: 30px auto;
    border: 4px solid #e0e0e0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.unknown-names-box {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

.unknown-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    flex-wrap: wrap;
}

.unknown-name-row:last-child { border-bottom: none; }

.unknown-name-row .unknown-candidate {
    font-weight: 600;
    flex: 1;
    min-width: 140px;
}

.unknown-name-row select {
    flex: 2;
    min-width: 180px;
    padding: 6px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
}

.unknown-name-row .fuzzy-hint {
    flex-basis: 100%;
    font-size: 0.8rem;
    color: #856404;
    padding-left: 4px;
}

.preview-employee-group {
    margin-bottom: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    padding: 15px;
}

.preview-employee-group h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
}

.preview-table th,
.preview-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #e0e0e0;
    text-align: left;
    font-size: 0.9rem;
}

.preview-table th { background: #ececf3; }

.preview-row.outside-month { background: #fff0f0; }

.preview-row .row-remove-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.slot-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

.slot-badge.slot-fr { background: #fd7e14; }
.slot-badge.slot-sa { background: #dc3545; }
.slot-badge.slot-so { background: #dc3545; }
.slot-badge.slot-weekday { background: #6c757d; }

.api-key-status-ok { color: #28a745; font-weight: 500; }
.api-key-status-none { color: #6c757d; font-style: italic; }

/* === Variants UI === */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.vacation-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
}

.vacation-toggle input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.vacation-active-banner {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 12px;
    color: #856404;
    font-size: 0.9rem;
}

.classified-summary {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    margin: 12px 0;
    font-size: 0.9rem;
}

.variant-details {
    margin-top: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    padding: 10px 15px;
}

.variant-details summary {
    cursor: pointer;
    font-weight: 500;
    color: #667eea;
    padding: 4px 0;
}

.variant-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px 15px;
    margin: 10px 0;
}

.variant-card.winner {
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.15);
}

.variant-header {
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.variant-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    margin-right: 6px;
    background: #28a745;
    color: white;
    font-weight: 600;
}

.variant-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 0;
    font-size: 0.85rem;
    color: #555;
    border-top: 1px solid #f0f0f0;
}

.variant-row:first-of-type {
    border-top: none;
}

.variant-bonus {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.variant-eligible {
    color: #28a745;
    font-weight: 600;
}

.variant-not-eligible {
    color: #dc3545;
    font-weight: 600;
}

/* === Date Stepper === */
.date-stepper {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 6px;
    align-items: stretch;
}

.date-stepper input[type="date"] {
    /* override the .form-group width */
    width: 100%;
}

.date-stepper button {
    padding: 0 14px;
    margin: 0;
    font-size: 1.2rem;
    line-height: 1;
    min-width: 44px;
}

.date-stepper button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
