:root {
    --violet-dark: #6d28d9;
    --violet-main: #7c3aed;
    --violet-pale: #f5f3ff;
    --border-violet: #c4b5fd;
    --bg-light: #F8F9FA;
}

body {
    background-color: var(--bg-light);
    font-family: system-ui, -apple-system, sans-serif;
}

/* Header */
.custom-header {
    background-color: var(--violet-dark);
    color: white;
    padding: 15px 0;
}

/* Main Layout */
.main-flex-container {
    display: flex;
    min-height: auto;
}

@media (max-width: 768px) {
    .main-flex-container {
        flex-direction: column;
    }
}

.sidebar-menu {
    width: 25%;
    background: white;
    border-right: 1px solid #E0E0E0;
    padding: 20px;
}

@media (max-width: 768px) {
    .sidebar-menu {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        padding: 1rem;
    }
}

.work-area {
    width: 75%;
    padding: 30px;
}

@media (max-width: 768px) {
    .work-area {
        width: 100%;
        padding: 1rem;
    }
}

/* Menu Items */
.menu-item {
    padding: 12px 15px;
    margin-bottom: 5px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #333333;
    text-decoration: none;
}

.menu-item-icon {
    display: inline-block;
    width: 1.25rem;
    flex-shrink: 0;
    text-align: center;
    font-size: 0.95rem;
    line-height: 1;
}

.menu-item.active {
    background-color: var(--violet-pale);
    color: var(--violet-dark);
    font-weight: bold;
}

.menu-item:hover {
    background-color: var(--violet-pale) !important;
    color: var(--violet-dark) !important;
    font-weight: bold !important;
}

.menu-item:hover * {
    color: var(--violet-dark) !important;
}

.sidebar-info {
    font-size: 0.8rem;
    color: #94a3b8;
    padding: 0.5rem 0;
    border-top: 1px dashed #e2e8f0;
    margin-top: 1rem;
    line-height: 1.8;
}

/* Card & Tool Design */
.tool-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    padding: 25px;
}

.tool-title {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--violet-dark);
    margin-bottom: 20px;
}

.settings-bar {
    display: flex;
    gap: 20px;
    background: var(--bg-light);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.btn-primary {
    background-color: var(--violet-main) !important;
    border-color: var(--violet-main) !important;
}

.btn-primary:hover {
    background-color: var(--violet-dark) !important;
}

/* Textareas */
.output-area {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    background: #f8fafc !important;
    color: #0f172a;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
}

.mono-textarea {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    transition: 0.2s;
}

.mono-textarea:focus {
    border-color: var(--border-violet);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

/* Error Alert Box */
.error-box {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

/* Copy Buttons */
.btn-copy {
    background: white;
    border: 1px solid #cbd5e1;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #475569;
    border-radius: 6px;
    transition: 0.2s;
}

.btn-copy:hover {
    background-color: var(--violet-pale);
    border-color: var(--border-violet);
    color: var(--violet-dark);
}

.btn-copy.copy-success {
    background: #d1fae5;
    border-color: #a7f3d0;
    color: #065f46;
}

.format-notice {
    background: #fef9c3;
    border: 1px solid #fde047;
    color: #854d0e;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.88rem;
}

/* Mode Switch Buttons (By Quality / By Target Size) */
.btn-mode {
    background: white;
    border: 1px solid #cbd5e1;
    color: #475569;
    font-weight: 500;
    padding: 0.5rem 1.1rem;
}
.btn-mode.active {
    background-color: var(--violet-main);
    border-color: var(--violet-main);
    color: white;
}
.btn-mode:hover:not(.active) {
    background-color: var(--violet-pale);
    color: var(--violet-dark);
}

/* Savings Badge */
.savings-badge {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}
.savings-badge.savings-good {
    background: #dcfce7;
    color: #15803d;
}
.savings-badge.savings-none {
    background: #fef9c3;
    color: #854d0e;
}

/* File List (hasil konversi batch) */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
}

.file-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
    background: #e2e8f0;
}

.file-item-thumb-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #94a3b8;
    font-size: 1.3rem;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-filename {
    font-size: 0.88rem;
    font-weight: 500;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 0.75rem;
    color: #94a3b8;
}

.metadata-found-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 999px;
    margin-top: 3px;
}
.metadata-found-badge.has-metadata {
    background: #fef9c3;
    color: #854d0e;
}
.metadata-found-badge.no-metadata {
    background: #f1f5f9;
    color: #64748b;
}

