/**
 * Customer Diagnostic Portal - Styles
 *
 * Comprehensive responsive styling for the customer diagnostic portal.
 * Follows WooCommerce design patterns and supports mobile, tablet, and desktop.
 *
 * @package VocusOrderProcessor
 * @since 2.3.0
 */

/* ==========================================================================
   Base Styles
   ========================================================================== */

.vop-diagnostic-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.vop-diagnostic-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.vop-diagnostic-header h2 {
    margin: 0 0 10px 0;
    font-size: 28px;
    font-weight: 600;
    color: #333;
}

.vop-diagnostic-intro {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* ==========================================================================
   Service Selector
   ========================================================================== */

.vop-service-selector {
    margin-bottom: 25px;
    padding: 15px;
    background: #f7f7f7;
    border-radius: 4px;
}

.vop-service-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.vop-select {
    width: 100%;
    max-width: 400px;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #333;
}

.vop-select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
}

/* ==========================================================================
   Diagnostic Sections
   ========================================================================== */

.vop-diagnostic-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.vop-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.vop-section-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.vop-section-content {
    padding: 10px 0;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.vop-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.vop-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.vop-btn-primary {
    background: #007cba;
    color: #fff;
}

.vop-btn-primary:hover {
    background: #006ba1;
}

.vop-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.vop-btn-secondary:hover {
    background: #e0e0e0;
}

.vop-btn-danger {
    background: #dc3232;
    color: #fff;
}

.vop-btn-danger:hover {
    background: #c62828;
}

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

.vop-btn-loading {
    position: relative;
}

.vop-btn-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 10px;
    width: 14px;
    height: 14px;
    margin-top: -7px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: vop-spin 0.6s linear infinite;
}

@keyframes vop-spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Service Information (AVCID Display)
   ========================================================================== */

.vop-service-info .vop-section-content {
    padding: 0;
}

.vop-services-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.vop-service-card {
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    transition: border-color 0.2s ease;
}

.vop-service-card.vop-service-primary {
    background: #f0f7ff;
    border-color: #007cba;
}

.vop-service-plan {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 16px;
}

.vop-service-plan strong {
    color: #333;
}

.vop-badge-primary {
    background: #007cba;
    color: #fff;
}

.vop-service-detail {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.vop-service-detail label {
    font-size: 13px;
    font-weight: 600;
    color: #666;
}

.vop-avcid-value {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    letter-spacing: 0.5px;
}

.vop-copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    margin-left: auto;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.vop-copy-btn:hover {
    background: #e0e0e0;
    border-color: #ccc;
}

.vop-copy-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: #666;
}

.vop-copy-btn.vop-copied {
    background: #d4edda;
    border-color: #c3e6cb;
}

.vop-copy-btn.vop-copied .dashicons {
    color: #28a745;
}

.vop-service-note {
    margin: 15px 0 0 0;
    padding: 10px 15px;
    background: #f7f7f7;
    border-left: 3px solid #007cba;
    font-size: 13px;
    color: #666;
}

/* ==========================================================================
   Connection Status
   ========================================================================== */

.vop-status-indicator {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    border-radius: 4px;
}

.vop-status-online {
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.vop-status-offline {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
}

.vop-status-icon {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 30px;
}

.vop-status-online .vop-status-icon {
    background: #28a745;
    color: #fff;
}

.vop-status-offline .vop-status-icon {
    background: #dc3545;
    color: #fff;
}

.vop-status-text strong {
    display: block;
    font-size: 18px;
    margin-bottom: 5px;
}

.vop-status-text p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.vop-status-details {
    margin-top: 20px;
    padding: 15px;
    background: #f7f7f7;
    border-radius: 4px;
}

.vop-session-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.vop-session-field label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
}

.vop-session-value {
    display: block;
    font-size: 16px;
    color: #333;
}

/* ==========================================================================
   Usage Statistics
   ========================================================================== */

.vop-usage-controls {
    display: flex;
    gap: 10px;
}

.vop-usage-total {
    padding: 30px;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    color: #fff;
    margin-bottom: 20px;
}

.vop-usage-total h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    opacity: 0.9;
}

.vop-usage-amount {
    margin: 0;
    font-size: 36px;
    font-weight: 700;
}

