/**
 * Solario Dashboard Styles
 * Brand Colors: #82bc42 (green), #efc436 (yellow), #1e1e1e (dark)
 */

:root {
    --color-primary: #82bc42;
    --color-primary-dark: #6a9e35;
    --color-primary-light: #a3d466;
    --color-secondary: #efc436;
    --color-dark: #1e1e1e;
    --color-light: #f8f9fa;
    --color-white: #ffffff;
    --color-danger: #dc3545;
    --color-warning: #ffc107;
    --color-success: #28a745;
    --color-info: #17a2b8;
    --color-muted: #6c757d;
    --color-border: #dee2e6;
    --color-bg: #f4f6f9;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: all 0.2s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--color-bg);
    color: var(--color-dark);
    line-height: 1.6;
    font-size: 14px;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--color-dark);
    color: var(--color-white);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    height: 40px;
    width: auto;
}

.sidebar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-white);
}

.sidebar-subtitle {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    padding: 16px 0;
}

.nav-section {
    padding: 0 12px;
    margin-bottom: 8px;
}

.nav-section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.4);
    padding: 12px 12px 8px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    border-radius: var(--radius-sm);
    margin: 2px 0;
    transition: var(--transition);
    font-weight: 500;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: var(--color-white);
}

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

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--color-danger);
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
}

.content-header {
    background: var(--color-white);
    padding: 20px 32px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-dark);
}

.page-subtitle {
    font-size: 13px;
    color: var(--color-muted);
    margin-top: 4px;
}

.content-body {
    padding: 24px 32px;
}

/* Cards */
.card {
    background: var(--color-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-dark);
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--color-border);
    background: var(--color-light);
}

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

.stat-card {
    background: var(--color-white);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.green { background: rgba(130, 188, 66, 0.15); color: var(--color-primary); }
.stat-icon.yellow { background: rgba(239, 196, 54, 0.15); color: var(--color-secondary); }
.stat-icon.red { background: rgba(220, 53, 69, 0.15); color: var(--color-danger); }
.stat-icon.blue { background: rgba(23, 162, 184, 0.15); color: var(--color-info); }

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-dark);
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: var(--color-muted);
    margin-top: 4px;
}

.stat-trend {
    font-size: 12px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-trend.up { color: var(--color-success); }
.stat-trend.down { color: var(--color-danger); }

/* Tables */
.table-container {
    overflow-x: auto;
}

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

.data-table th {
    background: var(--color-light);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-muted);
    border-bottom: 2px solid var(--color-border);
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: var(--color-light);
}

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

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-success { background: rgba(40, 167, 69, 0.15); color: var(--color-success); }
.badge-danger { background: rgba(220, 53, 69, 0.15); color: var(--color-danger); }
.badge-warning { background: rgba(255, 193, 7, 0.2); color: #b38600; }
.badge-info { background: rgba(23, 162, 184, 0.15); color: var(--color-info); }
.badge-primary { background: rgba(130, 188, 66, 0.15); color: var(--color-primary); }
.badge-muted { background: var(--color-light); color: var(--color-muted); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-white);
}

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

.btn-secondary {
    background: var(--color-light);
    color: var(--color-dark);
    border: 1px solid var(--color-border);
}

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

.btn-danger {
    background: var(--color-danger);
    color: var(--color-white);
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    padding: 8px;
}

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

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-dark);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: var(--transition);
    background: var(--color-white);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(130, 188, 66, 0.15);
}

.form-control::placeholder {
    color: var(--color-muted);
}

.form-hint {
    font-size: 12px;
    color: var(--color-muted);
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* Calculator Section */
.calculator-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.calculator-form {
    background: var(--color-white);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.calculator-result {
    background: var(--color-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.result-header {
    background: var(--color-primary);
    color: var(--color-white);
    padding: 20px;
    text-align: center;
}

.result-price {
    font-size: 42px;
    font-weight: 700;
}

.result-currency {
    font-size: 20px;
}

.result-method {
    margin-top: 8px;
    opacity: 0.9;
}

.result-body {
    padding: 20px;
}

.result-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}

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

.result-label {
    color: var(--color-muted);
}

.result-value {
    font-weight: 600;
}

/* Product List in Calculator */
.product-list {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.product-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--color-border);
}

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

.product-info {
    flex: 1;
}

.product-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.product-sku {
    font-size: 12px;
    color: var(--color-muted);
}

.product-qty {
    width: 60px;
    text-align: center;
}

.product-remove {
    color: var(--color-danger);
    cursor: pointer;
    padding: 4px;
}

/* Search Box */
.search-box {
    position: relative;
    margin-bottom: 20px;
}

.search-box input {
    padding-left: 40px;
}

.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-muted);
    width: 18px;
    height: 18px;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.search-results.show {
    display: block;
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
}

.search-result-item:hover {
    background: var(--color-light);
}

.search-result-item:last-child {
    border-bottom: none;
}

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.alert svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-success {
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.3);
    color: var(--color-success);
}

.alert-danger {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    color: var(--color-danger);
}

.alert-warning {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    color: #856404;
}

.alert-info {
    background: rgba(23, 162, 184, 0.1);
    border: 1px solid rgba(23, 162, 184, 0.3);
    color: var(--color-info);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--color-dark);
    margin-bottom: 8px;
}

/* Loading */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Tooltips */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-dark);
    color: var(--color-white);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    white-space: nowrap;
    margin-bottom: 8px;
    z-index: 1000;
}

