/* Modern Admin Panel - Cloudflare Style */

/* Material Symbols */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 20px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    vertical-align: middle;
}

:root {
    --primary: #0051c3;
    --primary-hover: #003d99;
    --danger: #dc3545;
    --danger-hover: #c82333;
    --success: #28a745;
    --warning: #ffc107;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --border-radius: 8px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.5;
}

/* Login Screen */
.screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main screen should not be vertically centered */
#mainScreen.screen {
    display: block;
    min-height: 100vh;
    padding-top: 64px;
}

.login-container {
    background: white;
    padding: 48px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.login-container h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--gray-900);
}

.login-container form {
    margin-top: 32px;
}

.login-container input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 15px;
    margin-bottom: 16px;
    transition: all 0.2s;
}

.login-container input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 81, 195, 0.1);
}

.hint {
    color: var(--gray-500);
    font-size: 14px;
    text-align: center;
    margin-top: 16px;
}

/* Header */
.header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
}

.header h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
    margin-right: 48px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.lottie-icon {
    width: 22px;
    height: 22px;
    margin-right: 8px;
}

/* Navigation in Header */
.header-nav {
    display: flex;
    gap: 4px;
    flex: 1;
}

.tab-btn {
    padding: 20px 16px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--gray-600);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.tab-btn:hover {
    color: var(--gray-900);
    background: linear-gradient(135deg, rgba(0, 81, 195, 0.05) 0%, rgba(0, 81, 195, 0.1) 100%);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: linear-gradient(135deg, rgba(0, 81, 195, 0.1) 0%, rgba(0, 81, 195, 0.05) 100%);
}

/* Цветные иконки для разных вкладок */
.tab-btn:nth-child(1) .material-symbols-outlined {
    color: #3b82f6;
}

.tab-btn:nth-child(2) .material-symbols-outlined {
    color: #10b981;
}

.tab-btn:nth-child(3) .material-symbols-outlined {
    color: #f59e0b;
}

.tab-btn:nth-child(4) .material-symbols-outlined {
    color: #8b5cf6;
}

.tab-btn:nth-child(5) .material-symbols-outlined {
    color: #ef4444;
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 32px;
    max-width: 1400px;
    margin: 0 auto;
}

.tab-content.active {
    display: block;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.tab-content h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--gray-900);
    position: relative;
    padding-left: 16px;
}

.tab-content h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    border-radius: 2px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

/* Pin dashboard stats to top-right */
#dashboardTab .stats-grid {
    position: fixed;
    top: 96px;
    right: 32px;
    max-width: 340px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    z-index: 10;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: var(--border-radius);
    border: 2px solid var(--gray-200);
    transition: all 0.2s;
    position: relative;
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.stat-card h3 {
    font-size: 36px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.stat-card p {
    color: var(--gray-600);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Colored stat cards with enhanced styling */
.stat-card:nth-child(1) {
    border: 3px solid #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.15);
}

.stat-card:nth-child(1) .material-symbols-outlined {
    color: #ffffff;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    padding: 12px;
    border-radius: 12px;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.stat-card:nth-child(1):hover {
    border-color: #1d4ed8;
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.25);
}

.stat-card:nth-child(2) {
    border: 3px solid #10b981;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.15);
}

.stat-card:nth-child(2) .material-symbols-outlined {
    color: #ffffff;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    padding: 12px;
    border-radius: 12px;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.stat-card:nth-child(2):hover {
    border-color: #059669;
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.25);
}

.stat-card:nth-child(3) {
    border: 3px solid #f59e0b;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.15);
}

.stat-card:nth-child(3) .material-symbols-outlined {
    color: #ffffff;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    padding: 12px;
    border-radius: 12px;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.stat-card:nth-child(3):hover {
    border-color: #d97706;
    box-shadow: 0 8px 30px rgba(245, 158, 11, 0.25);
}

.stat-card:nth-child(4) {
    border: 3px solid #8b5cf6;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.15);
}

.stat-card:nth-child(4) .material-symbols-outlined {
    color: #ffffff;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    padding: 12px;
    border-radius: 12px;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.stat-card:nth-child(4):hover {
    border-color: #7c3aed;
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.25);
}

.uil {
    transition: transform 0.2s ease, color 0.2s ease;
}

.header h1:hover .uil {
    animation: spin360 0.6s linear;
}

.tab-btn:hover .uil {
    animation: wiggle 0.3s ease-in-out;
}

.btn-primary:hover .uil,
.btn-secondary:hover .uil,
.btn-danger:hover .uil {
    animation: bounce 0.4s ease;
}

.stat-card:hover .material-symbols-outlined {
    animation: pulseGlow 0.6s ease;
    transform: scale(1.1);
}

.stat-card .material-symbols-outlined {
    transition: all 0.3s ease;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 10px 20px;
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #003d99 100%);
    color: white;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #002d73 100%);
    border-color: var(--primary-hover);
    box-shadow: 0 4px 16px rgba(0, 81, 195, 0.3);
    transform: translateY(-2px);
}

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 2px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #c82333 100%);
    color: white;
    border-color: var(--danger);
}

.btn-danger:hover {
    background: linear-gradient(135deg, var(--danger-hover) 0%, #a71e2a 100%);
    border-color: var(--danger-hover);
    box-shadow: 0 4px 16px rgba(220, 53, 69, 0.3);
    transform: translateY(-2px);
}

/* Table */
table {
    width: 100%;
    background: white;
    border-radius: var(--border-radius);
    border: 2px solid var(--gray-200);
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

table:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 24px rgba(0, 81, 195, 0.1);
}

table thead {
    background: var(--gray-50);
}

table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--gray-200);
}

table td {
    padding: 16px;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-700);
    font-size: 14px;
}

