/**
 * TMS Umsatz API - Frontend Styles
 * Isolierte CSS-Klassen ohne globale Variablen
 * 
 * @package TMS_Umsatz_API
 * @since 1.0.0
 */

/* ========================================
   CONTAINER
   ======================================== */

.tms-umsatz-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    margin: 24px 0;
}

.tms-umsatz-container * {
    box-sizing: border-box;
}

/* ========================================
   FILTER FORM
   ======================================== */

.tms-filter-form {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
}

.tms-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
}

.tms-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tms-filter-label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tms-select {
    padding: 10px 36px 10px 14px;
    font-size: 14px;
    color: #1e293b;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    min-width: 160px;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.tms-select:hover {
    border-color: #cbd5e1;
}

.tms-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.tms-filter-actions {
    margin-left: auto;
}

.tms-btn-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.tms-btn-filter:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

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

.tms-btn-filter svg {
    width: 16px;
    height: 16px;
}

/* ========================================
   TABLE
   ======================================== */

.tms-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tms-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.tms-data-table thead {
    background: #f8fafc;
}

.tms-data-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.tms-data-table td {
    padding: 14px 16px;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.15s ease;
}

.tms-data-table tbody tr:hover td {
    background-color: #f8fafc;
}

.tms-data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Column Specific Styles */
.tms-col-datum {
    font-weight: 500;
    color: #1e293b;
}

.tms-col-kmsum,
.tms-col-umsum,
.tms-col-sonst_z {
    text-align: right;
    font-weight: 500;
}

/* Summary Row */
.tms-summary-row {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.tms-summary-row td {
    padding: 16px;
    font-weight: 600;
    border-top: 2px solid #e2e8f0;
    border-bottom: none;
}

.tms-summary-label {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 12px;
    color: #64748b;
}

/* Positive/Negative Indicators */
.tms-positive {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%) !important;
    color: #166534 !important;
    border-radius: 8px;
}

.tms-negative {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%) !important;
    color: #991b1b !important;
    border-radius: 8px;
}

/* Table Footer */
.tms-table-footer {
    padding: 12px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tms-record-count {
    font-size: 13px;
    color: #64748b;
}

/* ========================================
   NO DATA STATE
   ======================================== */

.tms-no-data {
    padding: 60px 24px;
    text-align: center;
    color: #64748b;
}

.tms-no-data svg {
    color: #cbd5e1;
    margin-bottom: 16px;
}

.tms-no-data p {
    margin: 0;
    font-size: 15px;
}

/* ========================================
   ERROR STATE
   ======================================== */

.tms-error-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 1px solid #f87171;
    border-radius: 12px;
    margin: 16px 0;
}

.tms-error-container svg {
    color: #dc2626;
    flex-shrink: 0;
}

.tms-error-container span {
    color: #991b1b;
    font-size: 14px;
    line-height: 1.5;
}

/* ========================================
   SUMMARY WIDGET
   ======================================== */

.tms-summary-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    margin: 24px 0;
}

.tms-summary-container * {
    box-sizing: border-box;
}

.tms-summary-header {
    padding: 20px 24px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0;
}

.tms-summary-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
}

.tms-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 1px;
    background: #e2e8f0;
}

.tms-summary-card {
    padding: 24px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tms-summary-card.tms-summary-main {
    grid-column: span 4;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-bottom: 1px solid #e2e8f0;
}

.tms-summary-label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tms-summary-value {
    font-size: 32px;
    font-weight: 700;
    color: #0369a1;
}

.tms-value-secondary {
    font-size: 24px;
    color: #334155;
}

/* Progress Bar */
.tms-progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}

.tms-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.tms-summary-target {
    font-size: 13px;
    color: #64748b;
}

/* Status Colors */
.tms-status-success .tms-summary-main {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
}

.tms-status-success .tms-summary-value {
    color: #166534;
}

.tms-status-success .tms-progress-fill {
    background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
}

.tms-status-warning .tms-summary-main {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.tms-status-warning .tms-summary-value {
    color: #92400e;
}

.tms-status-warning .tms-progress-fill {
    background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
}

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

@media (max-width: 768px) {
    .tms-filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .tms-filter-group {
        width: 100%;
    }
    
    .tms-select {
        width: 100%;
        min-width: 0;
    }
    
    .tms-filter-actions {
        margin-left: 0;
        margin-top: 8px;
    }
    
    .tms-btn-filter {
        width: 100%;
        justify-content: center;
    }
    
    .tms-data-table {
        font-size: 13px;
    }
    
    .tms-data-table th,
    .tms-data-table td {
        padding: 10px 12px;
    }
    
    .tms-summary-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .tms-summary-card.tms-summary-main {
        grid-column: span 2;
    }
    
    .tms-summary-value {
        font-size: 24px;
    }
    
    .tms-value-secondary {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .tms-umsatz-container,
    .tms-summary-container {
        border-radius: 12px;
        margin: 16px 0;
    }
    
    .tms-filter-form {
        padding: 16px;
    }
    
    .tms-summary-grid {
        grid-template-columns: 1fr;
    }
    
    .tms-summary-card.tms-summary-main {
        grid-column: span 1;
    }
    
    .tms-summary-card {
        padding: 16px;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .tms-umsatz-container,
    .tms-summary-container {
        box-shadow: none;
        border: 1px solid #e2e8f0;
    }
    
    .tms-filter-form {
        display: none;
    }
    
    .tms-btn-filter {
        display: none;
    }
    
    .tms-data-table th,
    .tms-data-table td {
        padding: 8px 12px;
    }
}

/* ========================================
   LOADING STATE
   ======================================== */

.tms-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.tms-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: tms-spin 0.8s linear infinite;
}

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