/* Log Types */
.log-type {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.log-type-error { background: #fde8ea; color: var(--color-danger); }
.log-type-warning { background: #fff8e6; color: #b38600; }
.log-type-info { background: #e6f6f8; color: var(--color-info); }
.log-type-sync { background: #e8f5e9; color: var(--color-success); }
.log-type-fallback { background: #fff3e0; color: #e65100; }
.log-type-api_error { background: #f3e5f5; color: #7b1fa2; }

/* Stock Status */
.stock-available { color: var(--color-success); font-weight: 600; }
.stock-low { color: var(--color-warning); font-weight: 600; }
.stock-out { color: var(--color-danger); font-weight: 600; }

/* Pagination */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 20px;
}

.pagination a, .pagination span {
    padding: 8px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--color-dark);
    transition: var(--transition);
}

.pagination a:hover {
    background: var(--color-light);
}

.pagination .active {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

/* Responsive */
@media (max-width: 1024px) {
    .calculator-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        z-index: 1000;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Mobile overlay when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }

    .sidebar-overlay.show {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .content-header {
        padding: 16px 20px;
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .content-header > div:first-child {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .content-body {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-value {
        font-size: 22px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
    }

    /* Mobile menu toggle button */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        background: var(--color-primary);
        border: none;
        border-radius: var(--radius-sm);
        cursor: pointer;
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 998;
        box-shadow: var(--shadow-lg);
    }

    .mobile-menu-btn svg {
        width: 24px;
        height: 24px;
        color: var(--color-white);
    }

    .mobile-menu-btn:active {
        transform: scale(0.95);
    }

    /* Tables responsive */
    .data-table {
        font-size: 13px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }

    /* Hide less important columns on mobile */
    .data-table .hide-mobile {
        display: none;
    }

    /* Cards responsive */
    .card-header {
        padding: 12px 16px;
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    /* Buttons responsive */
    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    .btn-sm {
        padding: 6px 10px;
        font-size: 11px;
    }

    /* Form responsive */
    .form-row {
        grid-template-columns: 1fr;
    }

    /* Calculator responsive */
    .calculator-section {
        gap: 16px;
    }

    .result-price {
        font-size: 32px;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-title {
        font-size: 20px;
    }

    .content-header .btn {
        width: 100%;
        justify-content: center;
    }

    .action-group {
        flex-wrap: wrap;
    }
}

/* Desktop: Hide mobile menu button */
@media (min-width: 769px) {
    .mobile-menu-btn {
        display: none;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--color-muted); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: #b38600; }
.text-primary { color: var(--color-primary); }
.font-bold { font-weight: 700; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.p-4 { padding: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }

/* ==========================================================================
   Skeleton Loading States
   ========================================================================== */

/* Base skeleton animation */
@keyframes skeleton-loading {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.skeleton {
    animation: skeleton-loading 1.2s ease-in-out infinite;
    background: linear-gradient(90deg, #f0f0f0 0px, #e0e0e0 40px, #f0f0f0 80px);
    background-size: 200px 100%;
    border-radius: var(--radius-sm);
}

/* Skeleton variants */
.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 65%; }
.skeleton-text.long { width: 90%; }

.skeleton-title {
    height: 24px;
    width: 50%;
    margin-bottom: 16px;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

.skeleton-button {
    width: 100px;
    height: 36px;
    border-radius: var(--radius);
}

.skeleton-search-result {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--color-border);
}

.skeleton-search-result .skeleton-image {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    flex-shrink: 0;
}

.skeleton-search-result .skeleton-content { flex: 1; }

.skeleton-chart {
    height: 200px;
    border-radius: var(--radius);
}

/* Loading spinner */
.spinner-sm {
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Action Panels - Dashboard Gruppierung */
.action-panels {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 992px) {
    .action-panels {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .action-panels {
        grid-template-columns: 1fr;
    }
}

.action-panel {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.action-panel.has-items {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px rgba(130, 188, 66, 0.2);
}

.action-panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-panel-icon {
    font-size: 24px;
}

.action-panel-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text);
}

.action-panel-body {
    flex: 1;
}

.action-panel-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1;
}

.action-panel-label {
    font-size: 14px;
    color: var(--color-muted);
    margin-top: 4px;
}

.action-panel-btn {
    display: inline-block;
    padding: 10px 16px;
    background: var(--color-primary);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 14px;
    text-align: center;
    transition: background 0.2s;
}

.action-panel-btn:hover {
    background: #6a9a38;
    color: white;
}

.action-panel-status {
    font-size: 14px;
    color: var(--color-muted);
    padding: 10px 0;
}

/* Pickup Panel spezifisch */
.pickup-panel .next-pickup-info {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
    font-size: 14px;
}

.pickup-panel .next-label {
    color: var(--color-muted);
}

.pickup-panel .next-time {
    font-weight: 600;
    color: var(--color-text);
    margin-left: 4px;
}

.pickup-panel .next-customer {
    display: block;
    color: var(--color-muted);
    font-size: 13px;
    margin-top: 2px;
}

/* Traffic Light Inline */
.kpi-traffic-light-inline {
    display: flex;
    gap: 3px;
    margin-left: auto;
}

.traffic-dot-sm {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e0e0e0;
}

.traffic-dot-sm:first-child { background: #ffcccc; }
.traffic-dot-sm:nth-child(2) { background: #fff3cd; }
.traffic-dot-sm:last-child { background: #d4edda; }

.traffic-dot-sm.active:first-child { background: #dc3545; }
.traffic-dot-sm.active:nth-child(2) { background: #ffc107; }
.traffic-dot-sm.active:last-child { background: #28a745; }
