/* Kalender-Styles – Tepto Corporate Design */

/* Filter-Layout für Kalender */
.filter-calendar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) auto auto;
    gap: 20px;
    align-items: end;
}

.view-toggle {
    display: flex;
    gap: 12px;
}

/* ============================================================
   WOCHENSEKTIONEN
   ============================================================ */

.week-section {
    background: var(--surface);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    box-shadow: var(--shadow-2dp);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

    .week-section:hover {
        box-shadow: var(--shadow-4dp);
    }

.week-header {
    background: var(--gradient-gray-v04);
    color: var(--on-primary);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    position: relative;
}

    .week-header::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        width: 48px;
        height: 3px;
        background: var(--tepto-primary);
    }

.week-title {
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 16px;
}

.week-number {
    background: rgba(255, 255, 255, 0.15);
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 500;
}

.week-stats {
    font-size: 0.8125rem;
    opacity: 0.9;
    display: flex;
    gap: 16px;
}

.week-stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ============================================================
   LIEFERUNGS-GRID
   ============================================================ */

.deliveries-grid {
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 16px;
}

.no-deliveries-week {
    padding: 40px 24px;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    font-family: 'Poppins', sans-serif;
}

/* ============================================================
   LIEFERUNGS-KARTEN
   ============================================================ */

.delivery-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

    .delivery-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 4px;
        height: 100%;
        background: var(--tepto-primary);
        transform: scaleY(0);
        transition: transform 0.2s ease;
    }

    .delivery-card:hover {
        border-color: var(--tepto-primary);
        box-shadow: var(--shadow-4dp);
        transform: translateY(-2px);
    }

        .delivery-card:hover::before {
            transform: scaleY(1);
        }

    /* Status-spezifische Karten */
    .delivery-card.overdue {
        border-left: 4px solid var(--tepto-error);
        background-color: rgba(184, 58, 0, 0.03);
    }

        .delivery-card.overdue::before {
            background: var(--tepto-error);
        }

    .delivery-card.due-soon {
        border-left: 4px solid var(--tepto-warning);
        background-color: rgba(237, 158, 0, 0.03);
    }

        .delivery-card.due-soon::before {
            background: var(--tepto-warning);
        }

    .delivery-card.on-time {
        border-left: 4px solid var(--tepto-success);
        background-color: rgba(120, 184, 51, 0.03);
    }

        .delivery-card.on-time::before {
            background: var(--tepto-success);
        }

/* ============================================================
   KARTEN-HEADER
   ============================================================ */

.delivery-header-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.delivery-reference-card {
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    color: var(--tepto-secondary);
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}

.delivery-order-link {
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: 'Poppins', sans-serif;
}

    .delivery-order-link:hover {
        color: var(--tepto-primary);
        text-decoration: underline;
    }

/* ============================================================
   TAGE-INDIKATOR
   ============================================================ */

.days-indicator {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    text-align: center;
    min-width: 60px;
    white-space: nowrap;
    color: white;
    font-family: 'Poppins', sans-serif;
    letter-spacing: 0.02em;
}

.days-overdue {
    background: linear-gradient(135deg, var(--tepto-error) 0%, #8f2d00 100%);
}

.days-due-soon {
    background: linear-gradient(135deg, var(--tepto-warning) 0%, #c47d00 100%);
}

.days-on-time {
    background: var(--gradient-green-v01);
}

.days-completed {
    background: var(--gradient-green-v01);
    font-weight: 600;
}

.days-cancelled {
    background: linear-gradient(135deg, #616161 0%, #333333 100%);
    font-weight: 600;
}

/* ============================================================
   LIEFERUNGS-INFO GRID
   ============================================================ */

.delivery-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    font-size: 0.8125rem;
}

.delivery-info-item {
    display: flex;
    flex-direction: column;
}

.delivery-info-label {
    color: var(--text-muted);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    margin-bottom: 4px;
    font-family: 'Poppins', sans-serif;
}

.delivery-info-value {
    color: var(--on-surface);
    font-weight: 400;
    font-family: 'Poppins', sans-serif;
}

.delivery-date-info {
    grid-column: 1 / -1;
    background: rgba(120, 184, 51, 0.05);
    border: 1px solid rgba(120, 184, 51, 0.15);
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.date-display {
    font-weight: 500;
    color: var(--on-surface);
    font-family: 'Poppins', sans-serif;
}

/* ============================================================
   LEGENDE
   ============================================================ */

.legend {
    background: var(--surface);
    padding: 16px 24px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    box-shadow: var(--shadow-2dp);
    border: 1px solid var(--border);
}

.legend-title {
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--tepto-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-family: 'Poppins', sans-serif;
}

.legend-items {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--on-surface);
    font-family: 'Poppins', sans-serif;
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: var(--radius-sm);
}

.legend-overdue {
    background-color: var(--tepto-error);
}

.legend-due-soon {
    background-color: var(--tepto-warning);
}

.legend-on-time {
    background-color: var(--tepto-success);
}

/* ============================================================
   BESTELLUNGSDETAILS MODAL
   ============================================================ */

.order-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.order-detail-item {
    display: flex;
    flex-direction: column;
    padding: 16px;
    background: var(--tepto-gray-light);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.order-detail-label {
    color: var(--text-muted);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    margin-bottom: 8px;
    font-family: 'Poppins', sans-serif;
}

.order-detail-value {
    color: var(--on-surface);
    font-weight: 400;
    font-size: 0.9375rem;
    font-family: 'Poppins', sans-serif;
}

.order-deliveries-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.order-deliveries-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--tepto-secondary);
    margin-bottom: 16px;
    font-family: 'Poppins', sans-serif;
    position: relative;
    padding-left: 14px;
}

    .order-deliveries-title::before {
        content: '';
        position: absolute;
        left: 0;
        top: 2px;
        bottom: 2px;
        width: 4px;
        background: var(--tepto-primary);
        border-radius: 2px;
    }

.order-delivery-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    font-size: 0.8125rem;
    transition: box-shadow 0.2s ease;
}

    .order-delivery-item:hover {
        box-shadow: var(--shadow-2dp);
    }

