/**
 * CrewCommerce Admin Styles
 */

/* Dashboard Stats */

.crewcommerce-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.crewcommerce-stat-card {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.crewcommerce-stat-card h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #666;
    text-transform: uppercase;
    font-weight: 600;
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    color: #0073aa;
    line-height: 1;
}

.stat-number.pending { color: #f57c00; }

.stat-number.approved { color: #388e3c; }

.stat-number.rejected { color: #d32f2f; }

/* Dashboard Sections */

.crewcommerce-dashboard-sections {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

.crewcommerce-section {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.crewcommerce-section h2 {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    color: #23282d;
}

/* Quick Actions */

.crewcommerce-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.crewcommerce-quick-actions .button {
    text-align: center;
    padding: 10px 15px;
}

/* Activity List */

.crewcommerce-activity-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.crewcommerce-activity-list li {
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    line-height: 1.4;
}

.crewcommerce-activity-list li:last-child {
    border-bottom: none;
}

.crewcommerce-activity-list .time-ago {
    color: #666;
    font-size: 12px;
}

/* Status Indicators */

.crewcommerce-status {
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    display: inline-block;
}

.crewcommerce-status-pending { 
    background: #ffecb3; 
    color: #f57c00; 
}

.crewcommerce-status-approved { 
    background: #c8e6c9; 
    color: #388e3c; 
}

.crewcommerce-status-rejected {
    background: #ffcdd2;
    color: #d32f2f;
}

.crewcommerce-status-unassigned {
    background: #fcf1cd;
    color: #8a6d00;
}

/* Modal Styles */

.crewcommerce-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 100000;
    display: none;
}

.crewcommerce-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 24px;
    border-radius: 4px;
    min-width: 480px;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* Modal form validation */

.crewcommerce-modal .required { color: #d63638; }

.crewcommerce-modal .error-message { color: #d63638; font-size: 12px; margin-top: 4px; }

.crewcommerce-modal .form-table input.error,
.crewcommerce-modal .form-table select.error { border-color: #d63638; }

/* Row actions, shown on hover */

.wp-list-table .row-actions { visibility: hidden; }

.wp-list-table tr:hover .row-actions { visibility: visible; }

/* Prevent WP core from adding a red background to trash/delete row-action links */

.wp-list-table .row-actions span.trash a:hover,
.wp-list-table .row-actions span.delete a:hover { background: none !important; }

.crewcommerce-modal-content h2 {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* Filter Forms */

/* Order Results */

#order-results {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    min-height: 200px;
}

/* Team Member Management */

.member-role-select {
    min-width: 120px;
}

.remove-member {
    color: #d32f2f;
    border-color: #d32f2f;
}

.remove-member:hover {
    background-color: #d32f2f;
    color: #fff;
}

/* Company Management */

.crewcommerce-company-card {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

.crewcommerce-company-card h3 {
    margin-top: 0;
    color: #0073aa;
}

.crewcommerce-company-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.crewcommerce-company-meta-item {
    display: flex;
    flex-direction: column;
}

.crewcommerce-company-meta-label {
    font-weight: bold;
    color: #666;
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 5px;
}

/* Approval Workflow Table */

.crewcommerce-workflow-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.crewcommerce-workflow-table th,
.crewcommerce-workflow-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.crewcommerce-workflow-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.crewcommerce-workflow-table tr:hover {
    background-color: #f8f9fa;
}

/* Loading States */

.crewcommerce-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.crewcommerce-loading::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: crewcommerce-spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes crewcommerce-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notifications */

.crewcommerce-notice {
    padding: 12px 15px;
    margin: 20px 0;
    border-radius: 4px;
    border-left: 4px solid;
}

.crewcommerce-notice.success {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.crewcommerce-notice.error {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.crewcommerce-notice.warning {
    background-color: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.crewcommerce-notice.info {
    background-color: #cce5ff;
    border-color: #007bff;
    color: #004085;
}

/* Responsive Design */

@media (max-width: 1200px) {
  .crewcommerce-dashboard-sections {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
  .crewcommerce-stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
  .crewcommerce-stat-card {
        padding: 15px;
    }
  .stat-number {
        font-size: 24px;
    }
  .crewcommerce-modal-content {
        min-width: 90%;
        margin: 20px;
    }
}

/* WordPress Admin Integration */

.crewcommerce-admin-page .wrap {
    margin-right: 20px;
}

.crewcommerce-admin-page .page-title-action {
    margin-left: 10px;
}

/* Custom Order Columns */

.wp-list-table .column-company,
.wp-list-table .column-requester,
.wp-list-table .column-approval_status {
    width: 12%;
}

/* Settings Page */

.crewcommerce-settings-section {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

.crewcommerce-settings-section h3 {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* Help Text */

.crewcommerce-help {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    margin: 20px 0;
}

.crewcommerce-help h4 {
    margin-top: 0;
    color: #495057;
}

.crewcommerce-help p {
    margin-bottom: 0;
    color: #6c757d;
}

/* Dashboard Onboarding Wizard */

.crewcommerce-onboarding-wizard {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 8px;
    padding: 40px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.onboarding-icon { font-size: 48px; margin-bottom: 10px; }

.crewcommerce-onboarding-wizard h2 { font-size: 24px; margin: 0 0 10px; }

.crewcommerce-onboarding-wizard > p { color: #666; margin-bottom: 30px; }

.onboarding-steps {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.onboarding-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    text-align: left;
    max-width: 220px;
}

.step-number {
    background: #0073aa;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
    font-size: 14px;
}

.step-content strong { display: block; margin-bottom: 4px; }

.step-content p { margin: 0; color: #666; font-size: 13px; }

.onboarding-actions { display: flex; gap: 12px; justify-content: center; }

/* Dashboard "Needs your attention" banner */

.crewcommerce-attention {
    background: #fff8e5;
    border: 1px solid #f0c34d;
    border-left: 4px solid #dba617;
    border-radius: 4px;
    padding: 16px 20px;
    margin-bottom: 24px;
}

.crewcommerce-attention h2 { margin: 0 0 10px; font-size: 15px; color: #7a5c00; }

.crewcommerce-attention ul { margin: 0; padding: 0; list-style: none; }

.crewcommerce-attention li { margin-bottom: 10px; color: #4a3c00; }

.crewcommerce-attention li:last-child { margin-bottom: 0; }

.crewcommerce-attention-list { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 12px; }

.crewcommerce-attention-list a { font-weight: 600; }

/* Per-company approval threshold card */

/* Approvals page bulk-action bar */

.crewcommerce-waiting-badge { font-size: 12px; color: #666; background: #f0f0f1; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }

.crewcommerce-waiting-stale { color: #8a2d0a; background: #fbe4d5; font-weight: 600; }

tr.crewcommerce-row-stale { box-shadow: inset 3px 0 0 #d63638; }

/* Activity log filters and action badges */

/* Shared helpers for the CrewCommerce admin screens. */
.crewcommerce-table-spaced { margin-top: 16px; }
.crewcommerce-muted { color: #8c8f94; }
.crewcommerce-warning { color: #d63638; }
.crewcommerce-currency { font-size: 16px; vertical-align: middle; margin-right: 4px; }
.crewcommerce-amount { width: 120px; }
.crewcommerce-back { margin: 0 0 4px; }
.crewcommerce-admin-tag { font-size: 10px; background: #d1e7dd; color: #0a5c36; padding: 1px 6px; border-radius: 10px; margin-left: 4px; vertical-align: middle; }
.wp-list-table .column-narrow { width: 80px; }
.wp-list-table .column-date { width: 110px; }
.wp-list-table .column-role { width: 150px; }
.wp-list-table .column-extra { width: 170px; }
.role-status { font-size: 11px; margin-left: 4px; }
.role-status.is-ok { color: #388e3c; }
.role-status.is-error { color: #d63638; }
.error-message { color: #d63638; margin-top: 4px; }
.crewcommerce-pro-hint { margin-top: 24px; padding: 12px 16px; background: #f6f4fb; border-left: 4px solid #574398; max-width: 760px; }
.crewcommerce-onboarding-wizard .onboarding-steps { margin: 16px 0 16px 20px; }
.crewcommerce-onboarding-wizard .onboarding-steps li { margin-bottom: 8px; }
.crewcommerce-pro-page .crewcommerce-lead { font-size: 15px; max-width: 760px; }
.crewcommerce-pro-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin: 20px 0 24px; max-width: 1100px; }
.crewcommerce-pro-card { background: #fff; border: 1px solid #dcdcde; border-radius: 6px; padding: 16px 20px; }
.crewcommerce-pro-card h2 { margin: 0 0 8px; font-size: 16px; }
.crewcommerce-pro-card p { margin: 0; color: #50575e; }

/* CrewCommerce box on the WooCommerce order screen. */
.crewcommerce-order-info .crewcommerce-status { display: inline-block; margin-top: 2px; }
.crewcommerce-status-cancelled { background: #f0f0f1; color: #50575e; }
