/**
 * Aexo Hub - Global Styles
 * Shared styles for all Aexo Hub modules
 */

/*--------------------------------------------------------------
# 1. Theme Variables
--------------------------------------------------------------*/
:root {
    --primary-color: #000000; /* Hitam dari logo */
    --secondary-color: #d13964; /* Merah-pink dari logo */
    --accent-color: #e73e66; /* Sedikit lebih terang untuk hover */
    --light-color: #f8f9fa;
    --dark-color: #212529;
}

/*--------------------------------------------------------------
# 2. Base Styles
--------------------------------------------------------------*/
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

.content-wrapper {
    flex: 1;
    width: 100%;
    overflow-x: hidden;
}

body.sidebar-open {
    overflow: hidden;
}

/*--------------------------------------------------------------
# 3. Layout Structure - Sidebar
--------------------------------------------------------------*/
/* Main sidebar container - used across all modules */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    background-color: var(--light-color);
    border-right: 1px solid #dee2e6;
    z-index: 999;
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    padding: 0;
}

/* Logo section in sidebar */
.sidebar-logo {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    text-align: center;
}

.sidebar-logo img {
    max-height: 50px;
    width: auto;
}

/* Menu section of sidebar */
.sidebar-menu {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

/* Footer section of sidebar */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #dee2e6;
    text-align: center;
}

/* Module title label in sidebar */
.module-label {
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 1rem;
}

.module-label h5 {
    color: var(--secondary-color);
    font-weight: 600;
}

.module-switcher-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Navigation in sidebar */
.sidebar .nav-link {
    color: var(--dark-color);
    padding: 0.75rem 1rem;
    border-radius: 0.25rem;
    margin: 0.2rem 0;
    white-space: normal;
    line-height: 1.2;
}

.sidebar .nav-link i {
    flex-shrink: 0;
    margin-right: 0.5rem;
}

.sidebar .nav-link:hover, 
.sidebar .nav-link.active {
    background-color: var(--secondary-color);
    color: white;
}

.sidebar .nav-link.active {
    font-weight: bold;
}