table tbody tr:last-child td {
    border-bottom: none;
}

table tbody tr:hover {
    background: var(--gray-50);
}

.product-thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--gray-200);
}

table button {
    margin-right: 8px;
    padding: 6px 12px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Цветные иконки в таблицах */
table .btn-secondary .material-symbols-outlined {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
    padding: 2px;
    border-radius: 4px;
}

table .btn-danger .material-symbols-outlined {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    padding: 2px;
    border-radius: 4px;
}

table .btn-secondary:hover .material-symbols-outlined {
    color: #ffffff;
    background: #3b82f6;
}

table .btn-danger:hover .material-symbols-outlined {
    color: #ffffff;
    background: #ef4444;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 3px solid var(--primary);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

.modal-body {
    padding: 24px;
}

/* Form */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group input[type="file"],
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: all 0.2s;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 81, 195, 0.15);
    background: white;
    transform: translateY(-1px);
}

.form-group input:hover,
.form-group select:hover {
    border-color: var(--gray-400);
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--gray-500);
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

/* Loader */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loader.hidden {
    display: none;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes spin360 {
    to { transform: rotate(360deg); }
}

@keyframes wiggle {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
    100% { transform: rotate(0deg); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes iconBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes iconRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Анимации для разных типов иконок */
.tab-btn:hover .material-symbols-outlined {
    animation: iconBounce 0.4s ease;
}

.btn-primary:hover .material-symbols-outlined,
.btn-secondary:hover .material-symbols-outlined,
.btn-danger:hover .material-symbols-outlined {
    animation: iconPulse 0.3s ease;
}

.logo-icon:hover {
    animation: iconRotate 0.6s ease;
}

.stat-card:hover .material-symbols-outlined {
    animation: iconPulse 0.5s ease;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 64px 32px;
    color: var(--gray-500);
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 24px;
}

/* Специальные цвета для функциональных иконок */

/* Иконки действий */
.material-symbols-outlined[data-action="add"] {
    color: #10b981;
}

.material-symbols-outlined[data-action="edit"] {
    color: #3b82f6;
}

.material-symbols-outlined[data-action="delete"] {
    color: #ef4444;
}

.material-symbols-outlined[data-action="view"] {
    color: #8b5cf6;
}

/* Иконки по типу контента */
.material-symbols-outlined:is([class*="dashboard"]) {
    color: #3b82f6;
}

.material-symbols-outlined:is([class*="category"]) {
    color: #10b981;
}

.material-symbols-outlined:is([class*="inventory"]) {
    color: #f59e0b;
}

.material-symbols-outlined:is([class*="receipt"]) {
    color: #8b5cf6;
}

.material-symbols-outlined:is([class*="offer"]) {
    color: #ef4444;
}

.material-symbols-outlined:is([class*="analytics"]) {
    color: #06b6d4;
}

/* Цветные фоны для иконок в зависимости от контекста */
.header .material-symbols-outlined {
    background: rgba(255, 255, 255, 0.1);
    padding: 4px;
    border-radius: 6px;
}

.tab-header .material-symbols-outlined {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    padding: 6px;
    border-radius: 8px;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Hover эффекты для цветных иконок */
.header .material-symbols-outlined:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.tab-header .material-symbols-outlined:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
    border-color: rgba(59, 130, 246, 0.4);
    transform: scale(1.05);
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 0 16px;
        height: auto;
        flex-wrap: wrap;
    }
    
    .header h1 {
        font-size: 18px;
        margin-right: 16px;
    }
    
    .header-nav {
        width: 100%;
        order: 3;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab-btn {
        padding: 16px 12px;
        font-size: 13px;
    }
    
    .tab-content {
        padding: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    #dashboardTab .stats-grid {
        position: static;
        top: auto;
        right: auto;
        max-width: 100%;
        max-height: none;
        margin-left: 0;
        overflow-y: visible;
        padding-bottom: 20px;
    }
    
    table {
        font-size: 13px;
    }
    
    table th,
    table td {
        padding: 12px 8px;
    }
    
    table button {
        display: block;
        width: 100%;
        margin-bottom: 4px;
    }
}

.hidden {
    display: none !important;
}


/* Material Icons */
.material-symbols-outlined {
    font-variation-settings:
    'FILL' 0,
    'wght' 400,
    'GRAD' 0,
    'opsz' 24;
    transition: all 0.3s ease;
}

.logo-icon {
    font-size: 24px;
    color: var(--primary);
    background: linear-gradient(135deg, rgba(0, 81, 195, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    padding: 6px;
    border-radius: 8px;
    border: 1px solid rgba(0, 81, 195, 0.2);
}

/* Цветные иконки в заголовках */
h2 .material-symbols-outlined {
    color: #3b82f6;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    padding: 8px;
    border-radius: 8px;
    margin-right: 8px;
}

/* Цветные иконки в кнопках */
.btn-primary .material-symbols-outlined {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px;
    border-radius: 4px;
}

.btn-secondary .material-symbols-outlined {
    color: #6b7280;
}

.btn-danger .material-symbols-outlined {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px;
    border-radius: 4px;
}

/* Цветные иконки в модальных окнах */
.modal-close {
    color: #ef4444 !important;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.2) 100%) !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
}

.modal-close:hover {
    color: #ffffff !important;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
}

/* Кнопка успеха */
.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

/* Статусы заказов */
.status.cancelled {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.status.processing {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.status.done {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.status.pending {
    background: rgba(99, 102, 241, 0.2);
    color: #6366f1;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}