.order-delivery-reference {
    font-weight: 600;
    color: var(--tepto-secondary);
    grid-column: 1 / -1;
    margin-bottom: 8px;
    font-family: 'Poppins', sans-serif;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .filter-calendar {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .view-toggle {
        justify-content: center;
    }

    .deliveries-grid {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .week-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .week-stats {
        flex-direction: column;
        gap: 8px;
    }

    .legend-items {
        justify-content: center;
    }

    .delivery-info-grid {
        grid-template-columns: 1fr;
    }

    .delivery-date-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .order-details-grid {
        grid-template-columns: 1fr;
    }

    .order-delivery-item {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .legend {
        padding: 12px 16px;
    }

    .legend-items {
        flex-direction: column;
        gap: 12px;
    }

    .week-section {
        margin-bottom: 16px;
    }

    .deliveries-grid {
        padding: 12px;
        gap: 12px;
    }

    .delivery-card {
        padding: 16px;
    }

    .delivery-header-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ============================================================
   BESTELLUNGS-GRUPPEN
   ============================================================ */

.order-group {
    grid-column: 1 / -1;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

    .order-group:hover {
        box-shadow: var(--shadow-4dp);
    }

    .order-group.order-group-overdue {
        border-left: 4px solid var(--tepto-error);
    }

    .order-group.order-group-due-soon {
        border-left: 4px solid var(--tepto-warning);
    }

    .order-group.order-group-on-time {
        border-left: 4px solid var(--tepto-success);
    }

.order-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: var(--tepto-gray-light);
    border-bottom: 1px solid var(--border);
    gap: 16px;
    flex-wrap: wrap;
}

.og-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.og-order-number {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    color: var(--tepto-secondary);
}

    .og-order-number i {
        color: var(--tepto-primary);
        font-size: 1.1rem;
    }

.og-order-link {
    color: var(--tepto-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

    .og-order-link:hover {
        color: var(--tepto-primary);
        text-decoration: underline;
    }

.og-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: 'Poppins', sans-serif;
    flex-wrap: wrap;
}

    .og-meta i {
        font-size: 0.75rem;
    }

.og-dot {
    color: var(--border);
}

.og-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.og-status-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.og-status-pill {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    white-space: nowrap;
}

.og-count-badge {
    background: var(--tepto-primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-family: 'Poppins', sans-serif;
    white-space: nowrap;
}

.og-toggle-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-muted);
    flex-shrink: 0;
}

    .og-toggle-btn:hover {
        background: var(--border);
        color: var(--tepto-secondary);
    }

.order-group-body {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    max-height: 2000px;
    opacity: 1;
}

    .order-group-body.collapsed {
        max-height: 0;
        opacity: 0;
    }

/* ============================================================
   KOMPAKTE LIEFERUNGSKARTE (innerhalb einer Gruppe)
   ============================================================ */

.og-deliveries-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    padding: 16px 20px;
}

.compact-delivery-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

    .compact-delivery-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: var(--border);
        transition: background 0.2s;
    }

    .compact-delivery-card.compact-overdue::before {
        background: var(--tepto-error);
    }

    .compact-delivery-card.compact-due-soon::before {
        background: var(--tepto-warning);
    }

    .compact-delivery-card.compact-on-time::before {
        background: var(--tepto-success);
    }

    .compact-delivery-card:hover {
        border-color: var(--tepto-primary);
        box-shadow: var(--shadow-4dp);
        transform: translateY(-2px);
    }

.cdc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.cdc-reference {
    font-weight: 600;
    font-size: 0.9rem;
    font-family: 'Poppins', sans-serif;
    color: var(--tepto-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cdc-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cdc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-family: 'Poppins', sans-serif;
}

.cdc-label {
    color: var(--text-muted);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
    flex-shrink: 0;
}

.cdc-value {
    color: var(--on-surface);
    font-weight: 400;
    text-align: right;
}

.cdc-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'Poppins', sans-serif;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    gap: 8px;
    flex-wrap: wrap;
}

    .cdc-footer i {
        color: var(--tepto-primary);
        margin-right: 3px;
    }

.cdc-tracking {
    font-size: 0.7rem;
    opacity: 0.8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}

/* ============================================================
   KARTEN-ANIMATIONEN
   ============================================================ */

.delivery-card.fade-in {
    animation: cardFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.week-section.slide-in {
    animation: weekSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes weekSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================================
   PRÜFSTATUS BADGES
   ============================================================ */

.inspection-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.6875rem;
    font-weight: 600;
    margin-top: 4px;
    font-family: 'Poppins', sans-serif;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.inspection-alles-okay {
    background-color: rgba(120, 184, 51, 0.12);
    color: var(--tepto-green-dark);
}

.inspection-unterliefert {
    background-color: rgba(237, 158, 0, 0.12);
    color: #b87a00;
}

.inspection-überliefert {
    background-color: rgba(77, 160, 163, 0.12);
    color: #3d8a8d;
}

.inspection-falscher-artikel {
    background-color: rgba(184, 58, 0, 0.10);
    color: var(--tepto-error);
}

.inspection-beschädigt {
    background-color: rgba(184, 58, 0, 0.10);
    color: var(--tepto-error);
}

/* ============================================================
   TEXTAREA
   ============================================================ */

textarea {
    font-family: 'Poppins', sans-serif;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea:focus {
    border-color: var(--tepto-primary);
    box-shadow: 0 0 0 3px rgba(120, 184, 51, 0.15);
}

/* ============================================================
   DOKUMENTEN-UPLOAD
   ============================================================ */

.document-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    background: var(--tepto-gray-light);
    cursor: pointer;
    transition: all 0.2s ease;
}

    .document-upload-area:hover {
        border-color: var(--tepto-primary);
        background: rgba(120, 184, 51, 0.04);
    }

    .document-upload-area.drag-over {
        border-color: var(--tepto-primary);
        background: rgba(120, 184, 51, 0.08);
    }

.upload-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.document-list {
    margin-top: 16px;
}

.document-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: box-shadow 0.2s ease;
}

    .document-item:hover {
        box-shadow: var(--shadow-2dp);
    }

.document-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.document-details {
    flex: 1;
}

.document-name {
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    color: var(--tepto-secondary);
}

.document-size {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.document-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Poppins', sans-serif;
}

    .btn-icon:hover {
        background: var(--tepto-gray-light);
        border-color: var(--border-hover);
    }

    .btn-icon i {
        font-size: 16px;
    }

/* ============================================================
   MODAL HEADER ACTIONS
   ============================================================ */

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Delete Delivery Button */
.btn-delete-delivery {
    background-color: var(--tepto-error);
    color: var(--on-primary);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(184, 58, 0, 0.3);
}

    .btn-delete-delivery:hover {
        background-color: #a03300;
        transform: scale(1.1);
        box-shadow: 0 4px 8px rgba(184, 58, 0, 0.4);
    }

    .btn-delete-delivery:active {
        transform: scale(0.95);
    }

    .btn-delete-delivery i {
        font-size: 1rem;
    }

/* Print Label Button */
.btn-print-label {
    background-color: var(--tepto-info);
    color: var(--on-primary);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(77, 160, 163, 0.3);
}

    .btn-print-label:hover {
        background-color: #3d8a8d;
        transform: scale(1.1);
        box-shadow: 0 4px 8px rgba(77, 160, 163, 0.4);
    }

    .btn-print-label:active {
        transform: scale(0.95);
    }

    .btn-print-label i {
        font-size: 1rem;
    }

#print-label-modal .form-group input[type="number"]::-webkit-outer-spin-button,
#print-label-modal .form-group input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#print-label-modal small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.filter-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--tepto-primary);
}

.filter-group label {
    margin: 0;
}