/*--------------------------------------------------------------
# 4. User Profile Component
--------------------------------------------------------------*/
/* Profile card - used in sidebar and can be used in user pages */
.user-profile {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.profile-image {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    overflow: hidden;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.profile-image:hover {
    background-color: #e9ecef;
}

.profile-image i {
    font-size: 1.75rem;
    color: var(--dark-color);
}

.profile-details {
    line-height: 1.2;
    flex: 1;
    font-size: 0.9rem;
}

/*--------------------------------------------------------------
# 5. Module Switcher
--------------------------------------------------------------*/
/* Module cards used in the module switcher */
.module-card {
    display: block;
    text-decoration: none;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 1rem;
    color: var(--dark-color);
    text-align: center;
    transition: all 0.2s ease;
}

.module-card:hover {
    background-color: #f8f9fa;
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.module-card.active {
    background-color: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.module-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.module-name {
    font-weight: 500;
}

/*--------------------------------------------------------------
# 6. Content Area
--------------------------------------------------------------*/
/* Main content area */
.main-content {
    margin-left: 280px;
    padding: 1.5rem;
    width: calc(100% - 280px);
    transition: margin-left 0.3s ease-in-out, width 0.3s ease-in-out;
}

/*--------------------------------------------------------------
# 7. Card Components
--------------------------------------------------------------*/
/* Card styles - used for all information cards across modules */
.card {
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 1rem;
}

.card-header {
    background-color: var(--light-color);
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    font-weight: bold;
}

.card-header h5 {
    margin-bottom: 0;
}

/* Card nesting styles */
.card .card {
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #dee2e6;
}

/* Equal height cards */
.card.h-100 {
    height: 100% !important;
}

/*--------------------------------------------------------------
# 8. Button Styles
--------------------------------------------------------------*/
/* Primary button uses theme secondary color */
.btn-primary {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

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

.btn-outline-primary {
    color: var(--secondary-color) !important;
    border-color: var(--secondary-color) !important;
}

.btn-outline-primary:hover {
    background-color: var(--secondary-color) !important;
    color: white !important;
}

/* Navbar button style */
.btn-outline-navbar {
    color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.btn-outline-navbar:hover {
    color: white;
    background-color: var(--secondary-color);
}

/* Modal buttons spacing */
.modal-footer .btn {
    min-width: 80px;
}

/*--------------------------------------------------------------
# 9. Table Styles
--------------------------------------------------------------*/
/* Table styles - used for data tables in all modules */
.table {
    margin-bottom: 0;
}

.table-hover tbody tr:hover {
    background-color: rgba(209, 57, 100, 0.1);
}

.table-responsive {
    margin: 0;
    padding: 0;
    border: none;
}

.table .text-center {
    white-space: nowrap;
}

.table td, .table th {
    vertical-align: middle;
    padding: 0.75rem !important;
}

.table th {
    background-color: #f8f9fa;
}

/* DataTables specific styles */
.datatable thead th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.datatable {
    width: 100% !important;
}

.card-body.p-0 .datatable-wrapper,
.card-body.p-0 .datatable-container {
    padding: 1rem;
}

/* Table actions column */
.table-actions {
    white-space: nowrap;
    display: flex;
    justify-content: flex-end;
    gap: 0.25rem;
}

.table-actions .btn {
    margin-right: 0.25rem;
}

/*--------------------------------------------------------------
# 10. Form Styles
--------------------------------------------------------------*/
/* Form control styles */
.form-control:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 0.25rem rgba(209, 57, 100, 0.25);
}

/* Input group styling */
.input-group {
    flex-wrap: nowrap !important;
}

.row .col-sm-9 .input-group {
    display: flex;
    flex-wrap: nowrap;
}

/* Form feedback */
.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #dc3545;
}

/*--------------------------------------------------------------
# 11. Badges & Status Indicators
--------------------------------------------------------------*/
/* Badge styles - for status indicators */
.badge {
    font-weight: normal;
    padding: 0.35em 0.65em;
}

/* Role badges */
.badge.bg-admin {
    background-color: var(--secondary-color);
    color: white;
}

.badge.bg-user {
    background-color: #6c757d;
    color: white;
}

/*--------------------------------------------------------------
# 12. Kanban Board Component
--------------------------------------------------------------*/
/* Kanban board - used in project management and sales pipelines */
.kanban-container {
    display: flex;
    overflow-x: auto;
    gap: 16px;
    padding-bottom: 20px;
}

.kanban-column {
    flex: 0 0 300px;
    min-width: 300px;
    background-color: #f8f9fa;
    border-radius: 6px;
    padding: 12px;
}

.kanban-column-header {
    padding: 8px 0;
    margin-bottom: 12px;
    font-weight: bold;
    border-bottom: 1px solid #dee2e6;
}

.kanban-item {
    background-color: white;
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    cursor: default !important;
}

/* Status colors for kanban */
.kanban-column[data-status="Lead"] .kanban-column-header {
    color: #6c757d;
}

.kanban-column[data-status="Negotiation"] .kanban-column-header {
    color: #007bff;
}

.kanban-column[data-status="Closed Won"] .kanban-column-header {
    color: #28a745;
}

.kanban-column[data-status="Closed Lost"] .kanban-column-header {
    color: #dc3545;
}

/*--------------------------------------------------------------
# 13. Customer Components
--------------------------------------------------------------*/
/* Customer card - used in sales module, can be used in CRM */
.customer-card {
    background-color: #fff;
    transition: background-color 0.2s ease;
}

.customer-card:hover {
    background-color: rgba(209, 57, 100, 0.05);
}

.customer-card:last-child {
    border-bottom: none !important;
}

.customer-card .badge {
    font-weight: normal;
}

/*--------------------------------------------------------------
# 14. Permission Components
--------------------------------------------------------------*/
/* Permission settings - used in admin module */
.permission-category {
    margin-bottom: 1.5rem;
}

.permission-category-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--secondary-color);
}

.permission-list {
    padding-left: 1.5rem;
}

.permission-item {
    margin-bottom: 0.5rem;
}

/*--------------------------------------------------------------
# 15. Master Data Components
--------------------------------------------------------------*/
/* Master data cards - used in admin module */
.master-data-card {
    transition: transform 0.2s ease-in-out;
}

.master-data-card:hover {
    transform: translateY(-5px);
}

.master-data-icon {
    font-size: 2.5rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

/*--------------------------------------------------------------
# 16. Dashboard Components
--------------------------------------------------------------*/
/* Stats cards - used in dashboards across modules */
.stats-card {
    border-left: 4px solid var(--secondary-color);
}

.stats-icon {
    font-size: 2rem;
    color: var(--secondary-color);
}

.stats-title {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.stats-value {
    font-size: 1.5rem;
    font-weight: 600;
}

/*--------------------------------------------------------------
# 17. Login & Auth Components
--------------------------------------------------------------*/
/* Login page styles */
.login-container {
    max-width: 400px;
    margin: 30px auto;
    padding-top: 0;
}

.login-logo {
    text-align: center;
    margin-bottom: 15px;
}

.login-card {
    margin-top: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.login-logo img {
    max-width: 200px;
}

/* Login page module shortcuts */
.module-shortcuts {
    margin-top: 30px;
}

.module-shortcuts-title {
    text-align: center;
    margin-bottom: 15px;
    font-size: 16px;
    color: #666;
}

.module-shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.module-shortcut {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #333;
    padding: 10px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.module-shortcut:hover {
    background-color: #f0f0f0;
    color: var(--secondary-color);
}

.module-shortcut-icon {
    font-size: 24px;
    margin-bottom: 5px;
    color: var(--secondary-color);
}

.module-shortcut-name {
    font-size: 12px;
    text-align: center;
}

.module-title {
    text-align: center;
    margin-bottom: 20px;
    font-size: 28px;
    font-weight: 600;
    color: var(--dark-color);
}

/*--------------------------------------------------------------
# 18. Dropdown & Navigation Components
--------------------------------------------------------------*/
/* Dropdown menu styles */
.dropdown-menu {
    padding: 0.5rem 0;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border: 1px solid #dee2e6;
}

.dropdown-item-text {
    padding: 0.5rem 1rem;
    color: var(--dark-color);
}

.dropdown-item {
    padding: 0.5rem 1rem;
    color: var(--dark-color);
    transition: all 0.2s ease;
}

.dropdown-item:hover, .dropdown-item:focus {
    background-color: rgba(209, 57, 100, 0.1);
    color: var(--secondary-color);
}

/* Remove dropdown arrow */
.dropdown-toggle::after {
    display: none;
}

/* Navbar styles */
.navbar {
    background-color: white !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-dark .navbar-nav .nav-link {
    color: var(--primary-color) !important;
}

.navbar-dark .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%280, 0, 0, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.navbar-dark .navbar-toggler {
    border-color: rgba(0,0,0,0.1);
}

.logo-img {
    max-height: 60px;
    width: auto;
}

.welcome-text {
    color: var(--primary-color) !important;
}

/*--------------------------------------------------------------
# 19. Footer Components
--------------------------------------------------------------*/
/* Footer styles */
footer {
    margin-top: 2rem;
    padding: 1rem 0;
    background-color: var(--light-color);
    border-top: 1px solid #dee2e6;
}

/*--------------------------------------------------------------
# 20. Helper Classes
--------------------------------------------------------------*/
.text-primary {
    color: var(--secondary-color) !important;
}

.text-smaller {
    font-size: 0.875rem;
}

.text-break {
    word-break: break-word !important;
}

/*--------------------------------------------------------------
# 21. Mobile & Responsive Styles
--------------------------------------------------------------*/
/* Sidebar toggle button */
.sidebar-toggler {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1040;
    background-color: white;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    width: 40px;
    height: 40px;
    text-align: center;
    line-height: 40px;
    border: none;
}

.sidebar-toggler i {
    font-size: 1.5rem;
    color: var(--dark-color);
}

/* Content overlay for mobile */
.content-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    z-index: 1020;
    display: none;
    cursor: pointer;
}

.content-overlay.show {
    display: block;
}

/*--------------------------------------------------------------
# 21. Sales Specific
--------------------------------------------------------------*/

#customer_name {
    width: auto;
    flex: 1;
    min-width: 200px;
    max-width: calc(100% - 70px);
}

#add-customer-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    height: 100%;
    padding: 0.375rem 0.75rem;
    white-space: nowrap;
    font-size: 0.875rem;
    text-align: center;
}

#add-customer-btn i {
    margin-right: 0.25rem;
    font-size: 0.875rem;
}

/* Loading indicator spesifik untuk Sales */
#ajaxLoading {
    z-index: 9999;
    background-color: rgba(0,0,0,0.3);
}

/* Untuk drag handling di kanban */
.kanban-item[draggable] {
    -webkit-user-drag: none !important;
    user-drag: none !important;
    -webkit-user-select: text !important;
    user-select: text !important;
}


/* Medium screens (tablets) */
@media (max-width: 992px) {
    body {
        display: block;
    }
    
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        box-shadow: 0 0 15px rgba(0,0,0,0.2);
        z-index: 1030;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
        padding-top: 4rem;
    }
    
    .sidebar-toggler {
        display: block;
        z-index: 1040;
    }
    
    .logo-img {
        max-height: 45px;
    }
    
    .navbar .container-fluid {
        padding-right: 0.5rem;
    }
    
    .profile-image {
        margin-left: 0.5rem;
    }
}

/* Kanban board on mobile */
@media (max-width: 768px) {
    .kanban-container {
        flex-direction: column;
    }
    
    .kanban-column {
        min-width: 100%;
        margin-bottom: 16px;
    }
    
    .border-md-end {
        border-right: 1px solid #dee2e6;
    }
}

/* Small screens (phones) */
@media (max-width: 767.98px) {
    .th-responsive {
        width: auto !important;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    .card-header {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
    
    .list-group-item {
        padding: 0.75rem 0.5rem;
    }
    
    h4.text-primary {
        font-size: 1.3rem;
    }
    
    h5 {
        font-size: 1rem;
    }
    
    .py-3 {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }
    
    .col-md-4:not(:last-child) .py-3 {
        border-bottom: 1px solid #dee2e6;
    }
    
    .gap-2 {
        gap: 0.375rem !important;
    }
    
    .form-control, .form-select, .input-group-text {
        font-size: 0.875rem;
        padding: 0.25rem 0.5rem;
    }
    
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .h3.text-primary {
        font-size: 1.5rem;
    }
    
    .h5 {
        font-size: 0.9rem;
    }
    
    .customer-card {
        padding: 12px !important;
        margin-bottom: 0;
    }
    
    .fw-bold {
        font-weight: 600 !important;
    }
    
    .col-form-label {
        padding-bottom: 0;
        margin-bottom: 0.25rem;
    }
    
    .form-control, .form-select {
        font-size: 16px;
    }
    
    .row.mb-3 {
        margin-bottom: 1rem !important;
    }
}

/* Small mobile devices */
@media (max-width: 575.98px) {
    #customer_name {
        min-width: 150px;
    }
    
    #add-customer-btn {
        min-width: 60px;
        padding: 0.375rem 0.5rem;
    }
    
    h1.h3 {
        margin-bottom: 0;
    }
    
    .table th,
    .table td {
        padding: 0.4rem;
        font-size: 0.8rem;
    }
    
    .list-group-item {
        padding: 0.6rem 0.4rem;
    }
    
    h4.text-primary {
        font-size: 1.2rem;
    }
    
    h5 {
        font-size: 0.9rem;
    }
    
    .badge {
        padding: 0.2em 0.35em;
        font-size: 0.7em;
    }
    
    .card {
        margin-bottom: 0.75rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .custom-date-form .d-flex {
        flex-direction: column;
    }
    
    .custom-date-form .flex-grow-1 {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .custom-date-form button {
        width: 100%;
    }
    
    .h3.text-primary {
        font-size: 1.25rem;
    }
    
    form.d-flex button {
        white-space: nowrap;
    }
}

/* Medium to large screens */
@media (max-width: 1199.98px) {
    .table .btn-sm {
        padding: 0.25rem 0.4rem;
        font-size: 0.75rem;
    }
    
    .table .btn-sm i {
        margin-right: 2px;
        font-size: 0.7rem;
    }
}