/* Custom Customer Pricing Admin Styles */
:root {
    --thaxamccp-primary: #2271b1;
    --thaxamccp-primary-hover: #135e96;
    --thaxamccp-error: #dc3232;
    --thaxamccp-success: #46b450;
    --thaxamccp-warning: #ffb900;
    --thaxamccp-border: #dcdcde;
    --thaxamccp-text: #1d2327;
    --thaxamccp-text-light: #50575e;
    --thaxamccp-bg: #ffffff;
    --thaxamccp-bg-light: #f6f7f7;
}

/* Main Layout */
.thaxamwrap {
    max-width: 1200px;
    margin: 20px auto;
    padding: 24px;
    background: var(--thaxamccp-bg);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--thaxamccp-border);
    box-sizing: border-box;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.4;
}

/* Typography fixes for admin pages */
.thaxamwrap h1 {
    font-size: 16px !important;
    margin: 0 0 16px 0 !important;
    font-weight: 600 !important;
}

.thaxamwrap h2,
.thaxamwrap h3,
.thaxamwrap h4,
.thaxamwrap h5,
.thaxamwrap h6 {
    font-size: 16px !important;
    margin: 0 0 12px 0 !important;
    font-weight: 600 !important;
}

.thaxamwrap p,
.thaxamwrap div,
.thaxamwrap span,
.thaxamwrap label {
    font-size: 14px !important;
    line-height: 1.4 !important;
}

/* Content containers */
#thaxamccp-content,
#thaxamccp-product-table {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

#thaxamccp-content > *,
#thaxamccp-product-table > * {
    max-width: 100%;
    box-sizing: border-box;
}

/* Frontend-specific overrides */
#thaxamccp-frontend-app .thaxamwrap {
    margin: 0;
    background: #fff;
    border: 1px solid var(--thaxamccp-border);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Ensure frontend UI elements have proper styling */
#thaxamccp-frontend-app .thaxamccp-table,
#thaxamccp-main-app .thaxamccp-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background-color: var(--thaxamccp-bg);
    border: 1px solid var(--thaxamccp-border);
}

#thaxamccp-frontend-app .button,
#thaxamccp-frontend-app button,
#thaxamccp-main-app .button,
#thaxamccp-main-app button {
    display: inline-block;
    padding: 8px 16px;
    margin: 4px 2px;
    background-color: var(--thaxamccp-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

#thaxamccp-frontend-app .button:hover,
#thaxamccp-frontend-app button:hover,
#thaxamccp-main-app .button:hover,
#thaxamccp-main-app button:hover {
    background-color: var(--thaxamccp-primary-hover);
    color: #fff;
}

.thaxamccp-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 20px;
    margin-bottom: 24px;
}

