/**
 * ShipEngine Frontend Styles
 * File: assets/css/frontend.css
 */

.shipengine-form-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.shipengine-form-container h3 {
    margin: 0 0 20px 0;
    padding: 0 0 10px 0;
    border-bottom: 2px solid #0073aa;
    color: #333;
    font-size: 24px;
}

.shipengine-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-section {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #e5e5e5;
}

.form-section h4 {
    margin: 0 0 15px 0;
    color: #0073aa;
    font-size: 18px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.shipengine-form input,
.shipengine-form select,
.shipengine-form textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

.shipengine-form input:focus,
.shipengine-form select:focus,
.shipengine-form textarea:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0,115,170,0.2);
    outline: none;
}

.shipengine-form input[type="number"] {
    text-align: right;
}

.shipengine-form textarea {
    resize: vertical;
    min-height: 80px;
}

.shipengine-submit-btn {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 15px 30px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    align-self: flex-start;
}

.shipengine-submit-btn:hover {
    background: #005a87;
    transform: translateY(-1px);
}

.shipengine-submit-btn:active {
    transform: translateY(0);
}

.shipengine-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.shipengine-result {
    margin-top: 20px;
    padding: 15px;
    border-radius: 4px;
    font-size: 14px;
}

.shipengine-result .success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 15px;
    border-radius: 4px;
}

.shipengine-result .error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
}

.shipengine-result .success p,
.shipengine-result .error p {
    margin: 0 0 10px 0;
}

.shipengine-result .success p:last-child,
.shipengine-result .error p:last-child {
    margin-bottom: 0;
}

.shipengine-result a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 600;
}

.shipengine-result a:hover {
    text-decoration: underline;
}

/* Loading states */
.shipengine-form.loading {
    opacity: 0.7;
    pointer-events: none;
}

.shipengine-form.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive design */
@media (max-width: 768px) {
    .shipengine-form-container {
        margin: 10px;
        padding: 15px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .form-section {
        padding: 15px;
    }
    
    .shipengine-submit-btn {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .shipengine-form-container {
        margin: 5px;
        padding: 10px;
    }
    
    .form-section {
        padding: 10px;
    }
    
    .shipengine-form input,
    .shipengine-form select,
    .shipengine-form textarea {
        padding: 10px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Rate comparison styles */
.rates-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.rate-option {
    background: #fff;
    border: 2px solid #e5e5e5;
    border-radius: 6px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.rate-option:hover {
    border-color: #0073aa;
    box-shadow: 0 2px 8px rgba(0,115,170,0.2);
}

.rate-option.selected {
    border-color: #0073aa;
    background: #f0f8ff;
}

.rate-carrier {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.rate-service {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
}

.rate-price {
    font-size: 24px;
    font-weight: 700;
    color: #0073aa;
}

.rate-delivery {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

/* Tracking result styles */
.tracking-info {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 20px;
    margin-top: 20px;
}

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

.tracking-status {
    font-size: 18px;
    font-weight: 600;
    color: #0073aa;
}

.tracking-carrier {
    color: #666;
    font-size: 14px;
}

.tracking-events {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tracking-event {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.tracking-event:last-child {
    border-bottom: none;
}

.event-description {
    flex: 1;
    margin-right: 15px;
}

.event-location {
    color: #666;
    font-size: 12px;
    margin-top: 3px;
}

.event-date {
    color: #999;
    font-size: 12px;
    white-space: nowrap;
}