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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f7;
    min-height: 100vh;
    padding: 0;
    color: #1d1d1f;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: #1d1d1f;
    padding: 24px 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: #1d1d1f;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.exchange-rate {
    background: rgba(0, 0, 0, 0.04);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 15px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
}

.exchange-rate:hover {
    background: rgba(0, 0, 0, 0.06);
}

.exchange-rate .label {
    color: #6e6e73;
}

.exchange-rate input[type="number"] {
    width: 70px;
    padding: 6px 10px;
    border: none;
    border-radius: 8px;
    background: white;
    font-size: 15px;
    font-weight: 600;
    color: #1d1d1f;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.exchange-rate input[type="number"]:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 125, 250, 0.1);
}

.exchange-rate .rate-suffix {
    font-weight: 600;
    color: #6e6e73;
}

/* Logout Button */
.logout-btn {
    padding: 8px 16px;
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
    border: 1px solid rgba(255, 59, 48, 0.2);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.logout-btn:hover {
    background: rgba(255, 59, 48, 0.15);
    border-color: rgba(255, 59, 48, 0.3);
    transform: translateY(-1px);
}

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

/* Controls Panel */
.controls-panel {
    padding: 32px 48px;
    background: white;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 24px;
}

.margin-control {
    flex: 1;
    min-width: 320px;
}

.margin-control label {
    display: block;
    font-weight: 600;
    margin-bottom: 12px;
    color: #1d1d1f;
    font-size: 15px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 16px;
}

.slider-container input[type="range"] {
    flex: 1;
    height: 3px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.1);
    outline: none;
    -webkit-appearance: none;
    transition: all 0.3s ease;
}

.slider-container input[type="range"]:hover {
    background: rgba(0, 0, 0, 0.15);
}

.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.slider-container input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
}

.slider-container input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.15);
}

.slider-container input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.margin-value {
    font-weight: 700;
    font-size: 17px;
    color: #007aff;
    min-width: 50px;
    text-align: right;
}

.margin-control small {
    display: block;
    margin-top: 8px;
    color: #86868b;
    font-size: 13px;
    font-weight: 400;
}

/* File Upload */
.file-upload {
    flex: 0 0 auto;
}

.file-label {
    display: inline-block;
    padding: 12px 24px;
    background: #007aff;
    color: white;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s ease;
    border: none;
}

.file-label:hover {
    background: #0051d5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.file-label:active {
    transform: translateY(0);
}

#fileName {
    font-size: 14px;
}

/* Filters Panel */
.filters-panel {
    padding: 32px 48px;
    background: #fafafa;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.1);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.filter-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1d1d1f;
    font-size: 13px;
}

.filter-group select,
.filter-group input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
    background: white;
}

.filter-group select:focus,
.filter-group input[type="text"]:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 400;
    padding: 6px 0;
    font-size: 14px;
    color: #1d1d1f;
    transition: all 0.2s ease;
}

.checkbox-label:hover {
    color: #007aff;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #007aff;
}

.mvat-label {
    color: #34c759;
}

.svat-label {
    color: #ff3b30;
}

/* Grade Dropdown */
.grade-dropdown {
    position: relative;
}

.grade-dropdown-button {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
    background: white;
    cursor: pointer;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.grade-dropdown-button::after {
    content: '▼';
    font-size: 12px;
    color: #86868b;
}

.grade-dropdown-button:hover {
    border-color: #007aff;
}

.grade-dropdown-button:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

.grade-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    padding: 8px;
    display: none;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 250px;
    overflow-y: auto;
}

.grade-dropdown-menu.show {
    display: block;
}

.grade-dropdown-menu .checkbox-label {
    padding: 8px;
    margin: 0;
    border-radius: 6px;
}

.grade-dropdown-menu .checkbox-label:hover {
    background: rgba(0, 0, 0, 0.02);
}

.btn-secondary {
    width: 100%;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.05);
    color: #1d1d1f;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    font-size: 14px;
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.1);
}

.btn-secondary:active {
    transform: scale(0.98);
}

/* Statistics */
.statistics {
    padding: 20px 48px;
    background: white;
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.1);
}

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

.stat-label {
    font-weight: 500;
    color: #86868b;
    font-size: 14px;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #007aff;
}

/* Table */
.table-container {
    overflow-x: auto;
    padding: 0;
}

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

thead {
    background: #f0f0f0;
    border-bottom: 2px solid rgba(0, 0, 0, 0.15);
}

thead th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 700;
    white-space: nowrap;
    color: #1d1d1f;
    font-size: 13px;
    letter-spacing: -0.2px;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
}

thead th:last-child {
    border-right: none;
}

tbody tr {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

tbody td {
    padding: 16px 20px;
    color: #1d1d1f;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
}

tbody td:last-child {
    border-right: none;
}

.no-data {
    text-align: center;
    padding: 80px 20px;
    color: #86868b;
    font-size: 15px;
}


/* VAT Type Badges */
.vat-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.vat-mvat {
    background: rgba(52, 199, 89, 0.1);
    color: #34c759;
}

.vat-svat {
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
}

/* Grade Badges */
.grade-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.grade-w {
    background: rgba(52, 199, 89, 0.1);
    color: #34c759;
}

.grade-c {
    background: rgba(255, 204, 0, 0.15);
    color: #ff9500;
}

.grade-faulty {
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
}

.grade-asis {
    background: rgba(175, 82, 222, 0.1);
    color: #af52de;
}

.grade-cpo {
    background: rgba(0, 122, 255, 0.1);
    color: #007aff;
}

/* Price Cells */
.price-cell {
    font-weight: 600;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.price-eur {
    color: #007aff;
}

.price-huf {
    color: #34c759;
}

.price-purchase {
    color: #ff3b30;
}

/* Stock Badge */
.stock-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(52, 199, 89, 0.1);
    color: #34c759;
    letter-spacing: 0.2px;
}

/* Loading Indicator */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 48px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    z-index: 1000;
}