.vop-usage-chart {
    margin: 20px 0;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.vop-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.vop-table thead {
    background: #f7f7f7;
}

.vop-table th {
    padding: 12px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
}

.vop-table td {
    padding: 12px;
    font-size: 14px;
    color: #666;
    border-bottom: 1px solid #f0f0f0;
}

.vop-table tbody tr:hover {
    background: #f9f9f9;
}

.vop-auth-log-table .vop-auth-failed {
    background: #fff3cd;
}

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

.vop-badge-success {
    background: #d4edda;
    color: #155724;
}

.vop-badge-failed {
    background: #f8d7da;
    color: #721c24;
}

/* ==========================================================================
   Troubleshooting Logs
   ========================================================================== */

.vop-log-section {
    margin-bottom: 30px;
}

.vop-log-section h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.vop-log-description {
    margin: 0 0 15px 0;
    font-size: 13px;
    color: #666;
}

.vop-warning-text {
    margin: 15px 0 0 0;
    padding: 10px 15px;
    background: #fff3cd;
    border-left: 3px solid #ffc107;
    color: #856404;
    font-size: 14px;
}

.vop-warning-text .dashicons {
    vertical-align: middle;
    margin-right: 5px;
}

/* ==========================================================================
   Reset Connection
   ========================================================================== */

.vop-reset-info {
    margin-bottom: 20px;
}

.vop-reset-info p {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: #666;
}

.vop-reset-warning {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    color: #856404;
    font-size: 13px;
}

.vop-reset-warning .dashicons {
    flex-shrink: 0;
    margin-top: 2px;
    color: #ffc107;
}

.vop-reset-actions {
    margin-top: 20px;
}

.vop-reset-status {
    margin-top: 15px;
}

/* ==========================================================================
   Messages
   ========================================================================== */

.vop-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    margin: 15px 0;
    border-radius: 4px;
    font-size: 14px;
}

.vop-message .dashicons {
    flex-shrink: 0;
}

.vop-message-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.vop-message-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.vop-message-info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.vop-no-data {
    padding: 30px;
    text-align: center;
    color: #999;
    font-style: italic;
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.vop-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 30px;
    color: #666;
}

.vop-loading .dashicons.spin {
    animation: vop-spin 1s linear infinite;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.vop-diagnostic-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
    color: #999;
    font-size: 12px;
}

.vop-last-updated {
    margin: 0 0 10px 0;
}

.vop-support-link {
    margin: 0;
}

.vop-support-link a {
    color: #007cba;
    text-decoration: none;
}

.vop-support-link a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Responsive Design - Tablet
   ========================================================================== */

@media (max-width: 782px) {
    .vop-diagnostic-dashboard {
        padding: 15px;
    }

    .vop-diagnostic-header h2 {
        font-size: 24px;
    }

    .vop-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .vop-usage-controls {
        width: 100%;
    }

    .vop-select {
        max-width: 100%;
    }

    .vop-session-info {
        grid-template-columns: 1fr;
    }

    .vop-table {
        font-size: 13px;
    }

    .vop-table th,
    .vop-table td {
        padding: 8px;
    }

    .vop-usage-amount {
        font-size: 28px;
    }
}

/* ==========================================================================
   Responsive Design - Mobile
   ========================================================================== */

@media (max-width: 480px) {
    .vop-diagnostic-dashboard {
        padding: 10px;
    }

    .vop-diagnostic-section {
        padding: 15px;
    }

    .vop-diagnostic-header h2 {
        font-size: 20px;
    }

    .vop-btn {
        font-size: 12px;
        padding: 6px 12px;
    }

    .vop-status-indicator {
        flex-direction: column;
        text-align: center;
    }

    .vop-usage-amount {
        font-size: 24px;
    }

    .vop-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .vop-section-header h3 {
        font-size: 18px;
    }

    /* Service Info Mobile */
    .vop-service-detail {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .vop-service-detail label {
        font-size: 12px;
    }

    .vop-avcid-value {
        font-size: 13px;
        word-break: break-all;
    }

    .vop-copy-btn {
        margin-left: 0;
        align-self: flex-end;
    }

    .vop-service-plan {
        flex-wrap: wrap;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .vop-btn,
    .vop-usage-controls,
    .vop-reset-connection {
        display: none !important;
    }

    .vop-diagnostic-section {
        page-break-inside: avoid;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.vop-btn:focus,
.vop-select:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   High Contrast Mode Support
   ========================================================================== */

@media (prefers-contrast: high) {
    .vop-status-online {
        border: 2px solid;
    }

    .vop-status-offline {
        border: 2px solid;
    }

    .vop-diagnostic-section {
        border: 2px solid;
    }
}
