* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* Auth Forms */
.auth-form {
    max-width: 400px;
    margin: 0 auto;
    display: grid;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-weight: 600;
    color: #333;
}

input, select, button, textarea {
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 600;
    padding: 15px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 600;
    padding: 12px 20px;
    border-radius: 8px;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    gap: 20px;
    min-height: 600px;
}

.sidebar {
    width: 250px;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 10px;
}

.sidebar-nav a {
    display: block;
    padding: 12px 15px;
    color: #333;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.sidebar-nav a:hover, .sidebar-nav a.active {
    background: #667eea;
    color: white;
}

.main-content {
    flex: 1;
    background: white;
    border-radius: 12px;
    padding: 30px;
}

/* Tabs */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Empty state */
.orders-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.orders-empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Loading state */
.orders-loading {
    text-align: center;
    padding: 40px;
}

.orders-loading .spinner {
    margin: 0 auto 16px;
}

/* Orders Grid */

.order-card {
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    padding: 20px;
    background: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    cursor: pointer;
}

.order-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.order-image {
    width: 100%;
    height: 200px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 15px;
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
}

.order-image-placeholder {
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    color: #666;
    font-size: 14px;
}

.order-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.order-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid #f0f0f0;
}

.order-field:last-child {
    border-bottom: none;
}

.field-label {
    font-weight: 600;
    color: #666;
    font-size: 0.9rem;
}

.field-value {
    color: #333;
    text-align: right;
    font-size: 0.95rem;
}

.status-vikup {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
}

.status-cancelled {
    background: linear-gradient(135deg, #f8d7da 0%, #f1b0b7 100%);
    color: #721c24;
}

.status-vputi {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
}

.status-otkaz {
    background: linear-gradient(135deg, #e2e3e5 0%, #d6d8db 100%);
    color: #383d41;
}

.status-cell {
    min-width: 100px;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.75rem;
    text-align: center;
    display: inline-block;
    min-width: 80px;
}

.price {
    color: #667eea;
    font-weight: 700;
    font-size: 1.1rem;
}

/* Profile Settings */
.profile-form {
    max-width: 500px;
    display: grid;
    gap: 20px;
}

.user-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.user-info h3 {
    margin-bottom: 10px;
    color: #333;
}

/* Loading and Messages */
.loading {
    text-align: center;
    padding: 40px;
    display: none;
}

.loading.visible {
    display: block;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.orders-table-container {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    background: white;
    margin-top: 20px;
}

.orders-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.9rem;
}

.orders-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.orders-table th {
    padding: 16px 12px;
    text-align: left;
    font-weight: 600;
    color: white;
    border: none;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.orders-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s ease;
    cursor: pointer;
}


.orders-table td {
    padding: 16px 12px;
    vertical-align: middle;
    border: none;
}

.orders-table tbody tr:hover {
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f2ff 100%);
    transform: translateX(4px);
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.15);
}

.orders-table tbody tr:last-child {
    border-bottom: none;
}

.info-cell {
    min-width: 200px;
}

.order-number {
    font-weight: 700;
    color: #333;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.order-date {
    color: #6c757d;
    font-size: 0.8rem;
    margin-bottom: 6px;
}

.order-article {
    background: #e7f1ff;
    color: #0066cc;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

/* Profit column */
.profit-cell {
    min-width: 120px;
}

.profit-badge {
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    width: 100%;
}

.profit-positive {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.2);
}

.profit-negative {
    background: linear-gradient(135deg, #f8d7da 0%, #f1b0b7 100%);
    color: #721c24;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.2);
}

.profit-unknown {
	background: linear-gradient(135deg, #6c757d 0%, #6c757d 100%);
    color: #white;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.2);
}

.profit-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}


/* Photo column */
.photo-cell {
    width: 70px;
    padding: 12px !important;
}
.order-photo {
    width: 57px;
    height: 76px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid #e1e5e9;
    transition: all 0.3s ease;
}

.orders-table tbody tr:hover .order-photo {
    border-color: #667eea;
    transform: scale(1.05);
}

.photo-placeholder {
    width: 57px;
    height: 76px;
    border-radius: 8px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #dee2e6;
    color: #6c757d;
    font-size: 0.8rem;
}

/* Auth Links */
.auth-links {
    text-align: center;
    margin-top: 20px;
}

.auth-links a {
    color: #667eea;
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.visible {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}


/* Shop Buttons Styles */
.shops-buttons-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.shop-btn {
    flex: 1;
    min-width: 150px;
    max-width: 200px;
    padding: 7px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
}

.shop-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #667eea;
}

.shop-btn-active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.shop-btn-inactive {
    background: white;
    color: #333;
    border-color: #e1e5e9;
}

.shop-btn-inactive:hover {
    background: #f8f9fa;
}

/* Shop Info Panel */
.shop-info-panel {
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f2ff 100%);
    border: 1px solid #667eea;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.1);
}

