/* Batches & Category Styles */

/* ===================================
   Expiring Products Ticker - الشريط المتحرك
   =================================== */

.expiring-ticker {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    z-index: 999;
    background: linear-gradient(135deg, #FEF3C7 0%, #FED7AA 100%);
    border-bottom: 3px solid #F59E0B;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.ticker-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px;
    background: rgba(245, 158, 11, 0.2);
    border-bottom: 1px solid #F59E0B;
    font-weight: 600;
    color: #92400E;
    font-size: 14px;
}

.ticker-header i.fa-exclamation-triangle {
    color: #F59E0B;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

.ticker-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #92400E;
    font-size: 18px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.3s;
}

.ticker-close:hover {
    background: rgba(146, 64, 14, 0.1);
    transform: scale(1.1);
}

.ticker-content {
    overflow: hidden;
    padding: 12px 0;
}

.ticker-track {
    display: flex;
    gap: 40px;
    animation: scroll 60s linear infinite;
    white-space: nowrap;
}

@keyframes scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

.ticker-track:hover {
    animation-play-state: paused;
}

.ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 13px;
    transition: all 0.3s;
}

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

.ticker-item[data-urgency="high"] {
    border: 2px solid #DC2626;
    background: #FEE2E2;
}

.ticker-item[data-urgency="medium"] {
    border: 2px solid #F59E0B;
}

.ticker-item[data-urgency="low"] {
    border: 2px solid #3B82F6;
}

.ticker-icon {
    font-size: 16px;
}

.ticker-item strong {
    color: #1F2937;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ticker-quantity {
    color: #6B7280;
    font-size: 12px;
}

.ticker-days {
    background: #FEF3C7;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    color: #92400E;
}

/* Adjust main content when ticker is visible */
body.ticker-visible #app-content {
    margin-top: 120px;
}

/* ===================================
   Filters Bar
   =================================== */

.filters-bar {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4B5563;
    font-size: 14px;
}

.filter-group label i {
    margin-left: 5px;
    color: var(--primary-color);
}

/* ===================================
   Batch Row Colors
   =================================== */

.batch-row.danger {
    background: #FEE2E2 !important;
}

.batch-row.danger:hover {
    background: #FECACA !important;
}

.batch-row.warning {
    background: #FEF3C7 !important;
}

.batch-row.warning:hover {
    background: #FDE68A !important;
}

.batch-row.info {
    background: #DBEAFE !important;
}

.batch-row.info:hover {
    background: #BFDBFE !important;
}

.batch-row.success {
    background: #D1FAE5 !important;
}

.batch-row.success:hover {
    background: #A7F3D0 !important;
}

/* ===================================
   Badge Colors
   =================================== */

.badge-danger {
    background: #DC2626;
    color: white;
}

.badge-warning {
    background: #F59E0B;
    color: white;
}

.badge-info {
    background: #3B82F6;
    color: white;
}

.badge-success {
    background: #10B981;
    color: white;
}

.text-danger {
    color: #DC2626 !important;
}

.text-warning {
    color: #F59E0B !important;
}

.text-info {
    color: #3B82F6 !important;
}

.text-success {
    color: #10B981 !important;
}

/* ===================================
   Category Badge
   =================================== */

.badge-secondary {
    background: #6B7280;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-secondary i {
    font-size: 11px;
}

/* ===================================
   Modal Sizes
   =================================== */

.modal-content.large {
    max-width: 900px !important;
}

/* ===================================
   Form Styles
   =================================== */

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.form-group small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #6B7280;
}

/* ===================================
   Info Boxes
   =================================== */

.info-box {
    background: #EFF6FF;
    border: 2px solid #3B82F6;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
}

.info-box h4 {
    color: #1E40AF;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-box ul {
    color: #4B5563;
    margin: 0;
    padding-right: 20px;
    line-height: 1.8;
}

.warning-box {
    background: #FEF3C7;
    border: 2px solid #F59E0B;
    border-radius: 8px;
    padding: 12px 15px;
    margin: 15px 0;
}

.warning-box p {
    color: #92400E;
    margin: 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-info-box {
    background: #EFF6FF;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--primary-color);
}

.product-info-box h4 {
    color: #1E40AF;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-info-box p {
    color: #6B7280;
    margin: 0;
    font-size: 14px;
}

/* ===================================
   Table Responsive
   =================================== */

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -20px;
    padding: 0 20px;
}

.table {
    width: 100%;
    min-width: 800px;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px;
    text-align: right;
    border-bottom: 1px solid #E5E7EB;
}

