/* MXBOT Corporate Order Management System Styles */

:root {
    --primary-color: #2E86AB;
    --secondary-color: #A23B72;
    --success-color: #F18F01;
    --danger-color: #C73E1D;
    --warning-color: #FFB627;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow-x: hidden;
}

.login-bg {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    max-width: 500px;
    width: 100%;
    padding: 2rem;
}

.login-form {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #1d5f85;
    border-color: #1d5f85;
}

.text-primary {
    color: var(--primary-color) !important;
}

/* Dashboard Styles */
.sidebar {
    background: linear-gradient(180deg, var(--primary-color) 0%, #1d5f85 100%);
    min-height: 100vh;
    max-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    position: fixed;
    width: 250px;
    left: 0;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar .nav-link {
    color: rgba(255,255,255,0.8);
    padding: 0.6rem 1rem;
    margin: 0.1rem 0;
    border-radius: 0.4rem;
    transition: all 0.3s ease;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 100%;
    box-sizing: border-box;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: white;
    background: rgba(255,255,255,0.1);
    transform: translateX(5px);
}

.sidebar .nav-link i {
    margin-right: 0.4rem;
    width: 16px;
    font-size: 0.8rem;
}

/* Sidebar navigation flex container */
.sidebar nav {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 0.4rem;
    max-height: calc(100vh - 180px);
}

/* Logout section at bottom */
.sidebar .mt-auto {
    flex-shrink: 0;
    margin-top: auto !important;
    padding: 0.8rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* User info styling */
.sidebar .mt-auto .text-white-50 {
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

/* Logout button styling */
.sidebar .mt-auto .btn {
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    width: 100%;
}

.main-content {
    background: #f8f9fa;
    min-height: 100vh;
    margin-left: 250px !important;
    border: none;
    outline: none;
    position: relative;
    overflow-x: hidden;
    width: calc(100vw - 250px) !important;
    max-width: none !important;
    flex: none !important;
    padding-left: 15px;
    padding-right: 15px;
}

.top-bar {
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 1rem 0;
    border: none;
}

.content-section {
    border: none;
    outline: none;
}

.stats-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-5px);
}

.stats-card .icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stats-card .icon.primary {
    background: var(--primary-color);
}

.stats-card .icon.success {
    background: var(--success-color);
}

.stats-card .icon.warning {
    background: var(--warning-color);
}

.stats-card .icon.danger {
    background: var(--danger-color);
}

.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.card-header {
    background: white;
    border-bottom: 1px solid #eee;
    font-weight: 600;
}

.table {
    margin-bottom: 0;
}

.badge {
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
}

/* Status badges */
.badge-pending {
    background-color: var(--warning-color);
    color: white;
}

.badge-approved {
    background-color: var(--success-color);
    color: white;
}

.badge-rejected {
    background-color: var(--danger-color);
    color: white;
}

.badge-processing {
    background-color: var(--info-color);
    color: white;
}

.badge-delivered {
    background-color: #28a745;
    color: white;
}

/* Credit limit progress */
.credit-progress {
    height: 8px;
    border-radius: 4px;
}

.credit-progress .progress-bar {
    border-radius: 4px;
}

/* Rules section */
.rule-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.5rem;
}

.rule-item .rule-type {
    font-weight: 600;
    color: var(--primary-color);
}

/* Order items */
.order-item {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: white;
}

/* Loading spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .login-container {
        padding: 1rem;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: -250px;
        width: 250px;
        z-index: 1000;
        transition: left 0.3s ease;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .main-content {
        margin-left: 0 !important;
        width: 100vw !important;
        max-width: 100% !important;
    }
        transition: left 0.3s ease;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
    }
}

/* Center Modal Notifications */
.notification-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes slideIn {
    from {
        transform: scale(0.7) translateY(-50px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Legacy notification styles (keep for compatibility) */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    min-width: 300px;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.notification.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.notification.warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

/* Form enhancements */
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(46, 134, 171, 0.25);
}

.form-control.is-invalid {
    border-color: var(--danger-color);
    box-shadow: 0 0 0 0.2rem rgba(199, 62, 29, 0.25);
}

.form-control.is-valid {
    border-color: var(--success-color);
    box-shadow: 0 0 0 0.2rem rgba(241, 143, 1, 0.25);
}

.invalid-feedback {
    display: block;
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.btn {
    border-radius: 6px;
    font-weight: 500;
    padding: 0.5rem 1.5rem;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

/* Charts */
.chart-container {
    position: relative;
    height: 300px;
}

/* Modal enhancements */
.modal-content {
    border: none;
    border-radius: 10px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.2);
}

.modal-header {
    border-bottom: 1px solid #eee;
    background: var(--primary-color);
    color: white;
    border-radius: 10px 10px 0 0;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

/* Print styles */
@media print {
    .sidebar,
    .top-bar,
    .btn,
    .modal {
        display: none !important;
    }
    
    .main-content {
        margin: 0;
        padding: 0;
    }
}

/* Dashboard Widget Scroll */
#recentOrdersTable, #pendingRegistrations {
    max-height: 350px; /* ඔබට අවශ්‍ය උසට මෙම අගය වෙනස් කළ හැක */
    overflow-y: auto;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    /* Hide sidebar by default on mobile */
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        z-index: 1050;
        transition: left 0.3s ease;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    /* Adjust main content for mobile */
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    /* Top bar mobile */
    .top-bar {
        position: relative;
        padding: 0.75rem 0;
    }
    
    .top-bar .container-fluid {
        padding: 0 1rem;
    }
    
    .top-bar h1 {
        font-size: 1.5rem;
    }
    
    /* Mobile menu button */
    .mobile-menu-btn {
        display: block;
        background: none;
        border: none;
        color: var(--primary-color);
        font-size: 1.5rem;
        padding: 0.5rem;
        margin-right: 1rem;
    }
    
    /* Stats cards responsive */
    .stats-card {
        margin-bottom: 1rem;
        text-align: center;
    }
    
    .stats-card .icon {
        margin: 0 auto 1rem;
    }
    
    /* Table responsive */
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
        white-space: nowrap;
    }
    
    /* Action buttons mobile */
    .btn-sm {
        padding: 0.2rem 0.5rem;
        font-size: 0.75rem;
    }
    
    /* Modal mobile */
    .modal-dialog {
        margin: 1rem 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    /* Form mobile */
    .form-control,
    .form-select {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Cards mobile */
    .card {
        margin-bottom: 1rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Sidebar overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 576px) {
    /* Extra small screens */
    .container-fluid {
        padding: 0 0.75rem;
    }
    
    .top-bar h1 {
        font-size: 1.25rem;
    }
    
    .stats-card {
        padding: 1rem;
    }
    
    .stats-card .icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .table-responsive {
        font-size: 0.8rem;
    }
    
    .btn-sm {
        padding: 0.15rem 0.4rem;
        font-size: 0.7rem;
    }
    
    /* Hide some columns on very small screens */
    .table .d-none.d-sm-table-cell {
        display: none !important;
    }
}

/* Desktop styles */
@media (min-width: 769px) {
    .mobile-menu-btn {
        display: none;
    }
    
    .sidebar {
        position: fixed;
        left: 0;
    }
    
    .main-content {
        margin-left: 280px;
    }
}