.shop-info-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.shop-info-icon {
    font-size: 1.5rem;
}

.shop-info-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.shop-info-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.shop-info-stats h5 {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.shop-stat {
    text-align: center;
    padding: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #f0f0f0;
    transition: all 0.3s ease;
}

.shop-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.shop-stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 6px;
}

.shop-stat-label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Enhanced shop buttons */
.shop-btn {
    position: relative;
    transition: all 0.3s ease;
}

.shop-btn-active::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    background: #28a745;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shop-orders-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc3545;
    color: white;
    border-radius: 12px;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.profit-positive {
    color: #28a745 !important;
}

.profit-negative {
    color: #dc3545 !important;
}

.shop-stat .profit-positive,
.shop-stat .profit-negative {
    font-weight: 700;
    font-size: 1.2rem;
}

/* Period Selector Styles */
.period-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.period-btn {
    padding: 10px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.period-btn:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.period-btn-active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.status-filter-btn {
    padding: 8px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 20px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    font-weight: 500;
}

.status-filter-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.status-filter-active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

/* Month Selector Styles */
.month-selector {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.month-btn {
    padding: 8px 12px;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
}

.month-btn:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.month-btn-active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

/* Custom Date Range */
.custom-date-range {
    display: none;
    gap: 10px;
    margin-top: 10px;
    align-items: center;
}

.custom-date-range input {
    flex: 1;
}


/* Стили для выпадающего списка месяцев */
#monthSelect {
    min-width: 200px;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' 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;
    background-size: 16px;
    padding-right: 40px;
    transition: all 0.3s ease;
}

#monthSelect:hover {
    border-color: #667eea;
    background-color: #f8f9ff;
}

#monthSelect:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Стили для активного выпадающего списка */
#monthSelect.active-month-select {
    border-color: #667eea;
    background: #667eea;
    color: white;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' 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");
}



/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .card {
        padding: 20px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .dashboard {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
    }
    
	
	.orders-table-container {
        font-size: 0.9rem;
    }
    
    .orders-table th,
    .orders-table td {
        padding: 10px 8px;
    }
    
    .orders-table th:nth-child(3),
    .orders-table td:nth-child(3) {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab {
        flex: 1;
        min-width: 120px;
        text-align: center;
    }
	
	.period-selector, .status-filters {
        flex-direction: column;
    }
    
    .period-btn, .status-filter-btn {
        text-align: center;
    }
    
    .custom-date-range {
        flex-direction: column;
        align-items: stretch;
    }
	
	#monthSelect {
        min-width: 100%;
        text-align: center;
    }
    
    .period-btn, #monthSelect {
        text-align: center;
    }
	
	.shops-buttons-container {
        flex-direction: column;
    }
    
    .shop-btn {
        min-width: 100%;
        max-width: 100%;
    }
}

/* Стили для вкладки товаров */

.editable-cost {
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.editable-cost:hover {
    background-color: #f8f9ff;
}

.cost-input {
    padding: 4px 8px;
    border: 2px solid #667eea;
    border-radius: 4px;
    font-size: 14px;
}

.cost-value {
    font-weight: 600;
    color: #333;
}

/* Стили для кнопок в таблице товаров */
.products-table .btn-secondary {
    padding: 4px 8px;
    font-size: 12px;
    margin: 2px;
}

/* Стили для кнопок обновления фото */
.photo-update-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #667eea;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 10px;
    cursor: pointer;
    color: #667eea;
    transition: all 0.2s;
    z-index: 10;
}

.photo-update-btn:hover {
    background: #667eea;
    color: white;
}

.photo-cell {
    position: relative;
}

/* Индикатор процесса обновления */
.updating-photo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.updating-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #667eea;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}