/* =================================
   DivanHall ERP - Custom Styles
   ================================= */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    --dark-bg: #1e293b;
    --light-bg: #f8fafc;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

/* Global Styles */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--light-bg);
    color: #1e293b;
    font-size: 0.95rem;
}

/* Navbar Enhancement */
.navbar-dark {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0.75rem 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: -0.5px;
}

.navbar-brand i {
    color: var(--primary-light);
}

.nav-link {
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 6px;
    margin: 0 0.2rem;
    padding: 0.5rem 0.9rem !important;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.dropdown-menu {
    border: none;
    box-shadow: var(--shadow-lg);
    border-radius: 8px;
    padding: 0.5rem;
    margin-top: 0.5rem;
}

.dropdown-item {
    border-radius: 6px;
    padding: 0.6rem 1rem;
    margin-bottom: 0.2rem;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background-color: var(--light-bg);
    transform: translateX(4px);
}

.dropdown-item i {
    width: 20px;
    margin-right: 8px;
    color: var(--secondary-color);
}

/* Main Container */
main.container-fluid {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Card Enhancement */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 2px solid var(--border-color);
    padding: 1.2rem 1.5rem;
    font-weight: 600;
    font-size: 1.1rem;
    color: #334155;
}

.card-header h5 {
    margin: 0;
    font-weight: 700;
    color: #1e293b;
}

.card-body {
    padding: 1.5rem;
}

/* Buttons Enhancement */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.6rem 1.2rem;
    transition: all 0.2s ease;
    border: none;
    box-shadow: var(--shadow-sm);
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.btn-info {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 0.8rem 1.6rem;
    font-size: 1.05rem;
}

/* Form Controls */
.form-control, .form-select {
    border-radius: 8px;
    border: 2px solid var(--border-color);
    padding: 0.65rem 1rem;
    transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-label {
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.5rem;
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Tables Enhancement */
.table {
    margin-bottom: 0;
}

.table thead th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
    padding: 1rem 0.75rem;
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table-hover tbody tr:hover {
    background-color: #f8fafc;
    transform: scale(1.001);
    box-shadow: var(--shadow-sm);
}

.table td {
    vertical-align: middle;
    padding: 0.9rem 0.75rem;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(248, 250, 252, 0.5);
}

.table-responsive {
    border-radius: 8px;
    overflow: hidden;
}

/* Badges Enhancement */
.badge {
    padding: 0.5rem 0.9rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.3px;
}

/* Alerts Enhancement */
.alert {
    border-radius: 10px;
    border: none;
    padding: 1.2rem 1.5rem;
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
}

.alert-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
}

.alert-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

.alert-info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
}

/* Modal Enhancement */
.modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 2px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 12px 12px 0 0;
}

.modal-title {
    font-weight: 700;
    color: #1e293b;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.2rem 1.5rem;
    background-color: #f8fafc;
    border-top: 1px solid var(--border-color);
}

/* Pagination */
.pagination {
    margin-top: 1.5rem;
}

.page-link {
    border-radius: 6px;
    margin: 0 0.2rem;
    border: 2px solid var(--border-color);
    color: var(--primary-color);
    font-weight: 500;
    transition: all 0.2s ease;
}

.page-link:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-color: var(--primary-color);
}

/* Custom Utilities */
.text-muted {
    color: #64748b !important;
}

code {
    background-color: #f1f5f9;
    color: #e11d48;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 600;
}

/* Page Headers */
h1 {
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 1.5rem;
    font-size: 2rem;
    letter-spacing: -0.5px;
}

h2, h3, h4, h5 {
    font-weight: 700;
    color: #1e293b;
}

/* Search Results */
.list-group-item {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.list-group-item:hover {
    background-color: var(--light-bg);
    border-color: var(--primary-color);
    transform: translateX(4px);
    cursor: pointer;
}

.list-group-item-action:hover {
    color: var(--primary-color);
}

/* Input Groups */
.input-group-text {
    background-color: #f8fafc;
    border: 2px solid var(--border-color);
    border-radius: 8px 0 0 8px;
    font-weight: 600;
    color: #475569;
}

/* Stats Cards */
.stats-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-left: 4px solid var(--primary-color);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
}

