/**
 * QETL Dashboard Styles
 * Modern, responsive styling for the WordPress client dashboard
 */

/* Base Styles */
.qetl-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
}

.dashboard-section {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    padding: 25px;
}

.dashboard-section h2 {
    margin: 0 0 20px 0;
    color: #1a1a1a;
    font-size: 24px;
    font-weight: 600;
}

/* Account Overview Grid */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.overview-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.overview-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    z-index: 1;
}

.overview-card > * {
    position: relative;
    z-index: 2;
}

.overview-card h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 500;
    opacity: 0.9;
}

.credit-display {
    margin-bottom: 20px;
}

.credit-display .credits {
    font-size: 48px;
    font-weight: 700;
    line-height: 1;
}

.credit-display .unit {
    font-size: 16px;
    opacity: 0.8;
    margin-left: 5px;
}

.instance-status {
    font-size: 20px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 25px;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.instance-status.none {
    background: rgba(108, 117, 125, 0.2);
    color: #6c757d;
}

.instance-status.provisioning {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    animation: pulse 2s infinite;
}

.instance-status.running,
.instance-status.ready {
    background: rgba(40, 167, 69, 0.2);
    color: #28a745;
}

.instance-status.failed {
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.api-key-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.api-key {
    background: rgba(0,0,0,0.2);
    padding: 8px 12px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

/* Buttons */
.btn-purchase-credits,
.btn-provision-instance,
.btn-access-instance,
.btn-copy-key,
.btn-primary,
.btn-secondary,
.btn-terminate-instance {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    text-align: center;
}

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

.btn-primary:hover {
    background: #005a87;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-copy-key {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 6px 12px;
    font-size: 12px;
}

.btn-copy-key:hover {
    background: rgba(255,255,255,0.3);
}

/* Instance Management */
.no-instance,
.provisioning-status,
.active-instance {
    text-align: center;
    padding: 40px 20px;
}

.provisioning-status .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.provisioning-steps {
    text-align: left;
    max-width: 400px;
    margin: 30px auto;
}

.provisioning-steps .step {
    padding: 10px 0;
    position: relative;
    padding-left: 30px;
    opacity: 0.5;
}

.provisioning-steps .step.completed {
    opacity: 1;
    color: #28a745;
}

.provisioning-steps .step.completed::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #28a745;
    font-weight: bold;
}

.provisioning-steps .step.active {
    opacity: 1;
    color: #007cba;
    font-weight: 600;
}

.provisioning-steps .step.active::before {
    content: '⟳';
    position: absolute;
    left: 0;
    color: #007cba;
    animation: spin 2s linear infinite;
}

.instance-details {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    text-align: left;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row label {
    font-weight: 600;
    color: #495057;
}

.instance-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

/* Jobs List */
.no-jobs {
    text-align: center;
    padding: 40px 20px;
}

.sdk-example {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    text-align: left;
}

.sdk-example h4 {
    margin: 0 0 10px 0;
    color: #495057;
}

.sdk-example pre {
    background: #2d3748;
    color: #e2e8f0;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 14px;
    line-height: 1.5;
}

.jobs-table {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e9ecef;
}

.table-header,
.table-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr 1fr;
    gap: 15px;
    padding: 15px;
    align-items: center;
}

.table-header {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    border-bottom: 1px solid #e9ecef;
}

.table-row {
    border-bottom: 1px solid #f1f3f4;
}

.table-row:last-child {
    border-bottom: none;
}

.table-row:hover {
    background: #f8f9fa;
}

.job-status.running {
    color: #007cba;
}

.job-status.completed {
    color: #28a745;
}

.job-status.failed {
    color: #dc3545;
}

.job-id {
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

/* Getting Started */
.quick-start-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.quick-start-card {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    border-left: 4px solid #007cba;
}

.quick-start-card h3 {
    margin: 0 0 15px 0;
    color: #1a1a1a;
    font-size: 18px;
}

.quick-start-card code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
}

.quick-start-card pre {
    background: #2d3748;
    color: #e2e8f0;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.4;
    margin: 10px 0 0 0;
}

/* Modals */
.qetl-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-content h3 {
    margin: 0 0 25px 0;
    font-size: 24px;
    color: #1a1a1a;
    text-align: center;
}

/* Credit Packages */
.credit-packages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.credit-packages .package {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.credit-packages .package:hover {
    border-color: #007cba;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.credit-packages .package.selected {
    border-color: #007cba;
    background: #f0f8ff;
}

.credit-packages .package.popular {
    border-color: #28a745;
    background: #f8fff9;
}

.credit-packages .package.popular .badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #28a745;
    color: white;
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 12px;
    font-weight: 600;
}

.credit-packages .package h4 {
    margin: 0 0 10px 0;
    color: #1a1a1a;
}

.credit-packages .package .credits {
    font-size: 24px;
    font-weight: 700;
    color: #007cba;
    margin: 10px 0;
}

.credit-packages .package .price {
    font-size: 20px;
    font-weight: 600;
    color: #28a745;
    margin: 10px 0;
}

.credit-packages .package .per-minute {
    font-size: 12px;
    color: #6c757d;
}

/* Instance Tiers */
.instance-tiers {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.instance-tiers .tier {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.instance-tiers .tier:hover {
    border-color: #007cba;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.instance-tiers .tier.selected {
    border-color: #007cba;
    background: #f0f8ff;
}

.instance-tiers .tier.recommended {
    border-color: #28a745;
    background: #f8fff9;
}

.instance-tiers .tier.recommended .badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #28a745;
    color: white;
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 12px;
    font-weight: 600;
}

.instance-tiers .tier h4 {
    margin: 0 0 10px 0;
    color: #1a1a1a;
    font-size: 18px;
}

.instance-tiers .tier .specs {
    color: #495057;
    margin: 8px 0;
    font-size: 14px;
}

.instance-tiers .tier .cost {
    color: #007cba;
    font-weight: 600;
    margin: 8px 0;
}

.instance-tiers .tier .components {
    color: #6c757d;
    font-size: 12px;
    margin: 8px 0;
}

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Notifications */
.qetl-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    z-index: 1001;
    max-width: 400px;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.qetl-notification.success {
    background: #28a745;
}

.qetl-notification.error {
    background: #dc3545;
}

.qetl-notification.info {
    background: #17a2b8;
}

.qetl-notification .close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    font-weight: bold;
    float: right;
    cursor: pointer;
    margin-left: 15px;
}

/* Registration Form */
.qetl-registration {
    max-width: 500px;
    margin: 0 auto;
    padding: 30px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.qetl-registration h2 {
    text-align: center;
    margin: 0 0 30px 0;
    color: #1a1a1a;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #495057;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0,124,186,0.2);
}

#qetl-registration-form button[type="submit"] {
    width: 100%;
    padding: 15px;
    background: #007cba;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

#qetl-registration-form button[type="submit"]:hover {
    background: #005a87;
}

/* Responsive Design */
@media (max-width: 768px) {
    .qetl-dashboard {
        padding: 15px;
    }
    
    .overview-grid {
        grid-template-columns: 1fr;
    }
    
    .credit-packages,
    .instance-tiers {
        grid-template-columns: 1fr;
    }
    
    .quick-start-grid {
        grid-template-columns: 1fr;
    }
    
    .table-header,
    .table-row {
        grid-template-columns: 1fr;
        gap: 5px;
    }
    
    .table-header {
        display: none;
    }
    
    .table-row {
        border: 1px solid #e9ecef;
        border-radius: 6px;
        margin-bottom: 10px;
    }
    
    .instance-actions {
        flex-direction: column;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
}
