/* STACKS Shipping Plugin Styles */

.stacks-form {
    max-width: 600px;
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #f9f9f9;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.stacks-form h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    font-size: 1.4em;
    font-weight: 600;
}

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

.form-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.form-group.half {
    flex: 1;
    min-width: 200px;
}

.form-group.quarter {
    flex: 0 0 calc(25% - 11.25px);
    min-width: 100px;
}

@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }
    
    .form-group.quarter {
        flex: 1;
        min-width: auto;
    }
}

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

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

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

.form-group input:invalid {
    border-color: #d63638;
}

.form-group input:invalid:focus {
    border-color: #d63638;
    box-shadow: 0 0 0 2px rgba(214, 54, 56, 0.2);
}

.form-group button {
    background: #0073aa;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: background-color 0.3s ease;
    min-width: 200px;
}

.form-group button:hover {
    background: #005a87;
}

.form-group button:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
}

.form-group button:disabled:hover {
    background: #ccc;
}

/* Messages */
.stacks-message {
    padding: 12px 16px;
    margin: 15px 0;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.4;
}

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

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

/* Label Result */
.stacks-label-result {
    max-width: 600px;
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #28a745;
    border-radius: 5px;
    background: #d4edda;
}

.stacks-label-result h4 {
    color: #155724;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.label-info {
    margin: 10px 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 4px;
}

.label-info strong {
    color: #155724;
}

.label-download {
    margin-top: 15px;
}

.label-download a {
    display: inline-block;
    background: #28a745;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.label-download a:hover {
    background: #218838;
    color: white;
}

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

.stacks-form.loading button {
    position: relative;
}

.stacks-form.loading button:after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
}

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

/* Widget specific styles */
.widget .stacks-form {
    margin: 0;
    padding: 15px;
}

.widget .stacks-form h3 {
    font-size: 1.2em;
    margin-bottom: 15px;
}