/* SimpleERP Custom Styles */

/* Global Styles */
:root {
    --primary-color: #1f6ea5;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #fb951a;
    --accent-color: #fb951a;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --sidebar-width: 280px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #f8f9fa;
}

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

.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9);
}

.navbar-dark .navbar-nav .nav-link:hover {
    color: white;
}

/* Sidebar */
.sidebar {
    background-color: #f8f9fa;
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.1);
    min-height: calc(100vh - 56px);
    padding: 1rem 0 0;
}

.sidebar .nav-link {
    color: #333;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    border-radius: 0;
    transition: all 0.2s ease;
}

.sidebar .nav-link:hover {
    color: var(--primary-color);
    background-color: rgba(31, 110, 165, 0.1);
}

.sidebar .nav-link.active {
    color: var(--primary-color);
    background-color: rgba(31, 110, 165, 0.1);
    border-right: 3px solid var(--primary-color);
}

.sidebar .nav-link i {
    width: 16px;
    text-align: center;
}

/* Main Content */
main {
    padding: 1rem;
    min-height: calc(100vh - 56px);
}

/* Cards */
.card {
    border: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.2s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: #394553;
    color: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    font-weight: 600;
}

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

.table thead th {
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    background-color: #f8f9fa;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.075);
}

/* Buttons */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.btn-group-sm > .btn, .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #1a5c91;
    border-color: #17537f;
    transform: translateY(-1px);
}

/* Forms */
.form-control {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(31, 110, 165, 0.25);
}

.form-select {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
    border-radius: 0.375rem;
}

/* Alert Messages */
.alert {
    border: none;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
}

.alert-info {
    background-color: #cff4fc;
    color: #087990;
}

/* Dashboard Cards */
.dashboard-card {
    background-color: #394553;
    border: none;
    color: white;
    transition: transform 0.2s ease;
}

.dashboard-card:hover {
    transform: translateY(-2px);
}

/* Order Items Form */
.order-item {
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #e9ecef;
}

.order-item:hover {
    background-color: #e9ecef;
}

/* Low Stock Warning */
.table-warning {
    background-color: rgba(255, 193, 7, 0.1) !important;
}

/* Status Badges */
.status-pending { background-color: var(--warning-color) !important; }
.status-processing { background-color: var(--info-color) !important; }
.status-shipped { background-color: var(--primary-color) !important; }
.status-delivered { background-color: var(--success-color) !important; }
.status-cancelled { background-color: var(--danger-color) !important; }

/* Print Styles */
@media print {
    .sidebar, .navbar, .btn-toolbar, .btn, .no-print {
        display: none !important;
    }
    
    main {
        margin-left: 0;
        padding-top: 0;
    }
    
    .col-md-9, .col-md-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .card {
        border: 1px solid #ddd;
        page-break-inside: avoid;
        margin-bottom: 1rem;
        box-shadow: none;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    body {
        background-color: white !important;
        color: black !important;
    }
}

/* Responsive Design */
@media (max-width: 1199.98px) {
    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        padding: 0;
    }
    
    main {
        margin-left: 0;
        padding-top: 0;
    }
}

@media (max-width: 767.98px) {
    .btn-toolbar {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Custom Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Utility Classes */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

.shadow {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.shadow-lg {
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Login Page Specific Styles */
.login-card {
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.95);
}

/* Dashboard Specific Styles */
.metric-card {
    border-left: 4px solid transparent;
    transition: all 0.3s ease;
}

.metric-card.primary { border-left-color: var(--primary-color); }
.metric-card.success { border-left-color: var(--success-color); }
.metric-card.info { border-left-color: var(--info-color); }
.metric-card.warning { border-left-color: var(--warning-color); }

.metric-value {
    font-size: 2rem;
    font-weight: bold;
    line-height: 1;
}

/* Order View Specific */
.order-header {
    background-color: #394553;
    color: white;
    border-radius: 0.5rem;
    padding: 2rem;
    margin-bottom: 2rem;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Customer Card */
.customer-card {
    border-left: 4px solid var(--primary-color);
}

/* Reports Charts */
.chart-container {
    position: relative;
    height: 300px;
    margin: 1rem 0;
}

/* Success and Error States */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

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

/* Focus styles for accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(31, 110, 165, 0.25);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border-width: 2px;
    }
    
    .btn {
        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;
        scroll-behavior: auto !important;
    }
}
