﻿/* Modern CSS for AI-Software Application */

/* General UI Enhancements */
:root {
    --primary: #4361ee;
    --secondary: #3f37c9;
    --success: #4cc9f0;
    --info: #4895ef;
    --warning: #f72585;
    --danger: #ff0a54;
    --light: #f8f9fa;
    --dark: #212529;
    --primary-light: rgba(67, 97, 238, 0.1);
    --secondary-light: rgba(63, 55, 201, 0.1);
    --success-light: rgba(76, 201, 240, 0.1);
    --info-light: rgba(72, 149, 239, 0.1);
    --warning-light: rgba(247, 37, 133, 0.1);
    --danger-light: rgba(255, 10, 84, 0.1);
}

body {
    background-color: #f5f7fa;
    font-family: 'Inter', 'Segoe UI', Roboto, sans-serif;
    overflow-x: hidden; /* Prevent horizontal scrolling */
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0); /* Remove tap highlight on mobile */
}

.navbar {
    background: linear-gradient(135deg, var(--primary), var(--secondary)) !important;
    padding: 0.75rem 1rem;
}

.navbar-brand {
    font-weight: 600;
}

.card {
    border-radius: 0.75rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

    .card:hover {
        transform: translateY(-3px);
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08) !important;
    }

.card-header {
    border-top-left-radius: 0.75rem !important;
    border-top-right-radius: 0.75rem !important;
    padding: 1rem 1.25rem;
}

.btn {
    font-weight: 500;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

    .btn-primary:hover {
        background-color: var(--secondary);
        border-color: var(--secondary);
    }

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

    .btn-outline-primary:hover {
        background-color: var(--primary);
        border-color: var(--primary);
    }

.form-control, .form-select {
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid #e0e6ed;
}

    .form-control:focus, .form-select:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 0.25rem rgba(67, 97, 238, 0.25);
    }

.table {
    vertical-align: middle;
}

/* Fixed header adjustments */
header {
    z-index: 1030;
}