.thaxamccp-col {
    flex: 1;
    background: var(--thaxamccp-bg);
    border: 1px solid var(--thaxamccp-border);
    border-radius: 8px;
    padding: 20px;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.thaxamccp-col-1 {
    flex: 0 0 30%;
    max-width: 30%;
    min-width: 0;
    background: var(--thaxamccp-bg);
    border: 1px solid var(--thaxamccp-border);
    border-radius: 8px;
    padding: 20px;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.thaxamccp-col-2 {
    flex: 1;
    min-width: 0;
    background: var(--thaxamccp-bg);
    border: 1px solid var(--thaxamccp-border);
    border-radius: 8px;
    padding: 20px;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.thaxamccp-col-3 {
    flex: 0 0 30%;
    max-width: 30%;
    min-width: 0;
    background: var(--thaxamccp-bg);
    border: 1px solid var(--thaxamccp-border);
    border-radius: 8px;
    padding: 20px;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.full-width-row {
    width: 100%;
    margin: 0;
    flex: 1 1 100%;
    background: var(--thaxamccp-bg);
    border: 1px solid var(--thaxamccp-border);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    margin-bottom: 24px;
}

/* Fix for filter row grid layout */
.thaxamccp-row-filter {
    display: grid !important;
    grid-template-columns: auto 2fr auto 1fr !important;
    column-gap: 16px !important;
    align-items: center !important;
    margin-bottom: 20px !important;
    padding: 16px !important;
    background: var(--thaxamccp-bg-light) !important;
    border-radius: 8px !important;
    border: 1px solid var(--thaxamccp-border) !important;
}

/* Ensure pagination and save button row works correctly */
.thaxamccp-row-pagination-save {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 16px !important;
    padding: 16px !important;
    background: var(--thaxamccp-bg-light) !important;
    border-radius: 8px !important;
    border: 1px solid var(--thaxamccp-border) !important;
    margin-top: 16px !important;
}

/* Form Elements */
input[type="text"],
input[type="number"],
input[type="email"],
select,
textarea {
    width: 100%;
    max-width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--thaxamccp-border);
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.4;
    background-color: var(--thaxamccp-bg);
    color: var(--thaxamccp-text);
    box-sizing: border-box;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
    border-color: var(--thaxamccp-primary);
    outline: none;
    box-shadow: 0 0 0 1px var(--thaxamccp-primary);
}

.button,
button {
    display: inline-block;
    padding: 8px 16px;
    margin: 4px 2px;
    background-color: var(--thaxamccp-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.button:hover,
button:hover {
    background-color: var(--thaxamccp-primary-hover);
    color: #fff;
}

.button:disabled,
button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Table Styles */
.thaxamccp-table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background-color: var(--thaxamccp-bg);
    border: 1px solid var(--thaxamccp-border);
    box-sizing: border-box;
    table-layout: fixed;
}

.thaxamccp-table th,
.thaxamccp-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--thaxamccp-border);
}

.thaxamccp-table th {
    background-color: var(--thaxamccp-bg-light);
    font-weight: 600;
    position: relative;
}

.thaxamccp-table tbody tr:hover {
    background-color: #f8f9fa;
}

.thaxamccp-table input[type="number"] {
    width: 100%;
    padding: 6px 8px;
    margin: 0;
}

.thaxamccp-table input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Pagination */
.thaxamccp-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    gap: 5px;
}

.thaxamccp-pagination-btn {
    padding: 8px 12px;
    margin: 0 2px;
    background-color: var(--thaxamccp-bg);
    color: var(--thaxamccp-text);
    border: 1px solid var(--thaxamccp-border);
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
}

.thaxamccp-pagination-btn:hover {
    background-color: var(--thaxamccp-bg-light);
}

.thaxamccp-pagination-btn.active {
    background-color: var(--thaxamccp-primary);
    color: #fff;
    border-color: var(--thaxamccp-primary);
}

.pagination-ellipsis {
    padding: 8px 4px;
    color: var(--thaxamccp-text-light);
}

/* Calculator Styles */
.calc-row {
    margin-bottom: 15px;
}

.calc-row label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.calc-result {
    margin-top: 15px;
    padding: 15px;
    background-color: var(--thaxamccp-bg-light);
    border: 1px solid var(--thaxamccp-border);
    border-radius: 4px;
}

.calc-result-table {
    width: 100%;
    border-collapse: collapse;
}

.calc-result-table td {
    padding: 8px 0;
    border: none;
}

.calc-result-table .text-right {
    text-align: right;
}

.calc-result-table .total-row {
    border-top: 2px solid var(--thaxamccp-border);
    font-weight: 600;
}

/* Error and Success Messages */
.thaxamccp-error-message {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px;
    border-radius: 4px;
    margin: 10px 0;
}

.thaxamccp-success-message {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
    padding: 12px;
    border-radius: 4px;
    margin: 10px 0;
}

/* Loading Spinner */
.thaxamccp-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--thaxamccp-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Settings Page Styles */
.modern-settings {
    background: var(--thaxamccp-bg);
    border: 1px solid var(--thaxamccp-border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--thaxamccp-text);
}

.role-select {
    min-height: 120px;
    padding: 8px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .thaxamwrap {
        margin: 10px;
        padding: 16px;
    }
    
    .thaxamccp-row {
        flex-wrap: wrap !important;
        gap: 16px;
    }
    
    .thaxamccp-col-1,
    .thaxamccp-col-2,
    .thaxamccp-col-3 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 0;
    }
    
    .thaxamccp-row-filter {
        grid-template-columns: 1fr 1fr !important;
        row-gap: 12px !important;
        padding: 12px !important;
    }
}

