/**
 * Düngemittel Importstatistik - Hauptstylesheet
 */

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f7fa;
    color: #2d3748;
    -webkit-text-size-adjust: 100%;
    line-height: 1.5;
}

/* ===== LOGIN & AUTH ===== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #2f855a 0%, #276749 100%);
}

.auth-box {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

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

.auth-logo h1 {
    color: #2f855a;
    font-size: 24px;
    margin-bottom: 8px;
}

.auth-logo p {
    color: #718096;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #48bb78;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-primary {
    background: #48bb78;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: #38a169;
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

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

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

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.auth-links {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
}

.auth-links a {
    color: #48bb78;
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: #fed7d7;
    color: #c53030;
}

.alert-success {
    background: #c6f6d5;
    color: #276749;
}

/* ===== HEADER & NAVIGATION ===== */
.main-header {
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.main-header h1 {
    color: #2f855a;
    font-size: 20px;
    margin: 0;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 16px;
}

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

.user-info .name {
    font-weight: 600;
    font-size: 14px;
}

.user-info .company {
    font-size: 12px;
    color: #718096;
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-links a {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    color: #4a5568;
    text-decoration: none;
    transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    background: #f0fff4;
    color: #2f855a;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* ===== FILTERS ===== */
.filters {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: flex;
    gap: 16px;
    align-items: end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 160px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group select {
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    width: 100%;
    background: white;
    cursor: pointer;
}

.filter-group select:focus {
    outline: none;
    border-color: #48bb78;
}

/* ===== PRODUCT CARDS ===== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.product-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.product-header-mini {
   // DAS ORIGINAL+++ background: linear-gradient(135deg, #2f855a 0%, #276749 100%);
   background: linear-gradient(135deg, #2f855a 0%, #f7fafc 80%);
    color: white;
    padding: 24px;
}

.product-title-mini {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.product-total-label-mini {
    font-size: 11px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-total-mini {
    font-size: 32px;
    font-weight: 700;
    margin-top: 8px;
}

.product-stats-mini {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 20px;
    background: #f7fafc;
}

.stat-mini {
    text-align: center;
}

.stat-mini-value {
    font-size: 22px;
    font-weight: 700;
    color: #2d3748;
}

.stat-mini-label {
    font-size: 11px;
    color: #718096;
    text-transform: uppercase;
    margin-top: 4px;
}

.yoy-comparison {
    padding: 14px 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.yoy-positive { color: #38a169; font-weight: 600; }
.yoy-negative { color: #e53e3e; font-weight: 600; }
.yoy-neutral { color: #718096; }

/* ===== DETAIL VIEW ===== */
.detail-view {
    display: none;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin-bottom: 24px;
}

.detail-view.active {
    display: block;
}

.detail-header {
    background: linear-gradient(135deg, #2f855a 0%, #276749 100%);
    color: white;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.detail-header h2 {
    margin: 0;
    font-size: 24px;
}

.back-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

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

.detail-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    padding: 20px;
    background: #f7fafc;
}

.detail-stat {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.detail-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #2d3748;
}

.detail-stat-label {
    font-size: 11px;
    color: #718096;
    text-transform: uppercase;
    margin-top: 4px;
}

.detail-stat-change {
    font-size: 13px;
    margin-top: 6px;
    font-weight: 600;
}

.chart-container {
    padding: 24px;
    height: 300px;
    background: white;
}

/* ===== TABLES ===== */
.mobile-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.mobile-table th {
    background: #f7fafc;
    padding: 14px 12px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    font-size: 11px;
    text-transform: uppercase;
}

.mobile-table td {
    padding: 14px 12px;
    border-bottom: 1px solid #edf2f7;
    vertical-align: middle;
}

.mobile-table tr:hover {
    background: #f7fafc;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 13px;
}

.rank-1 { background: #ffd700; color: #744210; }
.rank-2 { background: #c0c0c0; color: #4a5568; }
.rank-3 { background: #cd7f32; color: white; }
.rank-other { background: #e2e8f0; color: #4a5568; }

.country-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.flag {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.number {
    font-family: 'SF Mono', monospace;
    font-size: 14px;
}

.number-total {
    font-weight: 700;
    color: #2d3748;
}

/* ===== ADMIN PANEL ===== */
.admin-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.admin-section h2 {
    color: #2d3748;
    font-size: 18px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0fff4;
}

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

.stat-card {
    background: linear-gradient(135deg, #f0fff4 0%, #e6fffa 100%);
    padding: 24px;
    border-radius: 12px;
    text-align: center;
}

.stat-card-value {
    font-size: 36px;
    font-weight: 700;
    color: #2f855a;
}

.stat-card-label {
    font-size: 13px;
    color: #4a5568;
    margin-top: 4px;
}

.upload-area {
    border: 3px dashed #cbd5e0;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #48bb78;
    background: #f0fff4;
}

.upload-area.dragover {
    border-color: #48bb78;
    background: #f0fff4;
}

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

.user-table th,
.user-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.user-table th {
    font-weight: 600;
    color: #4a5568;
    font-size: 12px;
    text-transform: uppercase;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #c6f6d5;
    color: #276749;
}

.badge-danger {
    background: #fed7d7;
    color: #c53030;
}

.badge-admin {
    background: #bee3f8;
    color: #2c5282;
}

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

.modal {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 450px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.modal h3 {
    margin-bottom: 12px;
    color: #2d3748;
}

.modal p {
    color: #718096;
    margin-bottom: 20px;
    line-height: 1.5;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ===== LOADING & MESSAGES ===== */
.loading {
    text-align: center;
    padding: 40px;
    color: #718096;
}

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: #48bb78;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #718096;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .auth-box {
        padding: 24px;
    }
    
    .main-header {
        flex-direction: column;
        text-align: center;
    }
    
    .user-menu {
        flex-direction: column;
        width: 100%;
    }
    
    .user-info {
        text-align: center;
    }
    
    .nav-links {
        justify-content: center;
        width: 100%;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .detail-header {
        flex-direction: column;
        text-align: center;
    }
    
    .chart-container {
        height: 250px;
        padding: 16px;
    }
    
    .mobile-table {
        font-size: 12px;
    }
    
    .mobile-table th,
    .mobile-table td {
        padding: 10px 8px;
    }
    
    .flag {
        width: 24px;
        height: 24px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .user-table {
        display: block;
        overflow-x: auto;
    }
}

/* ===== UTILITIES ===== */
.hidden {
    display: none !important;
}

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

.mt-4 {
    margin-top: 16px;
}

.mb-4 {
    margin-bottom: 16px;
}
