/* Dashboard and Forms Styling */

.dashboard-body {
    background: var(--light-gray);
    min-height: 100vh;
    padding: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header h1 {
    color: var(--primary-blue);
    margin: 0;
    font-size: 28px;
}

/* Form Container */
.form-container {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.form-container h2 {
    color: var(--primary-blue);
    margin-bottom: 25px;
    font-size: 24px;
}

.form-section {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--light-gray);
}

.form-section:last-child {
    border-bottom: none;
}

.form-section h3 {
    color: var(--secondary-blue);
    margin-bottom: 15px;
    font-size: 18px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    color: var(--dark-gray);
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 14px;
}

.required {
    color: var(--error-red);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 15px;
    border: 1px solid var(--medium-gray);
    border-radius: 8px;
    font-size: 14px;
    color: var(--dark-gray);
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(44, 75, 124, 0.1);
}

.form-group textarea {
    resize: vertical;
    font-family: inherit;
}

/* Checkbox Group */
.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--light-gray);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.checkbox-item:hover {
    background: #E8EEF5;
}

.checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: var(--primary-blue);
}

.checkbox-item label {
    margin: 0;
    cursor: pointer;
    font-weight: normal;
    color: var(--dark-gray);
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background: var(--secondary-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 75, 124, 0.3);
}

.btn-secondary {
    background: var(--medium-gray);
    color: var(--dark-gray);
}

.btn-secondary:hover {
    background: var(--text-gray);
    color: white;
}

.btn-danger {
    background: var(--error-red);
    color: white;
}

.btn-danger:hover {
    background: #C0392B;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--light-gray);
}

/* Table Styling */
.list-container {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: visible;
}

.list-container h2 {
    color: var(--primary-blue);
    margin-bottom: 20px;
    font-size: 22px;
}

.table-container {
    overflow-x: auto;
    width: calc(100% + 60px);
    margin: 0 -30px;
    padding: 0 30px;
}

/* Table wrapper for scrollable tables */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--primary-blue);
    color: white;
}

thead th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

tbody tr {
    border-bottom: 1px solid var(--light-gray);
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: #F8FAFB;
}

tbody td {
    padding: 12px 15px;
    color: var(--dark-gray);
    font-size: 14px;
}

tbody td.loading {
    text-align: center;
    color: var(--text-gray);
    font-style: italic;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-staff {
    background: #E3F2FD;
    color: #1976D2;
}

.badge-client {
    background: #E8F5E9;
    color: #388E3C;
}

.badge-consignee {
    background: #FFF3E0;
    color: #F57C00;
}

.badge-admin {
    background: #F3E5F5;
    color: #7B1FA2;
}

/* Messages */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
}

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

.message.error {
    background: var(--error-red);
    color: white;
    display: block;
}

.message.success {
    background: var(--success-green);
    color: white;
    display: block;
}

.message.info {
    background: var(--info-blue);
    color: white;
    display: block;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .checkbox-group {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions button {
        width: 100%;
    }
    
    .table-container {
        overflow-x: scroll;
    }
}

/* Card Styling */
.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    background: var(--primary-blue);
    color: white;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.card-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.card-body {
    padding: 25px;
}

/* Table inside cards */
.card .table {
    margin: 0;
    background: white;
}

.card .table thead {
    background: var(--primary-blue);
}

.card .table tbody td {
    color: var(--dark-gray);
    background: white;
}

.card .table tbody tr:hover {
    background: #F8FAFB;
}

/* Row/Column Layout */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.col-lg-8 {
    flex: 0 0 66.666667%;
    max-width: 66.666667%;
    padding: 0 10px;
}

.col-lg-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
    padding: 0 10px;
}

@media (max-width: 992px) {
    .col-lg-8,
    .col-lg-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Dashboard Grid */
.dashboard-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 25px;
    margin-bottom: 30px;
}

.dashboard-grid .dashboard-card {
    flex: 0 0 calc(20% - 20px);
    min-width: 160px;
}

@media (max-width: 1200px) {
    .dashboard-grid .dashboard-card {
        flex: 0 0 calc(25% - 19px);
    }
}