@media (max-width: 768px) {
    .thaxamwrap {
        margin: 5px;
        padding: 12px;
        border-radius: 8px;
    }
    
    .thaxamccp-row {
        flex-direction: column !important;
        flex-wrap: wrap !important;
        gap: 12px;
    }
    
    .thaxamccp-col,
    .thaxamccp-col-1,
    .thaxamccp-col-2,
    .thaxamccp-col-3 {
        flex: 1 1 100%;
        max-width: 100%;
        min-width: auto;
        padding: 16px;
        margin-bottom: 0;
    }
    
    .full-width-row {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .thaxamccp-table {
        font-size: 12px;
        overflow-x: auto;
        display: block;
        white-space: nowrap;
    }
    
    .thaxamccp-table th,
    .thaxamccp-table td {
        padding: 6px;
        min-width: 80px;
    }
    
    .thaxamccp-row-filter {
        grid-template-columns: 1fr !important;
        row-gap: 8px !important;
        padding: 12px !important;
    }
    
    .thaxamccp-row-pagination-save {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 12px !important;
    }
    
    .thaxamccp-pagination {
        justify-content: center !important;
        margin-bottom: 10px;
    }
}

/* Floating Log Panel */
#thaxamccp-floating-log {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    max-height: 300px;
    background: var(--thaxamccp-bg);
    border: 1px solid var(--thaxamccp-border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 99999;
    overflow: hidden;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    line-height: 1.4;
    display: none; /* Hidden by default */
}

.log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--thaxamccp-bg-light);
    border-bottom: 1px solid var(--thaxamccp-border);
    cursor: move;
    user-select: none;
}

.log-content {
    padding: 8px;
    max-height: 250px;
    overflow-y: auto;
}

.log-entry {
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 4px;
}

.log-entry:hover {
    background: rgba(0,0,0,0.03);
}

.log-time {
    color: var(--thaxamccp-text-light);
    margin-right: 8px;
}

.log-info { color: var(--thaxamccp-primary); }
.log-error { color: var(--thaxamccp-error); }
.log-warning { color: var(--thaxamccp-warning); }
.log-success { color: var(--thaxamccp-success); }

.log-clear-btn,
.log-close-btn {
    padding: 4px 8px;
    font-size: 12px;
    background: transparent;
    color: var(--thaxamccp-text);
    border: 1px solid var(--thaxamccp-border);
    margin-left: 8px;
}

.log-clear-btn:hover,
.log-close-btn:hover {
    background: rgba(0,0,0,0.05);
    transform: none;
}

/* Tooltip styles for price table headers */
.thaxamccp-table th {
    position: relative;
}

.thaxamccp-table th[data-tooltip] {
    cursor: help;
}

.thaxamccp-table th[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 13px;
    font-weight: normal;
    z-index: 1000;
    opacity: 0.95;
    pointer-events: none;
    margin-bottom: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    animation: tooltipFadeIn 0.2s ease-in-out;
}

.thaxamccp-table th[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
    z-index: 999;
    pointer-events: none;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-5px);
    }
    to {
        opacity: 0.95;
        transform: translateX(-50%) translateY(0);
    }
}

/* Search loader styles */
.thaxamccp-search-loader {
    display: inline-block;
    margin-left: 8px;
    vertical-align: middle;
    color: var(--thaxamccp-text-light);
    font-size: 12px;
}

.thaxamccp-search-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--thaxamccp-border);
    border-top: 2px solid var(--thaxamccp-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 5px;
    vertical-align: middle;
}

/* Save button confirmation styles */
.thaxamccp-save-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

.thaxamccp-success-message {
    color: var(--thaxamccp-success);
    font-size: 12px;
    margin-top: 5px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Save button states */
.thaxamccp-save-btn {
    transition: background-color 0.3s ease, color 0.3s ease;
}

.thaxamccp-save-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Enhanced button styles for better visual feedback */
.thaxamccp-save-btn:hover:not(:disabled) {
    background-color: var(--thaxamccp-primary-hover);
    color: #fff;
}

/* Success state styling */
.thaxamccp-save-btn.success {
    background-color: var(--thaxamccp-success) !important;
    color: #fff !important;
}

/* Error state styling */
.thaxamccp-save-btn.error {
    background-color: var(--thaxamccp-error) !important;
    color: #fff !important;
}

/* Main spinner for general loading */
.thaxamccp-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

/* Minimum requirement input field style */
.thaxamccp-table .thaxamccp-minimum-requirement-input {
    width: 80px;
    text-align: center;
}
