* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f1f1f1;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 10px;
    width: 100%;
}

.card {
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
    padding: 0;
    width: 100%;
    overflow: hidden;
}

/* Tab Styles */
.tab-header {
    display: flex;
    background: #f8f9fa;
    border-radius: 6px 6px 0 0;
    width: 100%;
}

.tab-button {
    flex: 1;
    padding: 15px 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tab-button.active {
    background: white;
    border-bottom-color: #0073aa;
    color: #0073aa;
}

.tab-button:hover {
    background: #e9ecef;
}

.tab-button.active:hover {
    background: white;
}

.tab-content {
    display: none;
    padding: 20px;
    width: 100%;
}

.tab-content.active {
    display: block;
}

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

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
}

.label-with-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.label-with-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.action-buttons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.action-buttons .btn {
    padding: 4px 8px;
    font-size: 12px;
    white-space: nowrap;
}

input[type="url"],
input[type="text"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    max-width: 100%;
    box-sizing: border-box;
}

textarea {
    resize: vertical;
    min-height: 120px;
    font-family: monospace;
}

.btn {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
}

.btn-primary {
    background: #0073aa;
    color: white;
}

.btn-success {
    background: #00a32a;
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-warning {
    background: #f57c00;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn:hover {
    opacity: 0.9;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.flex {
    display: flex;
    gap: 8px;
    align-items: center;
}

.flex input {
    flex: 1;
}

.flex .btn {
    flex-shrink: 0;
    white-space: nowrap;
}

/* Accordion Styles */
.accordion {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 15px;
}

.accordion-header {
    background: #f8f9fa;
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 14px;
}

.accordion-header:hover {
    background: #e9ecef;
}

.accordion-content {
    padding: 15px;
    display: none;
}

.accordion-content.active {
    display: block;
}

.accordion-icon {
    transition: transform 0.3s ease;
}

.accordion-icon.rotated {
    transform: rotate(180deg);
}

/* Grid 4 - Scroll ngang */
.grid-4 {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 5px;
    -webkit-overflow-scrolling: touch;
}

.grid-4::-webkit-scrollbar {
    height: 4px;
}

.grid-4::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.grid-4::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.grid-4::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.img-input {
    border: 1px solid #e0e0e0;
    padding: 8px;
    border-radius: 4px;
    background: #fafafa;
    max-width: 150px;
    flex-shrink: 0;
}

.img-input input {
    margin-bottom: 6px;
}

.img-preview {
    min-height: 40px;
    background: #f9f9f9;
    border: 1px dashed #ddd;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #666;
}

.img-preview img {
    max-width: 100%;
    max-height: 100px;
    border-radius: 4px;
}

.categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.categories label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: normal;
    margin: 0;
}

.status {
    padding: 8px;
    border-radius: 4px;
    margin: 8px 0;
    font-size: 13px;
}

.status.loading {
    background: #e3f2fd;
    color: #1976d2;
}

.status.success {
    background: #e8f5e8;
    color: #2e7d32;
}

.status.error {
    background: #ffebee;
    color: #c62828;
}

.badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 3px;
    margin-left: 8px;
}

.badge-success {
    background: #e8f5e8;
    color: #2e7d32;
}

.badge-info {
    background: #e3f2fd;
    color: #1976d2;
}

.post-success-box {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.post-success-box h3 {
    color: #155724;
    margin-top: 0;
    margin-bottom: 15px;
}

.post-success-box input[readonly] {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
    cursor: text;
}

.post-success-box input[readonly]:focus {
    background-color: #e9ecef;
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, .25);
}

/* Site Configuration */
.site-config {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
    background: #fafafa;
}

.site-config hr {
    margin-top: 15px;
    border: none;
    border-top: 1px solid #e0e0e0;
}

/* Quill Editor Styles */
#editor {
    min-height: 300px;
    width: 100%;
    max-width: 100%;
}

.ql-editor {
    min-height: 280px;
    max-width: 100%;
    overflow-x: auto;
}

@media (max-width: 600px) {
    .container {
        padding: 0px;
        margin: 0;
        width: 100vw;
        max-width: 100vw;
    }

    .tab-content {
        padding: 10px;
    }

    .grid-4 {
        gap: 6px;
    }

    .img-input {
        min-width: 180px;
    }

    .label-with-button,
    .label-with-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        width: 100%;
    }

    .action-buttons {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 6px;
    }

    .action-buttons .btn {
        flex: 0 0 auto;
        min-width: 80px;
        padding: 6px 8px;
        font-size: 11px;
    }

    .tab-button {
        font-size: 14px;
        padding: 10px 8px;
    }

    input[type="url"],
    input[type="text"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px;
        -webkit-appearance: none;
        border-radius: 4px;
    }

    .flex {
        flex-wrap: wrap;
        width: 100%;
    }

    .ql-toolbar {
        border-radius: 4px 4px 0 0;
        flex-wrap: wrap;
    }

    body,
    html {
        overflow-x: hidden;
        max-width: 100vw;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 3px;
    }

    .tab-content {
        padding: 8px;
    }

    .tab-button {
        font-size: 12px;
        padding: 8px 6px;
    }

    .label-with-button,
    .label-with-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        width: 100%;
    }

    .action-buttons {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 4px;
    }

    .action-buttons .btn {
        flex: 0 0 auto;
        min-width: 70px;
        padding: 5px 6px;
        font-size: 10px;
        white-space: nowrap;
    }
}



/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 5px;
}

/* AI Loading Animation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* AI Title Suggestions Styling */
#ai-title-suggestions {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* AI Settings Layout */
.ai-feature-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.ai-feature-section h4 {
    margin: 0 0 12px 0;
    color: #333;
    font-size: 15px;
    font-weight: 600;
}

.ai-row {
    display: grid;
    grid-template-columns: 3fr 7fr;
    gap: 12px;
    align-items: start;
}

.ai-model label,
.ai-prompt label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    color: #555;
    font-size: 13px;
}

.ai-model select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    background: white;
}

.ai-prompt textarea {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    resize: vertical;
    min-height: 50px;
    font-family: inherit;
}

@media (max-width: 768px) {
    .ai-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .ai-feature-section {
        padding: 12px;
        margin-bottom: 15px;
    }

    .ai-feature-section h4 {
        font-size: 14px;
        margin-bottom: 10px;
    }
}


/* Source Editor */
#source-editor {
    border: 1px solid #e0e0e0;
    background: #fafafa;
    border-radius: 4px;
    padding: 10px;
}

#source-editor textarea {
    width: 100%;
    min-height: 280px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 13px;
    line-height: 1.5;
}

.ql-source-btn {
    font-weight: 700;
    padding: 0 8px;
}

/* Image URL button in Quill toolbar */
.ql-image-url-btn {
    font-size: 14px;
    padding: 0 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.ql-image-url-btn:hover {
    background-color: #f0f0f0;
}

.ql-image-url-btn:active {
    background-color: #e0e0e0;
}

/* AI Action Buttons */
.ai-action-btn {
    background: none !important;
    color: #0073aa !important;
    border: none !important;
    padding: 0 !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    box-shadow: none !important;
    cursor: pointer !important;
    text-decoration: none !important;
}

.ai-action-btn:hover {
    color: #005177 !important;
    text-decoration: underline !important;
}

.ai-action-btn:active {
    color: #003d5c !important;
}