.stats-card:hover {
    box-shadow: var(--shadow-md);
}

.stats-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1;
}

.stats-label {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tabs */
.nav-tabs {
    border-bottom: 2px solid var(--border-color);
}

.nav-tabs .nav-link {
    border: none;
    color: #64748b;
    font-weight: 600;
    padding: 0.8rem 1.5rem;
    border-radius: 8px 8px 0 0;
    transition: all 0.2s ease;
}

.nav-tabs .nav-link:hover {
    border-color: transparent;
    background-color: rgba(37, 99, 235, 0.05);
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    background-color: white;
    border-bottom: 3px solid var(--primary-color);
}

/* Loading States */
.spinner-border {
    color: var(--primary-color);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card, .alert {
    animation: fadeIn 0.3s ease;
}

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

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Search Input Enhancement */
input[type="text"][id*="search"],
input[type="text"][placeholder*="Поиск"],
input[type="text"][placeholder*="поиск"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 3rem;
}

/* Table Actions */
.btn-group-sm .btn {
    margin: 0 0.1rem;
}

/* Status Badges Colors */
.badge.bg-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
}

.badge.bg-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
}

.badge.bg-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
}

.badge.bg-info {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%) !important;
}

.badge.bg-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%) !important;
}

.badge.bg-secondary {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%) !important;
}

/* Form Validation */
.is-invalid {
    border-color: var(--danger-color) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.is-valid {
    border-color: var(--success-color) !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1) !important;
}

.invalid-feedback {
    font-weight: 500;
    font-size: 0.85rem;
}

/* Custom Headers */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

/* Hover Effects for Links */
a {
    transition: color 0.2s ease;
}

a:not(.btn):not(.nav-link):not(.dropdown-item) {
    color: var(--primary-color);
    text-decoration: none;
}

a:not(.btn):not(.nav-link):not(.dropdown-item):hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Empty States */
.text-muted.empty-state {
    padding: 3rem;
    text-align: center;
    font-size: 1.1rem;
    color: #94a3b8;
}

/* Icons Enhancement */
.fas, .far, .fab {
    margin-right: 0.3rem;
}

/* Responsive Improvements */
@media (max-width: 768px) {
    main.container-fluid {
        padding: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* Dashboard Cards */
.dashboard-card {
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.dashboard-stat {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Breadcrumbs */
.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "→";
    color: #94a3b8;
}

/* Progress Bars */
.progress {
    height: 8px;
    border-radius: 10px;
    background-color: #f1f5f9;
}

.progress-bar {
    border-radius: 10px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
}

/* Tooltips */
.tooltip-inner {
    background-color: #1e293b;
    border-radius: 6px;
    padding: 0.5rem 0.8rem;
    font-weight: 500;
}

/* Custom Scrollable Tables */
.table-responsive {
    max-height: 600px;
    overflow-y: auto;
}

/* Sidebar (if needed) */
.sidebar {
    background: linear-gradient(180deg, #1e293b 0%, #334155 100%);
    min-height: 100vh;
    padding: 1.5rem;
}

.sidebar .nav-link {
    color: #cbd5e1;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.3rem;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background-color: rgba(59, 130, 246, 0.2);
    color: white;
}

/* Filter Panel */
.filter-panel {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    padding: 1.5rem;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
}

/* Action Buttons Group */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Print Styles */
@media print {
    .navbar,
    .btn,
    .action-buttons {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 4rem;
    height: 4rem;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Success/Error Icons in Forms */
.form-control.is-valid {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2310b981' viewBox='0 0 16 16'%3E%3Cpath d='M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.5rem) center;
    background-size: calc(0.75em + 0.5rem) calc(0.75em + 0.5rem);
}

/* Quick Action Buttons */
.quick-action-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 1.5rem;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

/* Info Boxes */
.info-box {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-left: 4px solid var(--info-color);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.warning-box {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-left: 4px solid var(--warning-color);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
}

/* Table Footer Totals */
.table tfoot th {
    background-color: #f1f5f9;
    font-weight: 700;
    color: #1e293b;
}

/* Form Steps */
.form-step {
    display: none;
}

.form-step.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Custom Select2-like Styling */
.custom-select-enhanced {
    position: relative;
}

.custom-select-enhanced::after {
    content: "▼";
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

