.zai-cp-wrapper {
    max-width: 800px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #333;
}

.zai-cp-wrapper *,
.zai-cp-wrapper *::before,
.zai-cp-wrapper *::after {
    box-sizing: border-box;
}

.zai-cp-error {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 16px 20px;
    margin: 20px 0;
    color: #856404;
}

.zai-cp-error a {
    color: #856404;
    font-weight: 600;
}

.zai-cp-generator {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    padding: 28px;
    margin-bottom: 24px;
}

.zai-cp-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.zai-cp-label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
    color: #1a1a1a;
}

.zai-cp-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.2s;
    font-family: inherit;
}

.zai-cp-textarea:focus {
    outline: none;
    border-color: #6c5ce7;
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.zai-cp-char-count {
    display: block;
    text-align: right;
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

.zai-cp-field-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.zai-cp-field-row .zai-cp-field {
    flex: 1;
    min-width: 180px;
}

.zai-cp-select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s;
    appearance: auto;
}

.zai-cp-select:focus {
    outline: none;
    border-color: #6c5ce7;
}

.zai-cp-inspiration {
    padding: 14px;
    background: #f8f7ff;
    border-radius: 8px;
}

.zai-cp-inspiration-title {
    font-size: 13px;
    color: #666;
    margin: 0 0 10px 0;
    font-weight: 500;
}

.zai-cp-inspiration-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.zai-cp-tag {
    display: inline-block;
    padding: 6px 14px;
    background: #fff;
    border: 1px solid #d4d0f0;
    border-radius: 20px;
    font-size: 13px;
    color: #6c5ce7;
    cursor: pointer;
    transition: all 0.2s;
}

.zai-cp-tag:hover {
    background: #6c5ce7;
    color: #fff;
    border-color: #6c5ce7;
}

.zai-cp-generate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #6c5ce7, #a855f7);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.zai-cp-generate-btn:hover {
    background: linear-gradient(135deg, #5a4bd6, #9645e6);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}

.zai-cp-generate-btn:active {
    transform: translateY(0);
}

.zai-cp-generate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.zai-cp-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: zai-cp-spin 0.7s linear infinite;
}

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

.zai-cp-result {
    margin-top: 24px;
    text-align: center;
}

.zai-cp-result-image {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    background: #fafafa;
    margin-bottom: 16px;
}

.zai-cp-result-image img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.zai-cp-result-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.zai-cp-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    border: 2px solid transparent;
}

.zai-cp-download-png {
    background: #10b981;
    color: #fff;
}

.zai-cp-download-png:hover {
    background: #059669;
    color: #fff;
}

.zai-cp-download-pdf {
    background: #3b82f6;
    color: #fff;
    border: none;
}

.zai-cp-download-pdf:hover {
    background: #2563eb;
}

.zai-cp-download-pdf:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.zai-cp-new-btn {
    background: #f3f4f6;
    color: #374151;
    border: 2px solid #e5e7eb;
}

.zai-cp-new-btn:hover {
    background: #e5e7eb;
}

.zai-cp-message {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
}

.zai-cp-message.zai-cp-message-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.zai-cp-message.zai-cp-message-success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.zai-cp-history {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    padding: 20px 28px;
}

.zai-cp-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.zai-cp-history-header h3 {
    margin: 0;
    font-size: 16px;
    color: #1a1a1a;
}

.zai-cp-history-clear {
    background: none;
    border: none;
    color: #999;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
}

.zai-cp-history-clear:hover {
    color: #dc2626;
}

.zai-cp-history-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.zai-cp-history-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #999;
    font-size: 14px;
    padding: 20px 0;
}

.zai-cp-history-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.2s;
    aspect-ratio: 1;
}

.zai-cp-history-item:hover {
    border-color: #6c5ce7;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.zai-cp-history-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.zai-cp-history-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: #fff;
    padding: 6px 8px;
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.2s;
}

.zai-cp-history-item:hover .zai-cp-history-item-overlay {
    opacity: 1;
}

@media (max-width: 600px) {
    .zai-cp-generator {
        padding: 18px;
    }

    .zai-cp-field-row {
        flex-direction: column;
    }

    .zai-cp-result-actions {
        flex-direction: column;
    }

    .zai-cp-download-btn,
    .zai-cp-new-btn {
        width: 100%;
        justify-content: center;
    }

    .zai-cp-history-list {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}
