/**
 * AGM Frontend Styles
 * Styles for service execution forms and components
 */

/* Upload Progress Bar Styles */
.agm-upload-progress-container {
    margin-top: 15px;
    margin-bottom: 10px;
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    display: none; /* Hidden by default */
}

.agm-progress-bar-wrapper {
    position: relative;
    background: #e9ecef;
    border-radius: 4px;
    height: 20px;
    overflow: hidden;
    margin-bottom: 8px;
}

.agm-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #007cba 0%, #00a0d2 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    position: relative;
    width: 0%;
}

.agm-progress-bar.error {
    background: linear-gradient(90deg, #dc3545 0%, #c82333 100%);
}

.agm-progress-bar.success {
    background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
}

.agm-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    z-index: 10;
}

.agm-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #6c757d;
}

.agm-progress-status {
    font-weight: 500;
}

.agm-progress-details {
    font-size: 12px;
}

.agm-progress-error {
    color: #dc3545;
    font-weight: 500;
    margin-top: 5px;
    padding: 8px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
}

.agm-progress-retry-btn {
    background: #007cba;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    margin-left: 10px;
}

.agm-progress-retry-btn:hover {
    background: #005a87;
}

/* Processing status for async services */
.agm-processing-status {
    display: flex;
    align-items: center;
    color: #6c757d;
    font-style: italic;
}

.agm-processing-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e9ecef;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: agm-spin 1s linear infinite;
    margin-right: 8px;
}

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

/* Service Form Container */
.agm-service-form-container {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* User Balance */
.agm-user-balance {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 10px 15px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.agm-balance-label {
    font-weight: 600;
    color: #495057;
}

.agm-balance-amount {
    font-weight: 700;
    color: #28a745;
    font-size: 1.1em;
}

/* Service Info */
.agm-service-info {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.agm-service-info h3 {
    margin: 0 0 10px 0;
    color: #212529;
    font-size: 1.4em;
}

.agm-service-description {
    color: #6c757d;
    margin: 0 0 10px 0;
    line-height: 1.5;
}

.agm-service-cost {
    display: inline-flex;
    align-items: center;
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 0.9em;
}

.agm-cost-label {
    color: #1976d2;
    margin-right: 5px;
}

.agm-cost-amount {
    font-weight: 600;
    color: #0d47a1;
}

/* Service Parameters */
.agm-service-parameters {
    margin-bottom: 20px;
}

.agm-parameter-field {
    margin-bottom: 15px;
}

.agm-parameter-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #495057;
}

.agm-required {
    color: #dc3545;
    margin-left: 3px;
}

.agm-parameter-field input,
.agm-parameter-field textarea,
.agm-parameter-field select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.agm-parameter-field input:focus,
.agm-parameter-field textarea:focus,
.agm-parameter-field select:focus {
    outline: 0;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.agm-parameter-field textarea {
    min-height: 80px;
    resize: vertical;
}

.agm-parameter-field input.agm-error,
.agm-parameter-field textarea.agm-error,
.agm-parameter-field select.agm-error {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Form Actions */
.agm-form-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.agm-submit-btn {
    background: #007cba;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.agm-submit-btn:hover:not(:disabled) {
    background: #005a87;
}

.agm-submit-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.agm-loading {
    display: inline-flex;
    align-items: center;
    color: #6c757d;
    font-size: 14px;
}

.agm-loading:before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #6c757d;
    border-radius: 50%;
    border-top-color: transparent;
    animation: agm-spin 1s linear infinite;
    margin-right: 8px;
}

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

/* Results */
.agm-result {
    margin-top: 20px;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid;
}

.agm-result.agm-success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.agm-result.agm-error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.agm-result-header {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.agm-result-header h4 {
    margin: 0 0 10px 0;
    font-size: 1.2em;
}

.agm-result-header p {
    margin: 5px 0;
    font-size: 0.9em;
}

.agm-result-body h5 {
    margin: 0 0 10px 0;
    font-size: 1em;
    font-weight: 600;
}

.agm-result-body pre {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 10px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.4;
    margin: 0;
}

.agm-json-response {
    color: #495057;
}

.agm-text-response {
    color: #212529;
}

.agm-html-response {
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 10px;
    background: #fff;
}

.agm-message {
    padding: 10px 15px;
    border-radius: 4px;
    margin: 0;
}

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

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

/* Responsive Design */
@media (max-width: 768px) {
    .agm-service-form-container {
        padding: 15px;
        margin: 15px 0;
    }
    
    .agm-user-balance {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .agm-form-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .agm-submit-btn {
        width: 100%;
        text-align: center;
    }
}

/* Utility Classes */
.agm-hidden {
    display: none !important;
}

.agm-text-center {
    text-align: center;
}

.agm-text-right {
    text-align: right;
}

.agm-mt-10 {
    margin-top: 10px;
}

.agm-mb-10 {
    margin-bottom: 10px;
}

.agm-p-10 {
    padding: 10px;
}