/* Gradient Backgrounds for Stats Cards */
.bg-gradient-blue {
    background: linear-gradient(135deg, #4cc9f0, #4361ee);
    color: white;
}

.bg-gradient-green {
    background: linear-gradient(135deg, #0bb4aa, #3f8f8d);
    color: white;
}

.bg-gradient-cyan {
    background: linear-gradient(135deg, #4895ef, #3f37c9);
    color: white;
}

.bg-gradient-orange {
    background: linear-gradient(135deg, #f72585, #b5179e);
    color: white;
}

/* Icon Circles */
.icon-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.2);
}

.icon-circle-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

/* Background Colors for Profit Badges */
.bg-success-lightest {
    background-color: rgba(40, 167, 69, 0.1);
}

.bg-success-lighter {
    background-color: rgba(40, 167, 69, 0.2);
}

.bg-success-light {
    background-color: rgba(40, 167, 69, 0.5);
}

.bg-danger-lightest {
    background-color: rgba(220, 53, 69, 0.1);
}

.bg-danger-lighter {
    background-color: rgba(220, 53, 69, 0.2);
}

.bg-danger-light {
    background-color: rgba(220, 53, 69, 0.5);
}

.bg-secondary-light {
    background-color: rgba(108, 117, 125, 0.2);
}

/* Sidebar Styles */
.sidebar {
    width: 260px;
    background-color: #fff;
    height: calc(100vh - 56px);
    position: fixed;
    top: 56px;
    left: 0;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    z-index: 1000;
    transition: transform 0.3s ease, margin-left 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.sidebar-title {
    margin-bottom: 0;
    font-weight: 600;
    color: var(--dark);
}

.sidebar-content {
    padding: 1rem 0;
    flex-grow: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scrollbar-width: thin; /* Modern thin scrollbar */
}

.sidebar-section {
    margin-bottom: 1.5rem;
}

.sidebar-heading {
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 600;
    color: #6c757d;
    padding: 0.5rem 1.25rem;
    margin-bottom: 0.5rem;
}

.sidebar .nav-link {
    padding: 0.5rem 1.25rem;
    color: #495057;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

    .sidebar .nav-link:hover, .sidebar .nav-link.active {
        background-color: rgba(67, 97, 238, 0.1);
        color: var(--primary);
        border-left-color: var(--primary);
    }

.content {
    margin-left: 260px;
    padding-top: 70px;
    transition: margin-left 0.3s ease;
}

/* Mobile Optimizations */
@media (max-width: 991.98px) {
    .sidebar {
        margin-left: -260px;
        transform: translateX(0);
        width: 260px;
        max-width: 80%;
        box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
        z-index: 1020;
    }

        .sidebar.active {
            margin-left: 0;
            transform: translateX(0);
        }

    .content {
        margin-left: 0;
    }

        .content.active {
            margin-left: 0;
        }

    /* Overlay for sidebar */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1010;
        opacity: 0;
        transition: opacity 0.3s ease;
        backdrop-filter: blur(2px);
    }

        .sidebar-overlay.active {
            opacity: 1;
        }

    body.sidebar-open {
        overflow: hidden;
    }
}

/* Submenu improvements for mobile */
@media (max-width: 991.98px) {
    .submenu {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
    }

        .submenu.show {
            max-height: 500px; /* Arbitrary large value, will animate to actual height */
        }

        /* Nested submenus */
        .submenu .submenu {
            margin-left: 0.5rem;
            border-left: 1px solid rgba(0, 0, 0, 0.1);
        }

    .dark-mode .submenu .submenu {
        border-left-color: rgba(255, 255, 255, 0.1);
    }
}

/* Improved navbar on mobile */
@media (max-width: 767.98px) {
    .navbar-brand {
        font-size: 1.1rem;
        max-width: 180px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Better dropdown positioning */
    .dropdown-menu {
        position: absolute !important;
        margin-top: 0.5rem;
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    }

    /* Improve navbar collapse spacing */
    .navbar-collapse {
        padding-top: 0.5rem;
        max-height: calc(100vh - 56px);
        overflow-y: auto;
    }

    /* Add dividers between navbar items */
    .navbar-nav .nav-item:not(:last-child) {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* Touch-optimized styles */
.touch-device button,
.touch-device .btn,
.touch-device .nav-link,
.touch-device .dropdown-item {
    min-height: 44px; /* Apple's recommended minimum touch target size */
}

/* Card optimizations for mobile */
@media (max-width: 767.98px) {
    .card-header {
        padding: 0.75rem 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* Stack card actions */
    .card-header .card-actions {
        margin-top: 0.5rem;
    }

    /* Stats cards - improve display on small screens */
    .stats-card .card-title {
        font-size: 0.9rem;
    }

    .stats-card .stats-value {
        font-size: 1.5rem;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    body.dark-mode {
        background-color: #1a1a2e;
        color: #f0f0f0;
    }

        body.dark-mode .card,
        body.dark-mode .sidebar {
            background-color: #16213e;
            border-color: #0f3460;
        }

        body.dark-mode .card-header,
        body.dark-mode .table > :not(caption) > * > * {
            background-color: #16213e;
            color: #f0f0f0;
            border-color: #0f3460;
        }

        body.dark-mode .text-muted {
            color: #adb5bd !important;
        }

        body.dark-mode .nav-link {
            color: #e1e1e1;
        }

        body.dark-mode .form-control,
        body.dark-mode .form-select {
            background-color: #0f3460;
            border-color: #1a1a2e;
            color: #f0f0f0;
        }

        body.dark-mode .mobile-actions-bar {
            background: #16213e;
            box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
        }
}

/* DataTables customization */
.dataTables_wrapper .dataTables_length select {
    min-width: 80px;
    padding: 0.375rem 1.75rem 0.375rem 0.75rem;
}

.dataTables_wrapper .dataTables_filter input {
    border-radius: 0.5rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid #e0e6ed;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 0.25rem;
}

    .dataTables_wrapper .dataTables_paginate .paginate_button.current {
        background: var(--primary);
        border-color: var(--primary);
        color: white !important;
    }

    .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
        background: var(--primary-light);
        border-color: var(--primary-light);
        color: var(--primary) !important;
    }

/* Better DataTables on mobile */
@media (max-width: 767.98px) {
    .dataTables_wrapper .dataTables_filter {
        width: 100%;
        margin-bottom: 1rem;
    }

        .dataTables_wrapper .dataTables_filter input {
            width: 100%;
            display: block;
            margin-left: 0 !important;
            margin-top: 0.5rem;
        }

    .dataTables_wrapper .dataTables_length {
        text-align: left;
        margin-bottom: 0.5rem;
    }

    /* Smaller pagination on mobile */
    .dataTables_wrapper .dataTables_paginate .paginate_button {
        padding: 0.3rem 0.6rem;
    }

    .dataTables_length, .dataTables_filter,
    .dataTables_info, .dataTables_paginate {
        float: none !important;
        text-align: center !important;
        margin-bottom: 0.5rem;
    }

    div.dataTables_wrapper div.dataTables_paginate ul.pagination {
        justify-content: center !important;
    }

    .pagination .page-link {
        padding: 0.4rem 0.75rem;
        font-size: 0.9rem;
    }
}

/* Form optimizations for mobile */
@media (max-width: 767.98px) {
    /* Increase form control size for better touch */
    .form-control,
    .form-select,
    .input-group .btn {
        font-size: 16px; /* Prevents zoom on iOS */
        line-height: 1.5;
        padding: 0.5rem 0.75rem;
        min-height: 44px;
    }

    /* Stack buttons on mobile */
    .form-actions .btn:not(:last-child) {
        margin-bottom: 0.5rem;
    }

    /* Stack form action buttons on small devices */
    .d-flex.justify-content-end .btn:not(:last-child) {
        margin-bottom: 0.5rem;
        margin-right: 0 !important;
    }
}

@media (max-width: 575.98px) {
    .navbar-brand {
        font-size: 1.2rem;
        max-width: 180px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Stack form buttons on small devices */
    .form-group .btn {
        display: block;
        width: 100%;
        margin-bottom: 0.5rem;
    }

    /* Adjust card titles and fonts */
    .card-title {
        font-size: 1.25rem;
    }

    /* Stack action buttons in tables */
    .table .action-buttons .btn {
        margin-bottom: 0.25rem;
    }

    .d-flex.justify-content-end {
        flex-direction: column;
    }

        .d-flex.justify-content-end .btn {
            width: 100%;
        }
}

/* Tablet adjustments (768px to 991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    /* Adjust card layouts for tablets */
    .card-deck .card, .card-group .card {
        flex: 0 0 calc(50% - 30px);
        margin-bottom: 20px;
    }

    /* Improve table responsiveness */
    .table-responsive {
        margin-bottom: 1rem;
    }

    /* Form improvements */
    .form-row {
        display: flex;
        flex-wrap: wrap;
    }

        .form-row > [class*="col-"] {
            padding-right: 5px;
            padding-left: 5px;
        }
}

/* Touch improvements for navigation */
@media (hover: none) {
    .nav-link, .btn {
        padding-top: 0.6rem;
        padding-bottom: 0.6rem;
    }

    /* Improve touch targets */
    .dropdown-item {
        padding-top: 0.6rem;
        padding-bottom: 0.6rem;
    }
}

/* Responsive table adjustments */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Fixed bottom action bar for mobile */
.mobile-actions-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    padding: 0.75rem 1rem;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
}

@media (max-width: 767.98px) {
    .mobile-actions-bar {
        display: block;
    }

    /* Add padding to content to avoid overlap with fixed bar */
    .content {
        padding-bottom: 70px;
    }
}

/* Add accessibility focus styles */
button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Utility classes for mobile display */
@media (max-width: 767.98px) {
    .mobile-full-width {
        width: 100% !important;
        margin-right: 0 !important;
        margin-left: 0 !important;
    }

    .mobile-text-center {
        text-align: center !important;
    }

    .mobile-mt-3 {
        margin-top: 1rem !important;
    }

    .mobile-mb-3 {
        margin-bottom: 1rem !important;
    }

    /* Reduce padding on containers */
    .container, .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }

    /* Adjust modal on mobile */
    .modal-dialog {
        margin: 0.5rem;
    }
}


/* Fix za body overflow */
html, body {
    overflow-x: visible;
    max-width: 100%;
}

/* Omogući scrollanje unutar content područja */
.content {
    overflow-x: visible;
    max-width: 100vw;
}

/* Osnovni fix za tablice */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: block;
}

/* Fix za DataTables */
.dataTables_wrapper {
    width: 100%;
    overflow-x: auto;
}

/* Osiguraj da su tablice dovoljno široke */
.dataTable {
    min-width: 800px;
}

/* Omogući scrollanje na mobilnim */
@media (max-width: 767.98px) {
    .table {
        min-width: 800px;
    }
}