/**
 * Hi Express Admin Styles
 */

/* Settings Page Layout */
.hi-express-settings {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    max-width: 1400px;
    padding-top: 20px;
}

.hi-express-header {
    width: 100%;
    background: #fff;
    color: #1d2327;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.hi-express-logo h1 {
    display: inline-flex;
    align-items: center;
    font-size: 32px;
    margin: 0;
    padding: 0;
    color: white;
}

.hi-express-logo .hi {
    font-weight: 800;
}

.hi-express-logo .dash {
    margin: 0 2px;
}

.hi-express-logo .express {
    font-weight: 300;
}

.hi-express-logo .version {
    background: #e6f0f7;
    color: #1C76BC;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    margin-left: 15px;
    vertical-align: middle;
}

.hi-express-header .description {
    margin: 10px 0 0;
    font-size: 16px;
    color: #646970;
}

.hi-express-content {
    flex: 1;
    min-width: 500px;
}

.hi-express-sidebar {
    width: 300px;
}

.hi-express-card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.hi-express-card h2 {
    margin: 0 0 5px;
    font-size: 18px;
    color: #1d2327;
}

.hi-express-card h3 {
    margin: 0 0 15px;
    font-size: 16px;
    color: #1d2327;
}

.hi-express-card .card-description {
    color: #646970;
    margin: 0 0 20px;
}

.hi-express-card .form-table th {
    padding-left: 0;
}

/* Toggle Switch */
.hi-express-toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.hi-express-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.hi-express-toggle .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

.hi-express-toggle .slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.hi-express-toggle input:checked+.slider {
    background-color: #1C76BC;
}

.hi-express-toggle input:checked+.slider:before {
    transform: translateX(24px);
}

/* Save Button */
.hi-express-save-btn {
    background: #1C76BC !important;
    border-color: #155a91 !important;
    padding: 8px 30px !important;
    height: auto !important;
    font-size: 14px !important;
}

.hi-express-save-btn:hover {
    background: #155a91 !important;
}

/* Test Connection */
#connection-status {
    margin-left: 10px;
    display: inline-block;
}

#connection-status.success {
    color: #00a32a;
}

#connection-status.error {
    color: #d63638;
}

/* Sidebar Cards */
.hi-express-help ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hi-express-help li {
    margin-bottom: 12px;
}

.hi-express-help a {
    text-decoration: none;
    color: #1C76BC;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hi-express-help a:hover {
    color: #155a91;
}

/* Rates Table */
.rates-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

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

.rates-table th {
    background: #f9f9f9;
    font-weight: 600;
}

.rates-note {
    font-size: 11px;
    color: #888;
    margin-top: 10px;
    font-style: italic;
}

/* Order Metabox Styles */
.hi-express-metabox {
    padding: 5px 0;
}

.hi-express-status-card,
.hi-express-send-card {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
}

.status-header {
    margin-bottom: 15px;
}

.status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-picked_up {
    background: #d1ecf1;
    color: #0c5460;
}

.status-in_transit {
    background: #cce5ff;
    color: #004085;
}

.status-out_for_delivery {
    background: #d4edda;
    color: #155724;
}

.status-delivered {
    background: #28a745;
    color: white;
}

.status-returned {
    background: #f8d7da;
    color: #721c24;
}

.status-cancelled {
    background: #6c757d;
    color: white;
}

.tracking-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
}

.tracking-info label {
    font-weight: 600;
    color: #555;
}

.tracking-code {
    background: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    border: 1px solid #ddd;
}

.copy-tracking {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
}

.copy-tracking:hover {
    opacity: 0.7;
}

.tracking-timeline {
    background: white;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
    height: auto;
    /* max-height removed for dynamic height */
}

.timeline-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.timeline-item:last-child {
    border-bottom: none;
}

.timeline-dot {
    width: 12px;
    height: 12px;
    background: #1C76BC;
    border-radius: 50%;
    margin-top: 4px;
    flex-shrink: 0;
}

.timeline-content .status-label {
    font-weight: 600;
    color: #333;
}

