/* Custom styles for Talabnomalar System */

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f6fa;
}

/* Navigation */
.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

/* Cards */
.card {
    border: none;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    border-radius: 15px;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 30px rgba(0,0,0,0.15);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 15px 15px 0 0 !important;
    font-weight: 600;
}

/* Dashboard Cards */
.bg-primary {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
}

.bg-success {
    background: linear-gradient(135deg, #56ab2f, #a8e6cf) !important;
}

.bg-info {
    background: linear-gradient(135deg, #3498db, #85c1e9) !important;
}

.bg-warning {
    background: linear-gradient(135deg, #f39c12, #f7dc6f) !important;
}

/* Buttons */
.btn {
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.btn-success {
    background: linear-gradient(135deg, #56ab2f, #a8e6cf);
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
}

/* Status badges */
.status-badge {
    font-size: 0.85rem;
    padding: 0.5em 0.8em;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.status-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* Tables */
.table {
    border-radius: 15px;
    overflow: hidden;
}

.table thead th {
    background: linear-gradient(135deg, var(--dark-color), #495057);
    color: white;
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

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

.table tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.1);
    transform: scale(1.02);
}

/* Forms */
.form-control, .form-select {
    border-radius: 10px;
    border: 2px solid #e9ecef;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Modals */
.modal-content {
    border-radius: 15px;
    border: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 15px 15px 0 0;
}

.modal-header .btn-close {
    filter: invert(1);
}

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

.card {
    animation: fadeInUp 0.6s ease;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
}

/* Enhanced Responsive Design */

/* Mobile First Approach */
@media (max-width: 575.98px) {
    /* Extra small devices (phones) */
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .card {
        margin-bottom: 1rem;
        border-radius: 0.75rem !important;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }
    
    .btn-group {
        display: flex;
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        margin: 2px 0;
        border-radius: 0.375rem !important;
    }
    
    .table-responsive {
        border: none;
        border-radius: 0.5rem;
    }
    
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-content {
        border-radius: 1rem;
    }
    
    .form-control, .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .badge {
        font-size: 0.7rem;
        padding: 0.3rem 0.6rem;
    }
}

@media (min-width: 576px) and (max-width: 767.98px) {
    /* Small devices (landscape phones) */
    .card {
        margin-bottom: 1.25rem;
    }
    
    .btn-group .btn {
        margin: 1px;
    }
    
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    /* Medium devices (tablets) */
    .card {
        margin-bottom: 1.5rem;
    }
    
    .btn-group {
        display: inline-flex;
        flex-direction: row;
    }
    
    .btn-group .btn {
        margin: 0;
    }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
    /* Large devices (desktops) */
    .container-fluid {
        max-width: 100%;
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

@media (min-width: 1200px) {
    /* Extra large devices (large desktops) */
    .container-fluid {
        max-width: 100%;
        padding-left: 3rem;
        padding-right: 3rem;
    }
}

/* Print styles */
@media print {
    .navbar, .btn, .modal, .card-header {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    body {
        background: white;
    }
}

/* Loading spinner */
.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3em;
}

/* Alert improvements */
.alert {
    border-radius: 15px;
    border: none;
    font-weight: 500;
}

.alert-success {
    background: linear-gradient(135deg, #56ab2f, #a8e6cf);
    color: white;
}

.alert-danger {
    background: linear-gradient(135deg, #dc3545, #f8d7da);
    color: white;
}

.alert-info {
    background: linear-gradient(135deg, #17a2b8, #bee5eb);
    color: white;
}

/* Badge improvements */
.badge {
    font-size: 0.8rem;
    padding: 0.5em 0.8em;
    border-radius: 20px;
}

/* New product row styling */
.new-product-row {
    border: 1px dashed #dee2e6;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 10px;
    background-color: #f8f9fa;
}

/* Status transition effects */
.status-transition {
    transition: all 0.5s ease;
}

/* Empty state styling */
.empty-state {
    padding: 3rem 1rem;
    text-align: center;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

/* Dashboard improvements */
.dashboard-card {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    height: 100%;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 25px rgba(0,0,0,0.15);
}

/* Filter card */
.filter-card {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: none;
}

/* Print button special styling */
.print-btn {
    position: relative;
    overflow: hidden;
}

.print-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s;
}

.print-btn:hover::before {
    left: 100%;
}

/* Additional Responsive Utilities */

/* Mobile Navigation Improvements */
.navbar-toggler {
    border: none;
    padding: 0.25rem 0.5rem;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.navbar-collapse {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
}

@media (min-width: 992px) {
    .navbar-collapse {
        border-top: none;
        margin-top: 0;
        padding-top: 0;
    }
}

/* Touch-friendly buttons */
@media (max-width: 991.98px) {
    .btn {
        min-height: 44px; /* iOS/Android recommended touch target */
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    .btn-sm {
        min-height: 36px;
        min-width: 36px;
    }
}

/* Improved focus states for accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Better spacing for mobile */
@media (max-width: 767.98px) {
    .mb-4 {
        margin-bottom: 2rem !important;
    }
    
    .mt-4 {
        margin-top: 2rem !important;
    }
    
    .p-4 {
        padding: 1.5rem !important;
    }
    
    .py-5 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
}

/* Improved table responsiveness */
.table-responsive {
    border-radius: 0.75rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

@media (max-width: 767.98px) {
    .table-responsive {
        border: 1px solid #dee2e6;
    }
    
    .table-responsive table {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
        vertical-align: middle;
    }
}

/* Card improvements for mobile */
@media (max-width: 575.98px) {
    .card-header {
        padding: 1rem;
        font-size: 0.95rem;
    }
    
    .card-title {
        font-size: 1.1rem;
    }
}

/* Modal improvements for mobile */
@media (max-width: 575.98px) {
    .modal-dialog {
        max-width: calc(100vw - 1rem);
        margin: 0.5rem;
    }
    
    .modal-content {
        border-radius: 1rem;
    }
    
    .modal-header {
        padding: 1rem;
        border-radius: 1rem 1rem 0 0;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 1rem;
        border-radius: 0 0 1rem 1rem;
    }
}

/* Form improvements for mobile */
@media (max-width: 575.98px) {
    .form-floating > .form-control,
    .form-floating > .form-select {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 0.875rem 0.75rem;
    }
    
    .input-group > .form-control {
        font-size: 16px;
    }
}

/* Status badge improvements */
.status-badge {
    white-space: nowrap;
    font-weight: 600;
}

@media (max-width: 575.98px) {
    .status-badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Loading states */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading .btn {
    position: relative;
}

.loading .btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border-width: 2px;
    }
    
    .card {
        border-width: 2px;
    }
    
    .form-control,
    .form-select {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode improvements */
@media (prefers-color-scheme: dark) {
    .table-responsive {
        background-color: #2d2d2d;
    }
    
    .table {
        --bs-table-bg: #2d2d2d;
        color: #fff;
    }
    
    .table th {
        border-color: #495057;
    }
    
    .table td {
        border-color: #495057;
    }
}