@media (max-width: 900px) {
    .dashboard-grid .dashboard-card {
        flex: 0 0 calc(33.333% - 17px);
    }
}

@media (max-width: 640px) {
    .dashboard-grid .dashboard-card {
        flex: 0 0 calc(50% - 13px);
    }
}

@media (max-width: 400px) {
    .dashboard-grid .dashboard-card {
        flex: 0 0 100%;
    }
}

.dashboard-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(6, 57, 112, 0.08);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
    min-height: 180px;
    border: 1px solid rgba(6, 57, 112, 0.05);
}

.dashboard-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 24px rgba(6, 57, 112, 0.15);
    border-color: var(--primary-blue);
}

.card-icon {
    width: 70px;
    height: 70px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 10px;
}

.card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card-content h3 {
    color: var(--primary-blue);
    margin: 0 0 8px 0;
    font-size: 19px;
    font-weight: 600;
}

.card-content p {
    color: var(--text-gray);
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.info-section {
    margin-top: 30px;
}

.info-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.info-card h3 {
    color: var(--primary-blue);
    margin: 0 0 15px 0;
    font-size: 20px;
}

#userInfo {
    color: var(--dark-gray);
    line-height: 1.8;
}

#userInfo strong {
    color: var(--primary-blue);
}

/* ========== PORTAL SETTINGS STYLES ========== */

#portalSettingsSection {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
}

#portalSettingsSection h3 {
    color: #3b82f6;
}

#portalSettingsSection h3 i {
    margin-right: 8px;
}

.section-description {
    font-size: 13px;
    color: #64748b;
    margin: -10px 0 15px 0;
}

#portalSettingsSection h4 {
    color: #1e293b;
    font-size: 15px;
    margin: 20px 0 10px 0;
}

#portalSettingsSection h4 i {
    margin-right: 8px;
    color: #3b82f6;
}

#linkedPartnerGroup small {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: #94a3b8;
}

/* Client Assignment Controls */
.client-assignment-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.client-assignment-controls select {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
}

.client-assignment-controls button {
    white-space: nowrap;
}

/* Assignments Table */
.assignments-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 10px;
}

.assignments-table th {
    background: #e2e8f0;
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
}

.assignments-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

.assignments-table .empty-row td {
    text-align: center;
    color: #94a3b8;
    font-style: italic;
    padding: 20px;
}

.assignments-table input[type="checkbox"],
.assignments-table input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.assignments-table .btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

/* Portal Badge Colors for User List */
.badge-portal-client {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
}

.badge-portal-consignee {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.badge-portal-shipping {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

/* Small button danger style */
.btn-danger.btn-sm {
    background: #ef4444;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-danger.btn-sm:hover {
    background: #dc2626;
}

/* ===============================
   Menu Access Section Styles
   =============================== */

.menu-access-section h3 {
    color: var(--primary-blue);
    margin-bottom: 15px;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.menu-access-section h3 i {
    font-size: 20px;
}

.menu-access-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.menu-access-controls label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    cursor: pointer;
}

.menu-access-controls input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.menu-access-buttons {
    display: flex;
    gap: 10px;
}

#menuAccessContainer {
    display: none;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
}

.menu-category {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e2e8f0;
}

.menu-category:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-blue);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.category-header input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.menu-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 8px;
    padding-left: 10px;
}

.menu-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}

.menu-item:hover {
    background: #f0f9ff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.menu-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex-shrink: 0;
}

.menu-label {
    font-weight: 500;
    color: #334155;
    flex: 1;
}

.menu-url {
    display: block;
    color: #94a3b8;
    font-size: 11px;
    margin-top: 2px;
}

/* Make the menu access section stand out */
.menu-access-section {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border: 1px solid #bae6fd;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

/* Inline checkbox label */
.inline-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    color: #334155;
}

.inline-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Menu access buttons container */
.menu-access-buttons {
    display: none;
    gap: 10px;
    margin: 15px 0;
}

/* Section description */
.section-description {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 15px;
}
