/* Glavni kontejner */
.opd-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f9f9f9;
    padding: 15px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-sizing: border-box;
    max-width: 100%;
}

/* Sidebar */
.opd-sidebar {
    flex: 0 0 240px;
    max-width: 240px;
    background: #ffffff;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    box-sizing: border-box;
}

.opd-sidebar h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 14px;
    color: #23282d;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

/* Canvas Area */
.opd-canvas-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.opd-canvas-container {
    border: 2px dashed #cccccc;
    background-color: #ffffff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 650px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    box-sizing: border-box;
}

.opd-upload-box input[type="file"] {
    display: none !important;
}

.opd-btn-upload {
    background: #0073aa;
    color: #ffffff;
    display: block;
    width: 100%;
    text-align: center;
    padding: 10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    box-sizing: border-box;
    transition: background 0.2s ease;
}

.opd-btn-upload:hover { background: #005177; }

.opd-controls-panel {
    background: #f4f6f8;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 10px;
    margin-top: 15px;
    margin-bottom: 15px;
}

.opd-controls-panel h3 {
    font-size: 12px !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #555;
    margin-bottom: 8px !important;
}

.opd-btn-group {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.opd-btn-ctrl {
    flex: 1;
    padding: 6px 4px;
    font-size: 11px;
    font-weight: 600;
    background: #ffffff;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #333;
    text-align: center;
}

.opd-btn-ctrl:hover {
    background: #0073aa;
    color: #ffffff;
    border-color: #0073aa;
}

/* Modal Styling */
.opd-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.65);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 15px;
    box-sizing: border-box;
}

.opd-modal-content {
    background: #fff;
    width: 100%;
    max-width: 700px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}

.opd-modal-header {
    padding: 14px 18px;
    background: #0073aa;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.opd-modal-header h3 { margin: 0; color: #fff; font-size: 16px; }
.opd-modal-close { font-size: 24px; cursor: pointer; line-height: 1; }

.opd-modal-body {
    padding: 20px;
    max-height: 75vh;
    overflow-y: auto;
}

/* Grid za šablone i kategorije */
.opd-grid-templates {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 15px;
}

.opd-grid-item {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
}

.opd-grid-item:hover {
    border-color: #0073aa;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,115,170,0.15);
}

.opd-grid-item img {
    width: 100%;
    height: 80px;
    object-fit: contain;
}

.opd-grid-item span {
    font-size: 12px;
    display: block;
    margin-top: 6px;
    word-break: break-word;
    color: #333;
}

/* Kartice kategorija */
.opd-cat-card {
    position: relative;
    background: #f8fafc;
    border: 2px solid #cbd5e1;
}

.opd-cat-folder-badge {
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 16px;
}

.opd-cat-preview-box {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border-radius: 4px;
    border: 1px solid #edf2f7;
    overflow: hidden;
}

.opd-cat-title {
    display: flex;
    flex-direction: column;
    margin-top: 8px;
    font-size: 13px;
    color: #1e293b;
}

.opd-cat-title small {
    color: #64748b;
    font-size: 11px;
}

.opd-no-cover {
    color: #94a3b8;
    font-size: 12px;
    font-style: italic;
}

.opd-btn-back {
    background: #0073aa;
    color: #ffffff;
    border: none;
    padding: 8px 14px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: background 0.2s;
}

.opd-btn-back:hover { background: #005177; }

/* Layers & Misc */
.opd-layers-list { margin-bottom: 15px; max-height: 130px; overflow-y: auto; }
.opd-layer-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 8px; background: #f1f1f1; margin-bottom: 5px; border-radius: 4px; font-size: 12px;
}
.opd-layer-item.active { background: #e5f5fd; border-left: 3px solid #0073aa; font-weight: bold; }
.opd-layer-name { cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.opd-btn-del { background: none; border: none; color: #dc3545; cursor: pointer; font-weight: bold; }

.opd-btn { display: block; width: 100%; padding: 8px; text-align: center; border-radius: 4px; font-weight: 600; font-size: 13px; cursor: pointer; border: none; }
.opd-btn-template { background: #6c757d; color: #fff; }
.opd-btn-export { background: #28a745; color: #fff; }

.opd-template-info { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 11px; background: #eef; padding: 6px 8px; border-radius: 4px; }
.opd-btn-remove-sm { background: #dc3545; color: #fff; border: none; padding: 2px 6px; border-radius: 3px; cursor: pointer; font-size: 10px; }

.dpi-alert { padding: 8px; margin-bottom: 12px; border-radius: 4px; font-size: 11px; }
.dpi-danger { background-color: #f8d7da; color: #721c24; }
.dpi-warning { background-color: #fff3cd; color: #856404; }
.dpi-success { background-color: #d4edda; color: #155724; }
.opd-empty-msg { font-size: 11px; color: #888; font-style: italic; }
.opd-hint { margin-top: 8px; font-size: 12px; color: #666; text-align: center; }

@media screen and (max-width: 768px) {
    .opd-wrapper { flex-direction: column-reverse; padding: 8px; gap: 12px; }
    .opd-sidebar { flex: 1 1 100%; max-width: 100%; }
    .opd-canvas-area { width: 100%; }
}