/* SAP GUI Theme for SolutionCrmApp */
/* Based on SAP GUI classic color scheme */

:root {
    /* SAP Core Colors */
    --sap-cream: #FFF8DC;
    --sap-shell-bg: #F5F5DC;
    --sap-header-blue: #6B8E9F;
    --sap-section-blue: #C5D9E8;
    --sap-section-blue-dark: #A8C5D8;
    --sap-selection-yellow: #FFFF99;
    --sap-selection-blue: #B3D4FC;
    --sap-border-gray: #999999;
    --sap-border-light: #CCCCCC;
    --sap-toolbar-gray: #E8E8E8;
    --sap-text-dark: #000000;
    --sap-text-gray: #666666;
    --sap-link-blue: #0066CC;
    --sap-row-hover: #E8F4FC;
    --sap-row-alt: #F8F8F8;
}

/* ============================================
   SAP-Style Popup Selection Component
   ============================================ */

.sap-popup-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.sap-popup-container {
    background: white;
    border: 1px solid var(--sap-border-gray);
    box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.3);
    min-width: 400px;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.sap-popup-header {
    background: linear-gradient(to bottom, #B8D4E8 0%, #9FC5DB 100%);
    border-bottom: 1px solid #8BB5CB;
    color: #1A3A4A;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
}

.sap-popup-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sap-popup-close {
    background: none;
    border: 1px solid transparent;
    color: #1A3A4A;
    font-size: 18px;
    cursor: pointer;
    padding: 0 6px;
    line-height: 1;
}

.sap-popup-close:hover {
    background: rgba(0,0,0,0.1);
    border-color: var(--sap-border-gray);
}

.sap-popup-toolbar {
    background: var(--sap-toolbar-gray);
    border-bottom: 1px solid var(--sap-border-light);
    padding: 4px 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.sap-popup-toolbar-btn {
    background: linear-gradient(to bottom, #FFFFFF 0%, #E8E8E8 100%);
    border: 1px solid var(--sap-border-gray);
    padding: 3px 8px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.sap-popup-toolbar-btn:hover {
    background: linear-gradient(to bottom, #FFFFFF 0%, #D8D8D8 100%);
}

.sap-popup-toolbar-btn:active {
    background: linear-gradient(to bottom, #D8D8D8 0%, #FFFFFF 100%);
}

.sap-popup-toolbar-icon {
    background: linear-gradient(to bottom, #FFFFFF 0%, #E8E8E8 100%);
    border: 1px solid var(--sap-border-gray);
    padding: 3px 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sap-popup-toolbar-icon:hover {
    background: linear-gradient(to bottom, #FFFFFF 0%, #D8D8D8 100%);
}

.sap-popup-toolbar-separator {
    width: 1px;
    height: 20px;
    background: var(--sap-border-gray);
    margin: 0 4px;
}

.sap-popup-search {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
}

.sap-popup-search input {
    flex: 1;
    border: 1px solid var(--sap-border-gray);
    padding: 3px 6px;
    font-size: 12px;
}

.sap-popup-search input:focus {
    outline: none;
    border-color: var(--sap-link-blue);
}

.sap-popup-table-container {
    flex: 1;
    overflow: auto;
    max-height: 400px;
}

.sap-popup-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.sap-popup-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.sap-popup-table th {
    background: linear-gradient(to bottom, #F0F0F0 0%, #D8D8D8 100%);
    border: 1px solid var(--sap-border-gray);
    padding: 4px 8px;
    text-align: left;
    font-weight: 600;
    color: var(--sap-text-dark);
    white-space: nowrap;
}

.sap-popup-table td {
    border: 1px solid var(--sap-border-light);
    padding: 3px 8px;
    color: var(--sap-text-dark);
}

.sap-popup-table tbody tr {
    cursor: pointer;
}

.sap-popup-table tbody tr:nth-child(even) {
    background: var(--sap-row-alt);
}

.sap-popup-table tbody tr:hover {
    background: var(--sap-row-hover);
}

.sap-popup-table tbody tr.selected {
    background: var(--sap-selection-yellow) !important;
}

.sap-popup-table .code-cell {
    font-family: 'Consolas', 'Courier New', monospace;
    font-weight: 500;
    min-width: 60px;
}

.sap-popup-footer {
    background: var(--sap-toolbar-gray);
    border-top: 1px solid var(--sap-border-light);
    padding: 4px 10px;
    font-size: 12px;
    color: var(--sap-text-gray);
}

/* ============================================
   SAP-Style Form Section Headers
   ============================================ */

.sap-section {
    margin-bottom: 16px;
}

.sap-section-header {
    background: var(--sap-section-blue);
    border: 1px solid var(--sap-border-gray);
    border-bottom: none;
    padding: 6px 10px;
    font-weight: 600;
    font-size: 13px;
    color: var(--sap-text-dark);
}

.sap-section-content {
    border: 1px solid var(--sap-border-gray);
    padding: 12px;
    background: white;
}

/* ============================================
   SAP-Style Tabs
   ============================================ */

.sap-tabs-container {
    border-bottom: 1px solid var(--sap-border-gray);
    background: var(--sap-toolbar-gray);
}

.sap-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 4px 4px 0 4px;
}

.sap-tab {
    background: linear-gradient(to bottom, #E8E8E8 0%, #D0D0D0 100%);
    border: 1px solid var(--sap-border-gray);
    border-bottom: none;
    padding: 6px 16px;
    font-size: 12px;
    cursor: pointer;
    position: relative;
    top: 1px;
    color: var(--sap-text-gray);
    transition: all 0.1s ease;
}

.sap-tab:hover {
    background: linear-gradient(to bottom, #F0F0F0 0%, #E0E0E0 100%);
    color: var(--sap-text-dark);
}

.sap-tab.active {
    background: white;
    border-bottom: 1px solid white;
    color: var(--sap-text-dark);
    font-weight: 500;
}

.sap-tab-content {
    background: white;
    border: 1px solid var(--sap-border-gray);
    border-top: none;
    padding: 16px;
}

/* SAP-Style Sub-tabs */
.sap-sub-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 16px;
    background: #F5F5F5;
    border-bottom: 1px solid var(--sap-border-light);
}

.sap-sub-tab {
    background: linear-gradient(to bottom, #FFFFFF 0%, #F0F0F0 100%);
    border: 1px solid var(--sap-border-light);
    border-radius: 3px;
    padding: 5px 14px;
    font-size: 11px;
    cursor: pointer;
    color: var(--sap-text-gray);
    transition: all 0.15s ease;
}

.sap-sub-tab:hover {
    background: linear-gradient(to bottom, #FFFFFF 0%, #E8E8E8 100%);
    color: var(--sap-text-dark);
    border-color: var(--sap-border-gray);
}

.sap-sub-tab.active {
    background: linear-gradient(to bottom, #E3F0FC 0%, #C5D9E8 100%);
    border-color: #6B8E9F;
    color: var(--sap-text-dark);
    font-weight: 500;
}

/* ============================================
   SAP-Style Form Fields
   ============================================ */

.sap-form-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
}

.sap-form-label {
    min-width: 140px;
    font-size: 12px;
    color: var(--sap-text-dark);
    text-align: right;
    padding-right: 8px;
}

.sap-form-label.required::after {
    content: ' *';
    color: #CC0000;
}

.sap-form-input {
    border: 1px solid var(--sap-border-gray);
    padding: 4px 6px;
    font-size: 12px;
    background: white;
}

.sap-form-input:focus {
    outline: none;
    border-color: var(--sap-link-blue);
    background: #FFFEF0;
}

.sap-form-input:disabled,
.sap-form-input:read-only {
    background: #F0F0F0;
    color: var(--sap-text-gray);
}

.sap-form-input.w-sm { width: 60px; }
.sap-form-input.w-md { width: 120px; }
.sap-form-input.w-lg { width: 200px; }
.sap-form-input.w-xl { width: 300px; }
.sap-form-input.w-full { width: 100%; }

/* SAP-style select trigger (for popup) */
.sap-select-trigger {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--sap-border-gray);
    background: white;
    cursor: pointer;
}

.sap-select-trigger:hover {
    border-color: var(--sap-link-blue);
}

.sap-select-trigger input {
    border: none;
    padding: 4px 6px;
    font-size: 12px;
    background: transparent;
    cursor: pointer;
}

.sap-select-trigger input:focus {
    outline: none;
}

.sap-select-trigger-btn {
    background: linear-gradient(to bottom, #F0F0F0 0%, #D8D8D8 100%);
    border-left: 1px solid var(--sap-border-gray);
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sap-select-trigger-btn svg {
    width: 12px;
    height: 12px;
}

/* ============================================
   SAP-Style Buttons
   ============================================ */

.sap-btn {
    background: linear-gradient(to bottom, #FFFFFF 0%, #E8E8E8 100%);
    border: 1px solid var(--sap-border-gray);
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sap-btn:hover {
    background: linear-gradient(to bottom, #FFFFFF 0%, #D8D8D8 100%);
}

.sap-btn:active {
    background: linear-gradient(to bottom, #D8D8D8 0%, #FFFFFF 100%);
}

.sap-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sap-btn-primary {
    background: linear-gradient(to bottom, #5B9BD5 0%, #4A8AC4 100%);
    color: white;
    border-color: #3A7AB4;
}

.sap-btn-primary:hover {
    background: linear-gradient(to bottom, #6BABE5 0%, #5A9AD4 100%);
}

/* ============================================
   SAP-Style Checkbox
   ============================================ */

.sap-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
}

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

/* ============================================
   SAP-Style Data Grid/Table
   ============================================ */

.sap-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.sap-grid th {
    background: linear-gradient(to bottom, #F0F0F0 0%, #D8D8D8 100%);
    border: 1px solid var(--sap-border-gray);
    padding: 6px 10px;
    text-align: left;
    font-weight: 600;
}

.sap-grid td {
    border: 1px solid var(--sap-border-light);
    padding: 5px 10px;
}

.sap-grid tbody tr:hover {
    background: var(--sap-row-hover);
}

.sap-grid tbody tr.selected {
    background: var(--sap-selection-blue);
}

/* ============================================
   Status Badges
   ============================================ */

.sap-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 2px;
}

.sap-badge-active {
    background: #DFF0D8;
    color: #3C763D;
    border: 1px solid #D6E9C6;
}

.sap-badge-inactive {
    background: #F2DEDE;
    color: #A94442;
    border: 1px solid #EBCCD1;
}

.sap-badge-info {
    background: #D9EDF7;
    color: #31708F;
    border: 1px solid #BCE8F1;
}

/* ============================================
   SAP-Style Form Container & Header
   ============================================ */

.sap-form-container {
    background: white;
    border: 1px solid var(--sap-border-gray);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sap-form-header {
    background: linear-gradient(to bottom, #5A7C90 0%, #4A6C80 100%);
    padding: 12px 16px;
    border-bottom: 2px solid #3A5C70;
}

.sap-form-footer {
    background: var(--sap-toolbar-gray);
    border-top: 1px solid var(--sap-border-gray);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ============================================
   SAP-Style Fieldset (Section Groups)
   ============================================ */

.sap-fieldset {
    margin-bottom: 16px;
    border: 1px solid var(--sap-border-gray);
    background: white;
}

.sap-fieldset .sap-section-header {
    background: linear-gradient(to bottom, #B8D4E8 0%, #9FC5DB 100%);
    border: none;
    border-bottom: 1px solid #8BB5CB;
    padding: 8px 12px;
    font-weight: 600;
    font-size: 13px;
    color: #1A3A4A;
}

.sap-fieldset-content {
    padding: 16px;
    background: #FAFBFC;
}

/* ============================================
   SAP-Style Form Fields (Input, Select, etc.)
   ============================================ */

.sap-form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sap-label {
    font-size: 12px;
    font-weight: 500;
    color: #333333;
    margin-bottom: 2px;
}

/* Main input styling - VISIBLE borders */
.sap-input {
    border: 1px solid #666666 !important;
    padding: 6px 8px !important;
    font-size: 13px !important;
    background: #FFFFFF !important;
    color: #000000 !important;
    border-radius: 2px;
    min-height: 32px;
    box-sizing: border-box;
}

.sap-input:focus {
    outline: none !important;
    border-color: #0066CC !important;
    background: #FFFEF0 !important;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2);
}

.sap-input:hover:not(:focus):not(:disabled) {
    border-color: #0066CC !important;
}

.sap-input:disabled,
.sap-input[readonly] {
    background: #E8E8E8 !important;
    color: #666666 !important;
    cursor: not-allowed;
}

.sap-input::placeholder {
    color: #999999;
}

/* Select styling - make dropdowns visible */
select.sap-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M2 4l4 4 4-4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px !important;
    cursor: pointer;
}

/* ============================================
   SAP-Style Button Variants
   ============================================ */

.sap-btn-primary {
    background: linear-gradient(to bottom, #4A90C2 0%, #3A80B2 100%) !important;
    color: white !important;
    border: 1px solid #2A70A2 !important;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 2px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sap-btn-primary:hover {
    background: linear-gradient(to bottom, #5AA0D2 0%, #4A90C2 100%) !important;
}

.sap-btn-primary:active {
    background: linear-gradient(to bottom, #3A80B2 0%, #4A90C2 100%) !important;
}

.sap-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.sap-btn-secondary {
    background: linear-gradient(to bottom, #FFFFFF 0%, #E8E8E8 100%);
    color: #333333;
    border: 1px solid #888888;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 2px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sap-btn-secondary:hover {
    background: linear-gradient(to bottom, #FFFFFF 0%, #D8D8D8 100%);
    border-color: #666666;
}

.sap-btn-secondary:active {
    background: linear-gradient(to bottom, #D8D8D8 0%, #FFFFFF 100%);
}

.sap-btn-warning {
    background: linear-gradient(to bottom, #E8A030 0%, #D89020 100%);
    color: white;
    border: 1px solid #C88010;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 2px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sap-btn-warning:hover {
    background: linear-gradient(to bottom, #F8B040 0%, #E8A030 100%);
}

.sap-btn-success {
    background: linear-gradient(to bottom, #4CAF50 0%, #3D9140 100%);
    color: white;
    border: 1px solid #2D8130;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 2px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sap-btn-success:hover {
    background: linear-gradient(to bottom, #5CBF60 0%, #4CAF50 100%);
}

.sap-btn-danger {
    background: linear-gradient(to bottom, #E53935 0%, #C62828 100%);
    color: white;
    border: 1px solid #B71C1C;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 2px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sap-btn-danger:hover {
    background: linear-gradient(to bottom, #EF5350 0%, #E53935 100%);
}

/* SAP Tree Action Buttons */
.sap-tree-action {
    padding: 4px;
    border-radius: 3px;
    transition: all 0.15s ease;
}

.sap-tree-action-add {
    color: #2E7D32;
}

.sap-tree-action-add:hover {
    background: #E8F5E9;
}

.sap-tree-action-edit {
    color: #1565C0;
}

.sap-tree-action-edit:hover {
    background: #E3F2FD;
}

.sap-tree-action-move {
    color: #F57C00;
}

.sap-tree-action-move:hover {
    background: #FFF3E0;
}

.sap-tree-action-delete {
    color: #C62828;
}

.sap-tree-action-delete:hover {
    background: #FFEBEE;
}

.sap-tree-action-deactivate {
    color: #F57C00;
}

.sap-tree-action-deactivate:hover {
    background: #FFF3E0;
}

.sap-tree-action-activate {
    color: #2E7D32;
}

.sap-tree-action-activate:hover {
    background: #E8F5E9;
}

/* Config Table Action Buttons */
.sap-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sap-action-btn-edit {
    background: #FFFFFF;
    color: #333333;
    border: 1px solid #CCCCCC;
}

.sap-action-btn-edit:hover {
    background: #F5F5F5;
    border-color: #999999;
}

.sap-action-btn-deactivate {
    background: #FFFFFF;
    color: #E65100;
    border: 1px solid #E65100;
}

.sap-action-btn-deactivate:hover {
    background: #FFF3E0;
}

.sap-action-btn-activate {
    background: #FFFFFF;
    color: #2E7D32;
    border: 1px solid #2E7D32;
}

.sap-action-btn-activate:hover {
    background: #E8F5E9;
}

.sap-action-btn-delete {
    background: #FFFFFF;
    color: #C62828;
    border: 1px solid #C62828;
}

.sap-action-btn-delete:hover {
    background: #FFEBEE;
}

/* SAP Config Card Styles */
.sap-config-card {
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    border: 1px solid #E0E0E0;
    padding: 16px;
    transition: all 0.2s ease;
}

.sap-config-card:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.16);
    border-color: #4A90C2;
}

.sap-config-card-title {
    font-weight: 500;
    color: #333333;
}

.sap-config-card:hover .sap-config-card-title {
    color: #4A90C2;
}

.sap-config-card-desc {
    font-size: 13px;
    color: #666666;
    margin-top: 4px;
}

.sap-config-card-icon {
    color: #999999;
}

.sap-config-card:hover .sap-config-card-icon {
    color: #4A90C2;
}

/* ============================================
   SAP-Style Select Popup Trigger Button
   ============================================ */

.sap-select-field {
    display: flex;
    align-items: stretch;
    border: 1px solid #666666;
    border-radius: 2px;
    background: white;
    min-height: 32px;
    cursor: pointer;
}

.sap-select-field:hover {
    border-color: #0066CC;
}

.sap-select-field-value {
    flex: 1;
    padding: 6px 8px;
    font-size: 13px;
    color: #000000;
    background: transparent;
    border: none;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sap-select-field-value.placeholder {
    color: #999999;
}

.sap-select-field-btn {
    background: linear-gradient(to bottom, #F0F0F0 0%, #D8D8D8 100%);
    border-left: 1px solid #666666;
    padding: 0 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sap-select-field-btn svg {
    width: 12px;
    height: 12px;
    color: #333333;
}

.sap-select-field:hover .sap-select-field-btn {
    background: linear-gradient(to bottom, #FFFFFF 0%, #E8E8E8 100%);
}

/* ============================================
   SAP-Style Tab Bar
   ============================================ */
.sap-tab-bar {
    display: flex;
    background: linear-gradient(to bottom, #F8F8F8 0%, #E8E8E8 100%);
    border-bottom: 1px solid #999999;
    padding: 0;
    gap: 2px;
}

.sap-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #333333;
    background: linear-gradient(to bottom, #FFFFFF 0%, #E8E8E8 100%);
    border: 1px solid #999999;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: -1px;
}

.sap-tab:hover {
    background: linear-gradient(to bottom, #FFFFFF 0%, #F0F0F0 100%);
    color: #0066CC;
}

.sap-tab.active {
    background: #FFFFFF;
    color: #0066CC;
    border-bottom: 1px solid #FFFFFF;
    font-weight: 600;
}

.sap-tab svg {
    width: 16px;
    height: 16px;
}

.sap-tab.active svg {
    color: #0066CC;
}