.spinner {
    border: 3px solid rgba(0, 0, 0, 0.05);
    border-top: 3px solid #007aff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    margin: 0 auto 24px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: #1d1d1f;
    font-weight: 500;
    font-size: 15px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 20px 24px;
    }

    .header h1 {
        font-size: 24px;
    }

    .controls-panel,
    .filters-panel,
    .statistics {
        padding: 24px;
    }

    .filters-panel {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 13px;
    }

    thead th,
    tbody td {
        padding: 12px 16px;
    }
}

/* Scrollbar styling - Apple style */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 2px solid white;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Smooth animations */
* {
    transition: background 0.2s ease, color 0.2s ease;
}

/* Focus styles - Apple like */
button:focus-visible,
select:focus-visible,
input:focus-visible {
    outline: 2px solid #007aff;
    outline-offset: 2px;
}

/* Password Protection Overlay */
.password-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: hidden;
}

.password-overlay.hidden {
    display: none;
}

/* Background iPhone Images */
.password-bg-images {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.bg-phone {
    position: absolute;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.08;
    filter: grayscale(100%) brightness(1.2);
}

.bg-phone-1 {
    width: 400px;
    height: 800px;
    top: -10%;
    left: 10%;
    background-image: url('https://images.unsplash.com/photo-1592286968672-1e4e9e0b9b9e?w=800&q=80');
    transform: rotate(-15deg);
    animation: float1 20s ease-in-out infinite;
}

.bg-phone-2 {
    width: 500px;
    height: 1000px;
    bottom: -15%;
    right: 5%;
    background-image: url('https://images.unsplash.com/photo-1611472173362-3f53dbd65d82?w=800&q=80');
    transform: rotate(20deg);
    animation: float2 25s ease-in-out infinite;
}

.bg-phone-3 {
    width: 350px;
    height: 700px;
    top: 50%;
    right: 30%;
    background-image: url('https://images.unsplash.com/photo-1678652508398-13f27c5498d1?w=800&q=80');
    transform: translateY(-50%) rotate(-10deg);
    animation: float3 18s ease-in-out infinite;
}

@keyframes float1 {
    0%, 100% { transform: rotate(-15deg) translateY(0); }
    50% { transform: rotate(-15deg) translateY(-30px); }
}

@keyframes float2 {
    0%, 100% { transform: rotate(20deg) translateY(0); }
    50% { transform: rotate(20deg) translateY(40px); }
}

@keyframes float3 {
    0%, 100% { transform: translateY(-50%) rotate(-10deg) translateX(0); }
    50% { transform: translateY(-50%) rotate(-10deg) translateX(20px); }
}

.password-container {
    background: white;
    padding: 48px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 400px;
    width: 90%;
    position: relative;
    z-index: 1;
}

.password-container h2 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #1d1d1f;
}

.password-container p {
    color: #86868b;
    margin-bottom: 24px;
    font-size: 15px;
}

.password-container input[type="password"] {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    font-size: 16px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
}

.password-container input[type="password"]:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

.password-btn {
    width: 100%;
    padding: 14px 24px;
    background: #007aff;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.password-btn:hover {
    background: #0051d5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

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

.password-error {
    color: #ff3b30;
    font-size: 14px;
    font-weight: 500;
    margin-top: 12px;
    min-height: 20px;
}

/* Navigation Links on Login */
.nav-links {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.nav-links-label {
    color: #86868b !important;
    font-size: 13px !important;
    margin-bottom: 16px !important;
}

.nav-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.nav-btn {
    flex: 1;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    text-align: center;
}

.nav-btn-b2b {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: white;
}

.nav-btn-b2b:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.3);
}

.nav-btn-enduser {
    background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
    color: white;
}

.nav-btn-enduser:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #34c759;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(18px);
}

.toggle-label {
    font-size: 13px;
    color: #6e6e73;
    font-weight: 500;
}

/* Rate Status */
.rate-status {
    font-size: 12px;
    font-weight: 500;
    margin-left: 4px;
}

.rate-status.rate-success {
    color: #34c759;
}

.rate-status.rate-cached {
    color: #ff9500;
}

.rate-status.rate-loading {
    color: #007aff;
}

.rate-status.rate-error {
    color: #ff3b30;
}

/* Disabled input style */
.exchange-rate input[type="number"]:disabled {
    background: #f0f0f0;
    color: #86868b;
    cursor: not-allowed;
}

/* Color Cell */
.color-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

/* Capacity and Color Dropdown */
.capacity-dropdown,
.color-dropdown {
    position: relative;
}

/* Color dot in dropdown */
.grade-dropdown-menu .color-dot {
    width: 12px;
    height: 12px;
}