.table th {
    background: #F9FAFB;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}

/* ===================================
   Animations
   =================================== */

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.batch-row,
.expiring-product-item {
    animation: slideInRight 0.3s ease-out;
}

.loading-spinner {
    text-align: center;
    padding: 40px;
    color: var(--primary-color);
}

.loading-spinner i {
    font-size: 32px;
    animation: spin 1s linear infinite;
}

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

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #9CA3AF;
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 18px;
    font-weight: 500;
}

/* ===================================
   RESPONSIVE DESIGN - التصميم المتجاوب
   =================================== */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .filters-bar {
        gap: 15px;
        padding: 15px;
    }
    
    .filter-group {
        min-width: 150px;
    }
    
    .ticker-item strong {
        max-width: 120px;
    }
    
    .form-row {
        gap: 15px;
    }
}

/* Mobile (max-width: 768px) */
@media (max-width: 768px) {
    /* Ticker Responsive */
    .expiring-ticker {
        top: 56px; /* Adjusted for mobile header */
    }
    
    .ticker-header {
        padding: 6px 15px;
        font-size: 12px;
    }
    
    .ticker-content {
        padding: 8px 0;
    }
    
    .ticker-track {
        gap: 20px;
        animation: scroll 40s linear infinite; /* Faster on mobile */
    }
    
    .ticker-item {
        padding: 6px 12px;
        font-size: 11px;
        gap: 6px;
    }
    
    .ticker-item strong {
        max-width: 100px;
        font-size: 12px;
    }
    
    .ticker-quantity,
    .ticker-days {
        font-size: 11px;
    }
    
    /* Filters Bar - Stack Vertically */
    .filters-bar {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    .filter-group label {
        font-size: 13px;
    }
    
    /* Form Row - Single Column */
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    /* Table - Horizontal Scroll */
    .table-responsive {
        margin: 0 -15px;
        padding: 0 15px;
    }
    
    .table {
        font-size: 13px;
    }
    
    .table th,
    .table td {
        padding: 10px 8px;
    }
    
    /* Buttons - Full Width on Mobile */
    .header-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .header-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Modal - Full Screen */
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 10px auto !important;
    }
    
    .modal-content.large {
        max-width: 95% !important;
    }
    
    /* Info Boxes */
    .info-box,
    .warning-box,
    .product-info-box {
        padding: 12px;
        font-size: 13px;
    }
    
    .info-box h4 {
        font-size: 14px;
    }
    
    /* Empty State */
    .empty-state {
        padding: 40px 15px;
    }
    
    .empty-state i {
        font-size: 48px;
    }
    
    .empty-state p {
        font-size: 16px;
    }
}

/* Small Mobile (max-width: 480px) */
@media (max-width: 480px) {
    .ticker-track {
        animation: scroll 30s linear infinite; /* Even faster */
    }
    
    .ticker-item {
        padding: 5px 10px;
        gap: 4px;
    }
    
    .ticker-item strong {
        max-width: 80px;
        font-size: 11px;
    }
    
    .ticker-icon {
        font-size: 14px;
    }
    
    .form-control {
        padding: 10px;
        font-size: 13px;
    }
    
    .table {
        font-size: 12px;
        min-width: 600px;
    }
    
    .table th,
    .table td {
        padding: 8px 6px;
    }
}

/* Landscape Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .expiring-ticker {
        position: relative;
        top: 0;
    }
    
    .ticker-content {
        padding: 6px 0;
    }
    
    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Large Desktop (> 1440px) */
@media (min-width: 1441px) {
    .filters-bar {
        max-width: 1400px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .ticker-item strong {
        max-width: 200px;
    }
}

/* Print Styles */
@media print {
    .expiring-ticker,
    .ticker-close,
    .header-actions,
    .filter-group {
        display: none !important;
    }
    
    .table {
        font-size: 10pt;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    .expiring-ticker {
        background: linear-gradient(135deg, #422006 0%, #78350F 100%);
        border-bottom-color: #92400E;
    }
    
    .ticker-header {
        background: rgba(120, 53, 15, 0.3);
        color: #FEF3C7;
    }
    
    .ticker-item {
        background: #1F2937;
        color: #F3F4F6;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .ticker-item {
        border-width: 3px;
    }
    
    .badge-secondary {
        font-weight: 700;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .ticker-track {
        animation: none;
    }
    
    .ticker-header i.fa-exclamation-triangle {
        animation: none;
    }
    
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