.timeline-content .status-desc {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

.timeline-content .status-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

.loading-timeline {
    text-align: center;
    color: #888;
    font-style: italic;
}

.metabox-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.metabox-actions .button {
    flex: 1;
    text-align: center;
    justify-content: center;
}

/* Send Card */
.send-description {
    margin: 0 0 15px;
    color: #555;
}

.order-summary {
    background: white;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 15px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-item .label {
    color: #666;
    font-size: 12px;
}

.summary-item .value {
    font-weight: 500;
}

.summary-item.cod {
    background: #fff3cd;
    margin: 8px -12px -12px;
    padding: 10px 12px;
    border-radius: 0 0 6px 6px;
}

.summary-item.cod .value {
    color: #856404;
    font-weight: 700;
}

.hi-express-send-order {
    width: 100%;
    background: #1C76BC !important;
    border-color: #155a91 !important;
    font-size: 14px !important;
}

.hi-express-send-order:hover {
    background: #155a91 !important;
}

.send-note {
    font-size: 11px;
    color: #888;
    text-align: center;
    margin: 12px 0 0;
}

/* Order List Column Badge */
.hi-express-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.hi-express-status-none {
    color: #999;
}

.hi-express-status-pending {
    background: #fff3cd;
    color: #856404;
}

.hi-express-status-picked_up {
    background: #d1ecf1;
    color: #0c5460;
}

.hi-express-status-in_transit {
    background: #cce5ff;
    color: #004085;
}

.hi-express-status-out_for_delivery {
    background: #d4edda;
    color: #155724;
}

.hi-express-status-delivered {
    background: #28a745;
    color: white;
}

.hi-express-status-returned {
    background: #f8d7da;
    color: #721c24;
}

.hi-express-status-cancelled {
    background: #6c757d;
    color: white;
}

/* Responsive */
@media (max-width: 1200px) {
    .hi-express-settings {
        flex-direction: column;
    }

    .hi-express-content,
    .hi-express-sidebar {
        width: 100%;
        min-width: auto;
    }
}

/* Contact & Info Card Styles */
.hi-express-info {
    border-left: 4px solid #1C76BC;
}

.hi-express-promo h3 {
    color: #1C76BC;
    font-size: 18px;
    margin-top: 5px;
    line-height: 1.3;
}

.hi-express-promo p {
    font-size: 14px;
    line-height: 1.5;
    color: #555;
    margin: 10px 0 20px;
}

.hi-express-contact-section h4,
.hi-express-social-section h4 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8c8f94;
    margin: 20px 0 10px;
}

.contact-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.contact-links li {
    margin-bottom: 8px;
}

.contact-links a {
    text-decoration: none;
    color: #1d2327;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    transition: color 0.2s;
}

.contact-links a:hover {
    color: #1C76BC;
}

.contact-links .dashicons {
    color: #1C76BC;
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.social-icons {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
}

.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f0f0f1;
    color: #50575e;
    text-decoration: none;
    transition: all 0.2s ease;
}

.social-icon:hover {
    background: #1C76BC;
    color: white;
    transform: translateY(-2px);
}

.social-icon.facebook:hover {
    background: #1877F2;
}

.social-icon.instagram:hover {
    background: #E4405F;
}

.social-icon.tiktok:hover {
    background: #000000;
}

.social-icon.linkedin:hover {
    background: #0A66C2;
}

.social-icon .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.hi-express-more-info .button {
    width: 100%;
    text-align: center;
    padding: 6px 0 !important;
    font-weight: 500 !important;
}

/* Webhook UI Elements */
.hi-express-form-group {
    margin-bottom: 20px;
}

.hi-express-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1d2327;
}

.hi-express-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.hi-express-input-group input[readonly] {
    background-color: #f0f0f1;
    cursor: default;
    border-color: #dcdcde;
    flex: 1;
}

#hi-express-webhook-status {
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.4;
}

#hi-express-webhook-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#hi-express-webhook-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.hi-express-badge.success {
    background: #28a745;
    color: white;
}

.hi-express-badge.warning {
    background: #ffc107;
    color: #212529;
}

.hi-express-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.hi-express-card-header h3 {
    margin: 0;
}

/* Bulk Action Loader */
.hi-express-bulk-loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.85);
    z-index: 999999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    text-align: center;
}

.hi-express-bulk-loading .hi-express-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #f3f3f3;
    border-top: 6px solid #1C76BC;
    border-radius: 50%;
    animation: hi-express-spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes hi-express-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.hi-express-bulk-loading p {
    font-size: 20px;
    font-weight: 600;
    color: #1C76BC;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.hi-express-bulk-loading .sub-text {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
}

/* Setup Checklist */
.hi-express-setup-checklist {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    border-left: 5px solid #1C76BC;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.hi-express-setup-checklist h2 {
    margin-top: 0;
    color: #1C76BC;
    display: flex;
    align-items: center;
    gap: 10px;
}

.checklist-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.checklist-item {
    display: flex;
    gap: 15px;
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #eee;
    transition: transform 0.2s;
}

.checklist-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.step-number {
    background: #1C76BC;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
}

.step-content h4 {
    margin: 0 0 5px;
    font-size: 14px;
    color: #1d2327;
}

.step-content p {
    margin: 0;
    font-size: 13px;
    color: #646970;
    line-height: 1.4;
}

/* RTL Support */
.rtl .hi-express-setup-checklist {
    border-left: none;
    border-right: 5px solid #1C76BC;
    text-align: right;
}

.rtl .hi-express-setup-checklist h2,
.rtl .checklist-item {
    text-align: right;
}

.rtl .checklist-item {
    flex-direction: row-reverse;
}

.rtl .hi-express-badge {
    margin-left: 0 !important;
    margin-right: 5px !important;
}
/* Disabled Sections */
.hi-express-disabled-section {
    opacity: 0.5;
    pointer-events: none;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.hi-express-disabled-section::before {
    content: "Connect API Key to Enable";
    position: absolute;
    top: 10px;
    right: 15px;
    background: #f0f0f1;
    color: #646970;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    z-index: 10;
    border: 1px solid #dcdcde;
}

.rtl .hi-express-disabled-section::before {
    right: auto;
    left: 15px;
}
