/**
 * Form styles
 *
 * @package WP_Auto_Post_Images
 */

.wpapi-form-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
}

.wpapi-form {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Form Groups */
.wpapi-form-group {
    margin-bottom: 25px;
}

.wpapi-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.wpapi-required {
    color: #dc3545;
}

.wpapi-optional {
    color: #6c757d;
    font-weight: normal;
    font-size: 12px;
}

/* Input Fields */
.wpapi-input,
.wpapi-textarea,
.wpapi-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.wpapi-input:focus,
.wpapi-textarea:focus,
.wpapi-select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.wpapi-textarea {
    resize: vertical;
    min-height: 120px;
}

.wpapi-file-input {
    display: block;
    width: 100%;
    padding: 10px;
    border: 2px dashed #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.3s;
}

.wpapi-file-input:hover {
    border-color: #2271b1;
}

/* Help Text */
.wpapi-help-text {
    margin: 8px 0 0;
    font-size: 13px;
    color: #6c757d;
}

/* Image Previews */
.wpapi-image-previews {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.wpapi-image-preview {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background: #f8f9fa;
}

.wpapi-image-preview img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.wpapi-image-name {
    display: block;
    padding: 8px;
    font-size: 12px;
    color: #333;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.wpapi-remove-image {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(220, 53, 69, 0.9);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.wpapi-remove-image:hover {
    background: #dc3545;
}

.wpapi-remove-image .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

/* Caption Fields */
#wpapi-captions-container {
    margin-top: 20px;
}

.wpapi-caption-group {
    margin-bottom: 15px;
}

.wpapi-caption-label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    color: #555;
}

.wpapi-caption-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

/* Messages */
.wpapi-messages {
    margin-bottom: 20px;
}

.wpapi-notice {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.wpapi-notice strong {
    display: block;
    margin-bottom: 5px;
}

.wpapi-error {
    background: #f8d7da;
    border: 1px solid #f5c2c7;
    color: #842029;
}

.wpapi-success {
    background: #d1e7dd;
    border: 1px solid #badbcc;
    color: #0f5132;
}

.wpapi-warning {
    background: #fff3cd;
    border: 1px solid #ffecb5;
    color: #664d03;
}

/* Submit Button */
.wpapi-submit-group {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.wpapi-button {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.wpapi-button-primary {
    background: #2271b1;
    color: #fff;
}

.wpapi-button-primary:hover {
    background: #135e96;
}

.wpapi-button-primary:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Loading Spinner */
.wpapi-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6c757d;
    font-size: 14px;
}

.wpapi-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2271b1;
    border-radius: 50%;
    animation: wpapi-spin 1s linear infinite;
}

@keyframes wpapi-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .wpapi-form-container {
        padding: 10px;
    }

    .wpapi-form {
        padding: 20px;
    }

    .wpapi-image-previews {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }

    .wpapi-image-preview img {
        height: 100px;
    }
}