.file-status {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    flex-shrink: 0;
    white-space: nowrap;
}
.file-status-pending { background: #f1f5f9; color: #64748b; }
.file-status-converting { background: var(--violet-pale); color: var(--violet-dark); }
.file-status-done { background: #dcfce7; color: #15803d; }
.file-status-error { background: #fee2e2; color: #991b1b; }

.file-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.file-actions button {
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
}
.file-actions button:hover:not(:disabled) {
    background: var(--violet-pale);
    color: var(--violet-dark);
}
.file-actions button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.file-actions .file-remove-btn:hover:not(:disabled) {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fca5a5;
}

/* Checkerboard pattern (transparansi) */
.checkerboard-bg {
    background-image:
        linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
        linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
        linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* Main Preview */
.image-preview-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    min-height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    overflow: hidden;
}
.image-preview-box img {
    max-width: 100%;
    max-height: 420px;
    object-fit: contain;
    border-radius: 4px;
}

/* Upload / Drop Zone */
.drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    color: #64748b;
    transition: 0.2s;
}
.drop-zone:hover,
.drop-zone.drag-active {
    border-color: var(--violet-main);
    background: var(--violet-pale);
    color: var(--violet-dark);
}

/* Image Preview */
.image-preview-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    overflow: hidden;
}
.image-preview-box img {
    max-width: 100%;
    max-height: 260px;
    object-fit: contain;
    border-radius: 4px;
}
.image-meta {
    font-size: 0.82rem;
    color: #64748b;
    margin-top: 6px;
    text-align: center;
}

.info-pages-full {
    background: white;
    margin: 30px;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    clear: both;
}

.info-tabs-full {
    display: flex;
    border-bottom: 2px solid #E0E0E0;
    margin-bottom: 20px;
}

.info-tab-full {
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.info-tab-full.active {
    border-bottom-color: var(--violet-main);
    color: var(--violet-main);
    font-weight: bold;
}

/* Feedback Form */
.feedback-container-box {
    max-width: 650px;
    background: #f4f6f9;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.feedback-title {
    font-size: 1.6rem;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
}
.feedback-title i {
    color: var(--violet-main);
}

.feedback-subtitle {
    color: #64748b;
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.feedback-textarea, .feedback-input-email {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 10px 12px;
}
.feedback-textarea:focus, .feedback-input-email:focus {
    border-color: var(--border-violet);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.btn-feedback-submit {
    background-color: var(--violet-main);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.2s;
}
.btn-feedback-submit:hover {
    background-color: var(--violet-dark);
    color: white;
}

.custom-footer {
    padding: 20px 0;
    background: #eaeaea;
    border-top: 1px solid #ddd;
}

/* Frame List -- versi drag-reorder dari file-list, dgn nomor urut + tombol hapus */
.frame-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.frame-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: grab;
    transition: box-shadow 0.15s, border-color 0.15s;
}
.frame-item:active {
    cursor: grabbing;
}
.frame-item.dragging {
    opacity: 0.4;
}
.frame-item.drag-over {
    border-color: var(--violet-main);
    box-shadow: 0 0 0 2px var(--violet-pale);
}
.frame-drag-handle {
    color: #94a3b8;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.frame-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--violet-main);
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.frame-item img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.frame-filename {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.frame-remove-btn {
    background: transparent;
    border: none;
    color: #cbd5e1;
    font-size: 1.1rem;
    padding: 4px 8px;
    flex-shrink: 0;
}
.frame-remove-btn:hover {
    color: #dc2626;
}

/* Progress Bar */
.progress-label {
    font-size: 0.85rem;
    color: #475569;
    font-weight: 600;
}
.progress-bar-track {
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--violet-main);
    border-radius: 5px;
    transition: width 0.2s ease;
}

/* Result Preview */
.result-preview-img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

/* Generate/Run Button (dipakai jg sbg style tombol download) */
.btn-generate {
    background-color: var(--violet-main);
    border: none;
    color: white;
    font-weight: 700;
    padding: 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.15s ease;
}
.btn-generate:hover {
    background-color: var(--violet-dark);
    color: white;
}
.btn-generate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


/* ============================================================
   AD BANNER -- disisipkan otomatis oleh apply-ad-css.php
   ============================================================ */
.ad-banner {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    overflow: hidden;
    background: #eef1f5;
}

.ad-banner.ad-top {
    padding: 10px 0;
    min-height: 90px;
    margin-bottom: 1.5rem;
    border-radius: 8px;
}

.ad-banner.ad-in-content {
    padding: 10px 0;
    min-height: 60px;
    margin: 1.5rem 0;
    border-radius: 8px;
}

.ad-banner.ad-footer {
    padding: 10px 0;
    min-height: 90px;
    margin-bottom: 1rem;
    border-radius: 8px;
}

.ad-banner span {
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border: 1px dashed #cbd5e1;
    padding: 8px 24px;
    border-radius: 4px;
}
